Skip to content

Commit 73faf4f

Browse files
committed
Enable -requirement-machine-abstract-signatures=on in a couple of tests
There is an edge case where the Requirement Machine produces a different minimal signature than the GenericSignatureBuilder: protocol P { associatedtype X where X == Self } class C : P { typealias X = C } <T where T : P, T : C> The GenericSignatureBuilder produces <T where T == C> and the Requirement Machine produces <T where T : C>. The new interpretation makes more sense with the 'concrete contraction' pre-processing pass that is done now. The GenericSignatureBuilder's interpretation is slightly more correct, however the entire conformance is actually invalid if the class is not final, and we warn about it now. I'm going to see if we can get away with this minor ABI change without breaking anything.
1 parent 729a69e commit 73faf4f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

test/SILGen/class_conforms_with_default_concrete_self.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
1+
// RUN: %target-swift-emit-silgen %s -requirement-machine-abstract-signatures=on | %FileCheck %s
2+
// RUN: %target-swift-emit-silgen %s -requirement-machine-abstract-signatures=on -disable-requirement-machine-concrete-contraction | %FileCheck %s
23

34
public protocol P {
45
associatedtype A : Q where A.B == Self
@@ -24,5 +25,6 @@ public class D : Q {
2425
public typealias B = C
2526
}
2627

27-
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [ossa] @$s41class_conforms_with_default_concrete_self1CCAA1PA2aDP25hasDefaultImplementation1yyFTW : $@convention(witness_method: P) (@in_guaranteed C) -> () {
28-
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [ossa] @$s41class_conforms_with_default_concrete_self1CCAA1PA2aDP25hasDefaultImplementation2yyqd__1BQyd__RszAA1QRd__lFTW : $@convention(witness_method: P) <τ_0_0 where τ_0_0 == C><τ_1_0 where τ_1_0 : Q, τ_1_0.B == C> (@in_guaranteed τ_1_0, @in_guaranteed C) -> () {
28+
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [ossa] @$s41class_conforms_with_default_concrete_self1CCAA1PA2aDP25hasDefaultImplementation1yyFTW : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : C> (@in_guaranteed τ_0_0) -> () {
29+
30+
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [ossa] @$s41class_conforms_with_default_concrete_self1CCAA1PA2aDP25hasDefaultImplementation2yyqd__1BQyd__RszAA1QRd__lFTW : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : C><τ_1_0 where τ_0_0 == τ_1_0.B, τ_1_0 : Q> (@in_guaranteed τ_1_0, @in_guaranteed τ_0_0) -> () {

validation-test/compiler_crashers_2_fixed/0189-sr10033.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-swift-frontend -emit-ir -verify %s
1+
// RUN: %target-swift-frontend -emit-ir -verify -requirement-machine-abstract-signatures=on %s
2+
// RUN: %target-swift-frontend -emit-ir -verify -requirement-machine-abstract-signatures=on -disable-requirement-machine-concrete-contraction %s
23

34
protocol P1 {
45
associatedtype A2 : P2 where A2.A1 == Self

0 commit comments

Comments
 (0)