Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions interpreter/valid/valid.ml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ let check_comptype (c : context) (ct : comptype) at =

let check_subtype (c : context) (sut : subtype) at =
let SubT (_fin, uts, ct) = sut in
require (List.length uts <= 1) at "multiple supertypes";
List.iter (fun ut -> check_typeuse c ut at) uts;
check_comptype c ct at

Expand Down
9 changes: 9 additions & 0 deletions test/core/gc/type-subtyping.wast
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,15 @@
"sub type"
)

;; Testing the number of allowed supertypes

(assert_invalid
(module
(type $parent1 (sub (struct)))
(type $parent2 (sub (struct)))
(type $child (sub $parent1 $parent2 (struct))))
"multiple supertypes"
)

;; Testing exported functions with non-flat types
(module
Expand Down