Skip to content

Commit b567fc9

Browse files
[tests][SR-9425] Adapt existing SIL test case to new enum equal witness
1 parent 9fd4f00 commit b567fc9

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

test/SILGen/opaque_ownership.swift

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,33 @@ public struct Int64 : ExpressibleByIntegerLiteral, _ExpressibleByBuiltinIntegerL
150150
}
151151
}
152152

153+
public struct Int : _ExpressibleByBuiltinIntegerLiteral, ExpressibleByIntegerLiteral, Equatable {
154+
var _value: Builtin.Int64
155+
public init() {
156+
self = 0
157+
}
158+
public typealias IntegerLiteralType = Int
159+
public init(_builtinIntegerLiteral x: _MaxBuiltinIntegerType) {
160+
_value = Builtin.s_to_s_checked_trunc_IntLiteral_Int64(x).0
161+
}
162+
163+
public init(integerLiteral value: Int) {
164+
self = value
165+
}
166+
167+
public static func ==(_ lhs: Int, rhs: Int) -> Bool {
168+
return Bool(Builtin.cmp_eq_Int64(lhs._value, rhs._value))
169+
}
170+
}
171+
153172
// Test ownership of multi-case Enum values in the context of to @in thunks.
154173
// ---
155174
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [ossa] @$ss17FloatingPointSignOSQsSQ2eeoiySbx_xtFZTW :
156175
// CHECK: bb0(%0 : $FloatingPointSign, %1 : $FloatingPointSign, %2 : $@thick FloatingPointSign.Type):
157-
// CHECK: %3 = function_ref @$ss2eeoiySbx_xtSYRzSQ8RawValueRpzlF : $@convention(thin) <τ_0_0 where τ_0_0 : RawRepresentable, τ_0_0.RawValue : Equatable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0) -> Bool
158-
// CHECK: %4 = apply %3<FloatingPointSign>(%0, %1) : $@convention(thin) <τ_0_0 where τ_0_0 : RawRepresentable, τ_0_0.RawValue : Equatable> (@in_guaranteed τ_0_0, @in_guaranteed τ_0_0) -> Bool
159-
// CHECK: return %4 : $Bool
176+
// CHECK: %3 = metatype $@thin FloatingPointSign.Type // user: %5
177+
// CHECK: %4 = function_ref @$ss17FloatingPointSignO21__derived_enum_equalsySbAB_ABtFZ : $@convention(method) (FloatingPointSign, FloatingPointSign, @thin FloatingPointSign.Type) -> Bool // user: %5
178+
// CHECK: %5 = apply %4(%0, %1, %3) : $@convention(method) (FloatingPointSign, FloatingPointSign, @thin FloatingPointSign.Type) -> Bool // user: %6
179+
// CHECK: return %5 : $Bool
160180
// CHECK-LABEL: } // end sil function '$ss17FloatingPointSignOSQsSQ2eeoiySbx_xtFZTW'
161181
public enum FloatingPointSign: Int64 {
162182
/// The sign for a positive value.

0 commit comments

Comments
 (0)