From c27610d09200c19e553318918eaad4db224a1691 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 11 Sep 2023 18:07:15 -0700 Subject: [PATCH] Test that br_on_cast{_fail} must do a down cast Add tests checking for validation failures if the output type of br_on_cast or br_on_cast_fail is not a subtype of the input type. --- test/core/gc/br_on_cast.wast | 8 ++++++++ test/core/gc/br_on_cast_fail.wast | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/test/core/gc/br_on_cast.wast b/test/core/gc/br_on_cast.wast index a7b35949a..ec925cfdc 100644 --- a/test/core/gc/br_on_cast.wast +++ b/test/core/gc/br_on_cast.wast @@ -249,3 +249,11 @@ ) "type mismatch" ) +(assert_invalid + (module + (func (result anyref) + (br_on_cast 0 eqref anyref (unreachable)) + ) + ) + "type mismatch" +) diff --git a/test/core/gc/br_on_cast_fail.wast b/test/core/gc/br_on_cast_fail.wast index 601de88af..c422d1ba1 100644 --- a/test/core/gc/br_on_cast_fail.wast +++ b/test/core/gc/br_on_cast_fail.wast @@ -264,3 +264,11 @@ ) "type mismatch" ) +(assert_invalid + (module + (func (result anyref) + (br_on_cast_fail 0 eqref anyref (unreachable)) + ) + ) + "type mismatch" +)