Skip to content
Closed
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
7 changes: 5 additions & 2 deletions src/tools/execution-results.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ struct ExecutionResults {
}

bool areEqual(Literal a, Literal b) {
if (a.type != b.type) {
std::cout << "types not identical! " << a << " != " << b << '\n';
if (!Type::isSubType(a.type, b.type) && !Type::isSubType(b.type, a.type)) {
std::cout << "types not compatible! " << a << " != " << b << '\n';
return false;
}
if (a.type.isRef()) {
Expand All @@ -133,6 +133,9 @@ struct ExecutionResults {
// a separate instance of each) - we can't really identify an identical
// reference between such things. We can only compare things structurally,
// for which we compare the types.
// Another issue is that the same module, when passed through --roundtrip,
// will end up with a type that does not compare equally as we do not
// currently globally canonicalize recursive types.
return true;
}
if (a != b) {
Expand Down
13 changes: 13 additions & 0 deletions test/passes/roundtrip_fuzz-exec_all-features.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[fuzz-exec] calling foo
[fuzz-exec] note result: foo => funcref(null)
(module
(type $A (func (result (ref null $A))))
(type $none_=>_funcref (func (result funcref)))
(export "foo" (func $0))
(func $0 (result funcref)
(ref.null $A)
)
)
[fuzz-exec] calling foo
[fuzz-exec] note result: foo => funcref(null)
[fuzz-exec] comparing foo
7 changes: 7 additions & 0 deletions test/passes/roundtrip_fuzz-exec_all-features.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(module
(type $A (func (result (ref null $A))))
(func "foo" (result funcref)
(ref.null $A)
)
)