Skip to content

Commit 7c68366

Browse files
committed
[GSB] Remove unused form of addSameTypeRequirementDirect()
(cherry picked from commit a4e35ed)
1 parent 50a7ad5 commit 7c68366

File tree

6 files changed

+30
-21
lines changed

6 files changed

+30
-21
lines changed

include/swift/AST/GenericSignatureBuilder.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,6 @@ class GenericSignatureBuilder {
330330
FloatingRequirementSource Source,
331331
llvm::function_ref<void(Type, Type)> diagnoseMismatch);
332332

333-
/// \brief Add a new same-type requirement between two fully resolved types
334-
/// (output of GenericSignatureBuilder::resolve).
335-
///
336-
/// The two types must not be incompatible concrete types.
337-
ConstraintResult addSameTypeRequirementDirect(
338-
ResolvedType paOrT1,
339-
ResolvedType paOrT2,
340-
FloatingRequirementSource Source);
341-
342333
/// \brief Add a new same-type requirement between two unresolved types.
343334
///
344335
/// The types are resolved with \c GenericSignatureBuilder::resolve, and must

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,17 +3510,6 @@ ConstraintResult GenericSignatureBuilder::addSameTypeRequirement(
35103510
diagnoseMismatch);
35113511
}
35123512

3513-
ConstraintResult GenericSignatureBuilder::addSameTypeRequirementDirect(
3514-
ResolvedType paOrT1,
3515-
ResolvedType paOrT2,
3516-
FloatingRequirementSource source) {
3517-
return addSameTypeRequirementDirect(paOrT1, paOrT2, source,
3518-
[&](Type type1, Type type2) {
3519-
Diags.diagnose(source.getLoc(), diag::requires_same_concrete_type,
3520-
type1, type2);
3521-
});
3522-
}
3523-
35243513
ConstraintResult GenericSignatureBuilder::addSameTypeRequirementDirect(
35253514
ResolvedType paOrT1, ResolvedType paOrT2, FloatingRequirementSource source,
35263515
llvm::function_ref<void(Type, Type)> diagnoseMismatch) {

test/Constraints/same_types.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func test6<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y {
8888

8989
func test7<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y, T.Bar.Foo == X {
9090
// expected-warning@-1{{redundant same-type constraint 'T.Bar.Foo' == 'X'}}
91+
// expected-note@-2{{same-type constraint 'T.Bar.Foo' == 'Y.Foo' (aka 'X') implied here}}
9192
return (t.bar, t.bar.foo)
9293
}
9394

@@ -119,12 +120,14 @@ func fail6<T>(_ t: T) -> Int where T == Int { // expected-error{{same-type requi
119120

120121
func test8<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
121122
where T.Bar == Y, U.Bar.Foo == X, T.Bar == U.Bar { // expected-warning{{redundant same-type constraint 'U.Bar.Foo' == 'X'}}
123+
// expected-note@-1{{same-type constraint 'T.Bar.Foo' == 'Y.Foo' (aka 'X') implied here}}
122124
return (t.bar, u.bar, t.bar.foo, u.bar.foo)
123125
}
124126

125127
func test8a<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
126128
where
127129
T.Bar == Y, U.Bar.Foo == X, U.Bar == T.Bar { // expected-warning{{redundant same-type constraint 'U.Bar.Foo' == 'X'}}
130+
// expected-note@-1{{same-type constraint 'T.Bar.Foo' == 'Y.Foo' (aka 'X') implied here}}
128131
return (t.bar, u.bar, t.bar.foo, u.bar.foo)
129132
}
130133

test/Generics/superclass_constraint.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class C2 : C, P4 { }
102102
// CHECK: superclassConformance3
103103
// CHECK: Requirements:
104104
// CHECK-NEXT: τ_0_0 : C2 [τ_0_0: Explicit @ {{.*}}:61]
105-
// CHECK-NEXT: τ_0_0 : _NativeClass [τ_0_0: Explicit @ {{.*}}:46 -> Superclass]
105+
// CHECK-NEXT: τ_0_0 : _NativeClass [τ_0_0: Explicit @ {{.*}}:46 -> Derived]
106106
// CHECK-NEXT: τ_0_0 : P4 [τ_0_0: Explicit @ {{.*}}:61 -> Superclass (C2: P4)]
107107
// CHECK: Canonical generic signature: <τ_0_0 where τ_0_0 : C2>
108108
func superclassConformance3<T>(t: T) where T : C, T : P4, T : C2 {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See https://swift.org/LICENSE.txt for license information
6+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// REQUIRES: asserts
9+
// RUN: not %target-swift-frontend %s -emit-ir
10+
protocol P{
11+
typealias e:RangeReplaceableCollection
12+
}{}extension P{{}func e
13+
typealias e:FlattenCollection
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See https://swift.org/LICENSE.txt for license information
6+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// REQUIRES: asserts
9+
// RUN: not %target-swift-frontend %s -emit-ir
10+
protocol A:RangeReplaceableCollection
11+
protocol P{
12+
protocol A
13+
class a:A{}typealias a:A{}typealias a:RangeReplaceableCollection

0 commit comments

Comments
 (0)