-
Hi, when running the When validating this module, we have defined types:
And in the
Let's focus on the First the And according to the rule of That means, in this case, this instruction will be valid for which That is, this instruction will be valid for which Can you help to explain why this validation passes, or if I misunderstand the rules? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
By subsumption, the instruction This is a bit of a trick of the kind sometimes used in the specification of type systems. What the rule is saying is that you can weaken the operand type to anything less precise than rt (since it's a downcast anyway). Implicitly, what it is really saying is that you can always pick the corresponding top type. Before we introduced the different subtype hierarchies (any/func/extern), Since this is not so obvious, I created #513 that adds a note to this effect and a case to the validation algorithm in the Appendix. |
Beta Was this translation helpful? Give feedback.
By subsumption, the instruction
(ref.null $t1)
also has type[] → [(ref null any)]
, and(ref null any)
is a suitable rt' that is a supertype of(ref null $t0)
.This is a bit of a trick of the kind sometimes used in the specification of type systems. What the rule is saying is that you can weaken the operand type to anything less precise than rt (since it's a downcast anyway). Implicitly, what it is really saying is that you can always pick the corresponding top type. Before we introduced the different subtype hierarchies (any/func/extern),
ref.test
in fact simply had type[anyref] → [i32]
. The current formulation allows picking funcref or externref instead as the top type suitable for rt.S…