2323// a variable of type .object() as input because only that can have methods. Also, when generating function
2424// calls it can be necessary to find variables of the types that the function expects as arguments. This task
2525// is solved by defining a "Is a" relationship between types which can then be used to find suitable variables.
26+ // Notice that the relationship is not reflexive. Think of it as "Is contained by" or <=.
2627// 2. to determine possible actions that can be performed on a value. E.g. when having a reference to something
2728// that is known to be a function, a function call can be performed. Also, the method call code generator will
2829// want to know the available methods that it can call on an object, which it can query from the type system.
@@ -251,6 +252,7 @@ public struct ILType: Hashable {
251252 public static let wasmFuncRef = ILType . wasmRef ( . Abstract( . WasmFunc) , nullability: true )
252253 public static let wasmExnRef = ILType . wasmRef ( . Abstract( . WasmExn) , nullability: true )
253254 public static let wasmI31Ref = ILType . wasmRef ( . Abstract( . WasmI31) , nullability: true )
255+ public static let wasmRefI31 = ILType . wasmRef ( . Abstract( . WasmI31) , nullability: false )
254256 public static let wasmAnyRef = ILType . wasmRef ( . Abstract( . WasmAny) , nullability: true )
255257 public static let wasmRefAny = ILType . wasmRef ( . Abstract( . WasmAny) , nullability: false )
256258 public static let wasmNullRef = ILType . wasmRef ( . Abstract( . WasmNone) , nullability: true )
@@ -259,7 +261,6 @@ public struct ILType: Hashable {
259261 public static let wasmEqRef = ILType . wasmRef ( . Abstract( . WasmEq) , nullability: true )
260262 public static let wasmStructRef = ILType . wasmRef ( . Abstract( . WasmStruct) , nullability: true )
261263 public static let wasmArrayRef = ILType . wasmRef ( . Abstract( . WasmArray) , nullability: true )
262- public static let wasmRefI31 = ILType . wasmRef ( . Abstract( . WasmI31) , nullability: false )
263264 public static let wasmSimd128 = ILType ( definiteType: . wasmSimd128)
264265 public static let wasmGenericRef = ILType ( definiteType: . wasmRef)
265266
@@ -323,7 +324,7 @@ public struct ILType: Hashable {
323324 return !( lhs == rhs)
324325 }
325326
326- /// Returns true if this type subsumes the given type, i.e. every instance of other is also an instance of this type.
327+ /// Returns true if other type subsumes this type, i.e. every instance of this is also an instance of other type.
327328 public func Is( _ other: ILType ) -> Bool {
328329 return other. subsumes ( self )
329330 }
0 commit comments