Compiler should error if a source file from a different library is imported
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 215
- Avg merge
- 2h 9m
- Merged PRs (30d)
- 27
Description
I tried this:
If you have two different Wing packages:
foo/
|- wing.toml
|- main.w
bar/
|- wing.toml
|- other.w
Directly importing files between them should be compile time error:
// file: foo/main.w
bring "../bar/other.w" as other; // error: cannot directly import files from another Wing package
It feels like it may be a safer boundary if we require that a library must take an explicit dependency on another in order to be used, and imports must be made through the library name.
This happened:
No error is raised today
I expected this:
No response
Is there a workaround?
No response
Anything else?
No response
Wing Version
0.85.9
Node.js Version
No response
Platform(s)
No response
Community Notes
- Please vote by adding a 👍 reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the compiler's handling of imports and Wing package boundaries, using the two-package example in the issue as the reproduction. Confirm that a direct cross-package file import is rejected unless the other library is an explicit dependency and imported by library name, then add coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100