-
Notifications
You must be signed in to change notification settings - Fork 786
[Parser] Parse standard subtype declarations #4778
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
Conversation
Parse type definitions with the format `(sub $super (type ...))`. Update the test to use hybrid types so that the subtypes are reflected in the test output.
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
src/wasm/wat-parser.cpp
Outdated
} | ||
return Ok{}; | ||
} | ||
|
||
// subtype ::= '(' 'sub' typeidx? strtype ')' | ||
// | strtype |
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 wasn't familiar with this notation of (sub ..)
. Which spec is that in?
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.
This is how subtypes are declared in the upstream GC spec: https://github.com/WebAssembly/gc/blob/main/test/core/gc/type-subtyping.wast. Now that I'm actually looking at the examples, though, I see that I have the order slightly wrong and that the sub
should be inside the type
. I'll fix the ordering.
test/lit/wat-kitchen-sink.wast
Outdated
(type $many (func (param $x i32) (param i64 f32) (param) (param $y f64) | ||
(result anyref (ref func)))) | ||
|
||
(type $s0 (struct)) | ||
(sub (type $s0 (struct))) |
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.
Reading this, I'm not actually sure what "sub" does or means..?
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.
The reason there is no supertype here is that syntactically the supertypes are a vector, so it is allowed for there to be zero supertypes.
Parse type definitions with the format
(type $t (sub $super ...))
. Update thetest to use hybrid types so that the subtypes are reflected in the test output.