// When entering a block, stack types should be rewritten to the block's param type.
wasmFullPass(`(module
(type $s (struct (field i32)))
(type $a (array i32))
(func (export "run") (result i32)
(struct.new $s (i32.const123))
(array.new $a (i32.const1) (i32.const234))
(block (param (ref null $s) (ref $a)) (result i32)
(array.get $a (i32.const0))
drop
struct.get $s 0
)
)
)`, 123);
wasmFailValidateText(`(module
(type $s (struct (field i32)))
(type $a (array i32))
(func (export "run")
(struct.new $s (i32.const123))
(array.new $a (i32.const1) (i32.const234))
(block (param structref arrayref)
(array.get $a (i32.const0))
drop
struct.get $s 0
)
)
)`, /expression has type arrayref but expected \(ref null1\)/);
// When exiting a block, stack types should be rewritten to the block's result type.
wasmFullPass(`(module
(type $s (struct (field i32)))
(type $a (array i32))
(func (export "run") (result i32)
(block (result (ref null $s) (ref $a))
(struct.new $s (i32.const123))
(array.new $a (i32.const1) (i32.const234))
)
(array.get $a (i32.const0))
drop
struct.get $s 0
)
)`, 123);
wasmFailValidateText(`(module
(type $s (struct (field i32)))
(type $a (array i32))
(func (export "run")
(block (result structref arrayref)
(struct.new $s (i32.const123))
(array.new $a (i32.const1) (i32.const234))
)
(array.get $a (i32.const0)) ;; should not work without a downcast
drop
struct.get $s 0 ;; should not work without a downcast
drop
)
)`, /expression has type arrayref but expected \(ref null1\)/);
wasmFailValidateText(`(module
(type $s (struct (field i32)))
(type $a (array i32))
(func (export "run")
(block (result structref arrayref)
unreachable
(array.new $a (i32.const1) (i32.const234))
)
(array.get $a (i32.const0)) ;; should not work without a downcast
drop
struct.get $s 0 ;; should not work without a downcast
drop
)
)`, /expression has type arrayref but expected \(ref null1\)/);
// local.tee should also respect subtypes.
wasmFailValidateText(`(module
(type $s (struct (field i32)))
(func (export "run")
(local eqref)
(struct.new $s (i32.const123))
local.tee 0
struct.get $s 0
drop
)
)`, /expression has type eqref but expected \(ref null0\)/);
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.