Skip to content

[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

Merged
merged 2 commits into from
Jul 8, 2022
Merged

[Parser] Parse standard subtype declarations #4778

merged 2 commits into from
Jul 8, 2022

Conversation

tlively
Copy link
Member

@tlively tlively commented Jul 8, 2022

Parse type definitions with the format (type $t (sub $super ...)). Update the
test to use hybrid types so that the subtypes are reflected in the test output.

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.
@tlively tlively requested a review from kripken July 8, 2022 02:17
@tlively
Copy link
Member Author

tlively commented Jul 8, 2022

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

}
return Ok{};
}

// subtype ::= '(' 'sub' typeidx? strtype ')'
// | strtype
Copy link
Member

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?

Copy link
Member Author

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.

(type $many (func (param $x i32) (param i64 f32) (param) (param $y f64)
(result anyref (ref func))))

(type $s0 (struct))
(sub (type $s0 (struct)))
Copy link
Member

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..?

Copy link
Member Author

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.

@tlively tlively enabled auto-merge (squash) July 8, 2022 18:21
@tlively tlively merged commit 838e8ee into main Jul 8, 2022
@tlively tlively deleted the parse-subtype branch July 8, 2022 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants