Conversation
| - if `null?` is present, returns 1 for null, otherwise 0 | ||
| - `ref.test rt : [(ref rt')] -> [i32]` | ||
| - iff `rt <: trt` and `rt' <: trt` for some `trt` | ||
| - if `rt` contains `null`, returns 1 for null, otherwise 0 |
There was a problem hiding this comment.
What does "rt contains null" mean? Is rt a reference type? Then it would be different in kind from rt'.
There was a problem hiding this comment.
Good point, I was using the wrong factorisation. Fixed.
tlively
left a comment
There was a problem hiding this comment.
Great, this makes sense and is even simpler than before.
| - if `null?` is present, a null operand is passed through, otherwise traps on null | ||
| - equivalent to `(block $l (param anyref) (result (ref null? ht)) (br_on_cast null? ht $l) (unreachable))` | ||
| - if `rt` contains `null`, a null operand is passed through, otherwise traps on null | ||
| - equivalent to `(block $l (param anyref) (result rt) (br_on_cast $l rt) (unreachable))` |
There was a problem hiding this comment.
I think, this isn't true in all cases. For externref types or funcref types anyref would not be compatible.
is there a way to make it look nice while also applying to funcref types? Otherwise we could add a (for input values of the anyref type hierarchy) or a similar restriction to this line.
There was a problem hiding this comment.
Ah, indeed, this ceased to hold when we split the type hierarchy.
There was a problem hiding this comment.
I pushed a quick fix that simply replaces anyref with trt, as occurring in the typing rule.
Address #342 and simplify rules on the way. Also adjust interpreter and add tests.
@Liedtke, PTAL.