This repository was archived by the owner on Apr 25, 2025. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
br_if
previously had type[t* i32] -> [t*]
where[t*]
was the type of its target label. This typing unnecessarily lost type information in cases where the actual input result type is a strict subtype of the label result type, requiring casts to recover the types that the validation algorithm already knew about before thebr_if
.Update the type of
br_if
to be[t1* i32] -> [t1*]
where[t1*]
is a subtype of the label type[t*]
. This type preserves types that were present before thebr_if
, even when they are strict subsets of the label result types.Update the description of principle types in the appendix to allow type variables to be constrained by upper bounds and update the validation algorithm to reflect the new typing.
This current PR illustrates the intended changes only for
br_if
, but the full intended change would similarly improve the types ofbr_on_null
,br_on_non_null
,br_on_cast
,br_on_cast_fail
, andlocal.tee
.Procedurally, we would want to run this by the full CG before making this change since the proposal is already phase 4. This is a non-breaking change, though, and until very recently was actually how most implementations behaved.