Skip to content

Explanation of type matching in br_on_cast instruction #507

Answered by tlively
q82419 asked this question in Q&A
Discussion options

You must be logged in to vote

The cast succeeds because the dynamic type of ref.null any is nullref, i.e. (ref null none) despite the any annotation. nullref <: (ref null struct), so the cast succeeds and the branch is taken.

The spec for ref.null where this behavior is described is here.

Although @rossberg, it looks like the execution spec for the ref.null instruction is out of date.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@q82419
Comment options

Answer selected by q82419
Comment options

You must be logged in to vote
1 reply
@tlively
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants