-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: implement use for single file .wit #864
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me!
crates/wit-parser/src/ast.rs
Outdated
} | ||
|
||
pub struct Use<'a> { | ||
pub names: Option<Vec<UseName<'a>>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to remove the *
syntax since I don't think we really need that much any more and can always add that in later. For now I'm leaving that out of WebAssembly/component-model#141
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should i also make a pass through the tests and delete any use * ...
related ones?
crates/wit-parser/src/ast/resolve.rs
Outdated
SortResults::Partial(_) => { | ||
bail!("interface `use` cycle detected"); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's definitely ok to punt "really good error messages" to later, but I do think this should at least mention one interface (with a span) in the chain of cyclic interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this look? The following wit
...
interface x {
type m = string
use { m } from y
}
interface y {
use { m } from x
}
... produces the error:
Error: interface y contains a `use` cycle
--> test.wit:6:11
|
6 | interface y {
|
Signed-off-by: Brian H <brian.hardock@fermyon.com>
I've folded this into #867, although moreso conceptually than literally as I'm not doing a great job of persisting history and such. I wanted to note here though the progress on that! |
Excellent. I close this for now! Thanks @alexcrichton |
This PR implements resolution of
use
for single file.wit
. Interfaces are defined and resolved topologically.Signed-off-by: Brian H brian.hardock@fermyon.com