Skip to content

Commit 44045e2

Browse files
committed
[test] Update SIL printing/parsing tests for 'witness_method: <protocol>'.
1 parent 0236db7 commit 44045e2

File tree

98 files changed

+592
-567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+592
-567
lines changed

test/Frontend/sil-merge-partial-modules.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class CircleManager : ShapeManager {
4949

5050
// CHECK-LABEL: sil @_T04test17versionedFunctionyyF : $@convention(thin) () -> ()
5151

52-
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @_T04test9RectangleVAA5ShapeA2aDP4drawyyFTW : $@convention(witness_method) (@in_guaranteed Rectangle) -> () {
52+
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @_T04test9RectangleVAA5ShapeA2aDP4drawyyFTW : $@convention(witness_method: Shape) (@in_guaranteed Rectangle) -> () {
5353
// CHECK: function_ref @_T04test14publicFunctionyyF
5454
// CHECK: }
5555

@@ -59,7 +59,7 @@ public class CircleManager : ShapeManager {
5959

6060
// CHECK-LABEL: sil @_T04test14publicFunctionyyF : $@convention(thin) () -> ()
6161

62-
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @_T04test9RectangleVAA5ShapeA2aDP4areaSfvgTW : $@convention(witness_method) (@in_guaranteed Rectangle) -> Float {
62+
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] @_T04test9RectangleVAA5ShapeA2aDP4areaSfvgTW : $@convention(witness_method: Shape) (@in_guaranteed Rectangle) -> Float {
6363
// CHECK: function_ref @_T04test9RectangleV4areaSfvg
6464
// CHECK: }
6565

test/IRGen/Inputs/usr/include/Gizmo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ struct StructOfNSStrings useStructOfNSStringsInObjC(struct StructOfNSStrings);
142142
@end
143143

144144
__attribute__((swift_name("OuterType.InnerType")))
145-
@interface OuterTypeInnerType : NSObject
145+
@interface OuterTypeInnerType : NSObject<NSRuncing>
146146
@end

test/IRGen/boxed_existential.sil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ entry(%b : $Error):
105105
%o = open_existential_box %b : $Error to $*@opened("01234567-89AB-CDEF-0123-000000000000") Error
106106
// CHECK: [[CODE_ADDR:%.*]] = getelementptr {{.*}} [[WITNESS]], i32 1
107107
// CHECK: [[CODE:%.*]] = load {{.*}} [[CODE_ADDR]]
108-
%m = witness_method $@opened("01234567-89AB-CDEF-0123-000000000000") Error, #Error._code!getter.1, %o : $*@opened("01234567-89AB-CDEF-0123-000000000000") Error : $@convention(witness_method) <Self: Error> (@in_guaranteed Self) -> Int
108+
%m = witness_method $@opened("01234567-89AB-CDEF-0123-000000000000") Error, #Error._code!getter.1, %o : $*@opened("01234567-89AB-CDEF-0123-000000000000") Error : $@convention(witness_method: Error) <Self: Error> (@in_guaranteed Self) -> Int
109109
// CHECK: [[CODE_FN:%.*]] = bitcast i8* [[CODE]] to [[INT:i[0-9]+]] (%swift.opaque*, %swift.type*, i8**)*
110110
// CHECK: [[RESULT:%.*]] = call swiftcc [[INT]] [[CODE_FN]](%swift.opaque* noalias nocapture swiftself [[ADDR]], %swift.type* [[TYPE]], i8** [[WITNESS]])
111-
%c = apply %m<@opened("01234567-89AB-CDEF-0123-000000000000") Error>(%o) : $@convention(witness_method) <Self: Error> (@in_guaranteed Self) -> Int
111+
%c = apply %m<@opened("01234567-89AB-CDEF-0123-000000000000") Error>(%o) : $@convention(witness_method: Error) <Self: Error> (@in_guaranteed Self) -> Int
112112
// CHECK: ret [[INT]] [[RESULT]]
113113
return %c : $Int
114114
}

test/IRGen/existential_metatypes.sil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ bb0(%0 : $Int):
2929
return %3 : $Int
3030
}
3131

32-
sil [transparent] [thunk] @int_kind_getter_witness : $@convention(witness_method) (@in_guaranteed Int) -> Int {
32+
sil [transparent] [thunk] @int_kind_getter_witness : $@convention(witness_method: Kindable) (@in_guaranteed Int) -> Int {
3333
bb0(%0 : $*Int):
3434
%1 = load %0 : $*Int
3535
%2 = function_ref @int_kind_getter : $@convention(method) (Int) -> Int
@@ -44,7 +44,7 @@ bb0(%0 : $Float):
4444
return %3 : $Int
4545
}
4646

47-
sil [transparent] [thunk] @float_kind_getter_witness : $@convention(witness_method) (@in_guaranteed Float) -> Int {
47+
sil [transparent] [thunk] @float_kind_getter_witness : $@convention(witness_method: Kindable) (@in_guaranteed Float) -> Int {
4848
bb0(%0 : $*Float):
4949
%1 = load %0 : $*Float
5050
%2 = function_ref @float_kind_getter : $@convention(method) (Float) -> Int

test/IRGen/function_types.sil

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import Builtin
1212

1313
sil_stage canonical
1414

15+
public protocol Protocol {}
16+
struct S : Protocol {}
17+
1518
// CHECK-LABEL: define{{( protected)?}} swiftcc i8* @thin_func_value(i8*) {{.*}} {
1619
// CHECK-NEXT: entry:
1720
// CHECK-NEXT: ret i8* %0
@@ -40,9 +43,9 @@ entry(%x : $() -> ()):
4043
// CHECK-NEXT: entry:
4144
// CHECK-NEXT: ret i8* %0
4245
// CHECK-NEXT: }
43-
sil @thin_witness_value : $@convention(thin) (@convention(witness_method) () -> ()) -> @convention(witness_method) () -> () {
44-
entry(%x : $@convention(witness_method) () -> ()):
45-
return %x : $@convention(witness_method) () -> ()
46+
sil @thin_witness_value : $@convention(thin) (@convention(witness_method: Protocol) (S) -> ()) -> @convention(witness_method: Protocol) (S) -> () {
47+
entry(%x : $@convention(witness_method: Protocol) (S) -> ()):
48+
return %x : $@convention(witness_method: Protocol) (S) -> ()
4649
}
4750

4851
struct X {}

test/IRGen/lowered_optional_self_metadata.sil

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ sil_stage canonical
33

44
import Swift
55

6+
public protocol Protocol {
7+
static func foo(_: Self?)
8+
}
9+
610
// SR-3021: Ensure we pass the Self type metadata for Optional methods using the
711
// formal Optional type and not a lowered SIL type.
812

913
// CHECK-LABEL: @_TMaGSqFT_T__
1014

1115
sil @optional_method : $@convention(method) <T> (@in_guaranteed Optional<T>) -> ()
12-
sil @optional_witness_method : $@convention(witness_method) <T> (@in_guaranteed Optional<T>) -> ()
1316

1417
sil @call_optional_method_with_lowered_function : $@convention(thin) (@in_guaranteed Optional<@callee_owned (@in ()) -> @out ()>) -> () {
1518
entry(%x : $*Optional<@callee_owned (@in ()) -> @out ()>):
1619
%f = function_ref @optional_method : $@convention(method) <T> (@in_guaranteed Optional<T>) -> ()
1720
apply %f<() -> ()>(%x) : $@convention(method) <T> (@in_guaranteed Optional<T>) -> ()
18-
%g = function_ref @optional_witness_method : $@convention(witness_method) <T> (@in_guaranteed Optional<T>) -> ()
19-
apply %g<() -> ()>(%x) : $@convention(witness_method) <T> (@in_guaranteed Optional<T>) -> ()
2021
%p = partial_apply %f<() -> ()>() : $@convention(method) <T> (@in_guaranteed Optional<T>) -> ()
21-
%q = partial_apply %g<() -> ()>() : $@convention(witness_method) <T> (@in_guaranteed Optional<T>) -> ()
2222
return undef : $()
2323
}
2424

test/IRGen/objc_shared_imported_decl.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Swift
88

99
sil public @use_witness : $@convention(thin) () -> () {
10-
%0 = witness_method $SomeOptions, #Equatable."=="!1 : <Self where Self : Equatable> (Self.Type) -> (Self, Self) -> Bool : $@convention(witness_method) <τ_0_0 where τ_0_0 : Equatable> (@in τ_0_0, @in τ_0_0, @thick τ_0_0.Type) -> Bool
10+
%0 = witness_method $SomeOptions, #Equatable."=="!1 : <Self where Self : Equatable> (Self.Type) -> (Self, Self) -> Bool : $@convention(witness_method: Equatable) <τ_0_0 where τ_0_0 : Equatable> (@in τ_0_0, @in τ_0_0, @thick τ_0_0.Type) -> Bool
1111
%1 = tuple ()
1212
return %1: $()
1313
}

test/IRGen/objc_types_as_member.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sil @use_metatype : $@convention(thin) <T> (@thin T.Type) -> ()
1313
// CHECK: call swiftcc void @use_metatype(%swift.type* [[TMP]])
1414
// CHECK: ret void
1515

16-
sil @test : $@convention(witness_method) (@guaranteed OuterType.InnerType) -> () {
16+
sil @test : $@convention(witness_method: NSRuncing) (@guaranteed OuterType.InnerType) -> () {
1717
bb0(%0 : $OuterType.InnerType):
1818
%1 = function_ref @use_metatype : $@convention(thin) <τ_0_0> (@thin τ_0_0.Type) -> ()
1919
%2 = metatype $@thin OuterType.Type

test/IRGen/partial_apply.sil

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,14 @@ bb0:
429429

430430
// Crash on partial apply of witness_method without generic signature
431431

432-
sil hidden_external @concrete_witness_method : $@convention(witness_method) (Int, Int) -> ()
432+
extension Int: P0 {}
433+
434+
sil hidden_external @concrete_witness_method : $@convention(witness_method: P0) (Int, Int) -> ()
433435

434436
sil hidden @partial_apply_witness_method : $@convention(thin) (Int) -> () {
435437
bb0(%0 : $Int):
436-
%fn = function_ref @concrete_witness_method : $@convention(witness_method) (Int, Int) -> ()
437-
%pa = partial_apply %fn (%0) : $@convention(witness_method) (Int, Int) -> ()
438+
%fn = function_ref @concrete_witness_method : $@convention(witness_method: P0) (Int, Int) -> ()
439+
%pa = partial_apply %fn (%0) : $@convention(witness_method: P0) (Int, Int) -> ()
438440
%result = tuple ()
439441
return %result : $()
440442
}

test/IRGen/partial_apply_forwarder.sil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public protocol Observer {
1919

2020
sil hidden @witness_method : $@convention(thin) <S where S : Observable><O where O : Observer, S.Result == O.Result> (@in S) -> @owned @callee_owned (@in O) -> () {
2121
bb0(%0 : $*S):
22-
%1 = witness_method $S, #Observable.subscribe!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result> (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
23-
%2 = partial_apply %1<S, O>(%0) : $@convention(witness_method) <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result> (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
22+
%1 = witness_method $S, #Observable.subscribe!1 : $@convention(witness_method: Observable) <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result> (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
23+
%2 = partial_apply %1<S, O>(%0) : $@convention(witness_method: Observable) <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result> (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
2424
return %2 : $@callee_owned (@in O) -> ()
2525
}
2626

test/IRGen/protocol_extensions.sil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ extension P1 {
1717
sil hidden @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@convention(method) <Self where Self : P1> (@in Self) -> () {
1818
bb0(%0 : $*Self):
1919
debug_value_addr %0 : $*Self, let, name "self" // id: %1
20-
%2 = witness_method $Self, #P1.reqP1a!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> () // user: %3
21-
%3 = apply %2<Self>(%0) : $@convention(witness_method) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> ()
20+
%2 = witness_method $Self, #P1.reqP1a!1 : $@convention(witness_method: P1) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> () // user: %3
21+
%3 = apply %2<Self>(%0) : $@convention(witness_method: P1) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> ()
2222
destroy_addr %0 : $*Self // id: %4
2323
%5 = tuple () // user: %6
2424
return %5 : $() // id: %6

0 commit comments

Comments
 (0)