Skip to content

Update validation for exact types#142

Open
tlively wants to merge 1 commit intomainfrom
exact-types
Open

Update validation for exact types#142
tlively wants to merge 1 commit intomainfrom
exact-types

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented Apr 6, 2026

The custom descriptors proposal is also at phase 3 and adds a notion of "exact" heap types. A heap type (exact $foo) is a subtype of $foo. The custom descriptors proposal refines existing instructions that produce new references like struct.new $foo, array.new $foo, and ref.func $foo to produce exact types rather than inexact types. Update the validation rules for the stack switching instructions accordingly.

This does not need to be landed as long as custom descriptors has not reached phase 4, but it would be good to get eyes on the intersection of the two proposals early.

The custom descriptors proposal is also at phase 3 and adds a notion of "exact" heap types. A heap type `(exact $foo)` is a subtype of `$foo`. The custom descriptors proposal refines existing instructions that produce new references like `struct.new $foo`, `array.new $foo`, and `ref.func $foo` to produce exact types rather than inexact types. Update the validation rules for the stack switching instructions accordingly.

This does not need to be landed as long as custom descriptors has not reached phase 4, but it would be good to get eyes on the intersection of the two proposals early.
@tlively tlively requested review from fgmccabe and rossberg April 6, 2026 20:31
Copy link
Copy Markdown
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look right to me.

where:
- $e : [] -> [t*]
- $ct1 = cont [t1* (ref $ct2)] -> [t*]
- $ct1 = cont [t1* (ref null? (exact? $ct2))] -> [t*]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing null? here looks like an inconsistency independent from exact types. Perhaps make a PR fixing it separately?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #143

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