Skip to content

Commit 1722d14

Browse files
committed
fix test and rename error
1 parent df1cffd commit 1722d14

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/wasm-type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ struct TypeBuilder {
672672
// A continuation reference that does not refer to a function type.
673673
InvalidFuncType,
674674
// A non-shared field of a shared heap type.
675-
InvalidFieldType,
675+
InvalidUnsharedField,
676676
};
677677

678678
struct Error {

src/wasm/wasm-type.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,8 +1697,8 @@ std::ostream& operator<<(std::ostream& os, TypeBuilder::ErrorReason reason) {
16971697
return os << "Heap type has an undeclared child";
16981698
case TypeBuilder::ErrorReason::InvalidFuncType:
16991699
return os << "Continuation has invalid function type";
1700-
case TypeBuilder::ErrorReason::InvalidFieldType:
1701-
return os << "Heap type has an invalid field type";
1700+
case TypeBuilder::ErrorReason::InvalidUnsharedField:
1701+
return os << "Heap type has an invalid unshared field";
17021702
}
17031703
WASM_UNREACHABLE("Unexpected error reason");
17041704
}
@@ -2661,14 +2661,14 @@ validateType(HeapTypeInfo& info, std::unordered_set<HeapType>& seenTypes) {
26612661
case HeapTypeInfo::StructKind:
26622662
for (auto& field : info.struct_.fields) {
26632663
if (field.type.isRef() && !field.type.getHeapType().isShared()) {
2664-
return TypeBuilder::ErrorReason::InvalidFieldType;
2664+
return TypeBuilder::ErrorReason::InvalidUnsharedField;
26652665
}
26662666
}
26672667
break;
26682668
case HeapTypeInfo::ArrayKind: {
26692669
auto elem = info.array.element.type;
26702670
if (elem.isRef() && !elem.getHeapType().isShared()) {
2671-
return TypeBuilder::ErrorReason::InvalidFieldType;
2671+
return TypeBuilder::ErrorReason::InvalidUnsharedField;
26722672
}
26732673
break;
26742674
}

test/lit/passes/type-merging-shared.wast

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@
7979
(module
8080
;; Shared and unshared basic heap types similarly cannot be merged.
8181
;; CHECK: (rec
82-
;; CHECK-NEXT: (type $A' (shared (struct (field anyref))))
82+
;; CHECK-NEXT: (type $A' (struct (field anyref)))
8383

84-
;; CHECK: (type $A (shared (struct (field (ref null (shared any))))))
85-
(type $A (shared (struct (ref null (shared any)))))
86-
(type $A' (shared (struct (ref null any))))
84+
;; CHECK: (type $A (struct (field (ref null (shared any)))))
85+
(type $A (struct (ref null (shared any))))
86+
(type $A' (struct (ref null any)))
8787

8888
;; CHECK: (type $2 (func))
8989

0 commit comments

Comments
 (0)