Skip to content

Commit 70aa4f4

Browse files
committed
---
yaml --- r: 344767 b: refs/heads/master c: bee37c9 h: refs/heads/master i: 344765: d3e0034 344763: beb4a1c 344759: 73fbd01 344751: 50ec555 344735: d77660d 344703: 39925e9
1 parent d9edc9c commit 70aa4f4

File tree

15 files changed

+109
-66
lines changed

15 files changed

+109
-66
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 58b4504110036161bd9c7caafb7bee7abf929036
2+
refs/heads/master: bee37c9af1fd95c847bd51127bc80f53b226072f
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/include/swift/AST/DiagnosticsSema.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,14 @@ ERROR(types_not_equal,none,
15301530
(Type, Type, Type))
15311531
ERROR(type_does_not_conform_owner,none,
15321532
"%0 requires that %1 conform to %2", (Type, Type, Type))
1533+
ERROR(type_does_not_conform_in_decl_ref,none,
1534+
"referencing %0 %1 on %2 requires that %3 conform to %4",
1535+
(DescriptiveDeclKind, DeclName, Type, Type, Type))
1536+
ERROR(type_does_not_conform_decl_owner,none,
1537+
"%0 %1 requires that %2 conform to %3",
1538+
(DescriptiveDeclKind, DeclName, Type, Type))
1539+
NOTE(where_type_does_not_conform_type,none,
1540+
"where %0 = %1", (Type, Type))
15331541
NOTE(requirement_implied_by_conditional_conformance,none,
15341542
"requirement from conditional conformance of %0 to %1", (Type, Type))
15351543
NOTE(candidate_types_equal_requirement,none,

trunk/lib/Sema/CSDiagnostics.cpp

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,36 @@ bool MissingConformanceFailure::diagnose() {
147147
diag::cannot_convert_argument_value_protocol, type,
148148
protocolType);
149149
} else {
150-
emitDiagnostic(anchor->getLoc(), diag::type_does_not_conform_owner,
151-
ownerType, type, protocolType);
150+
const auto &req = getRequirement();
151+
auto *genericCtx = AffectedDecl->getAsGenericContext();
152+
153+
std::function<const DeclContext *(Type)> getAffectedCtx =
154+
[&](Type type) -> const DeclContext * {
155+
if (auto *DMT = type->getAs<DependentMemberType>())
156+
return getAffectedCtx(DMT->getBase());
157+
158+
if (auto *GPT = type->getAs<GenericTypeParamType>())
159+
return GPT->getDecl()->getDeclContext();
160+
161+
return genericCtx;
162+
};
163+
164+
const auto *affected = getAffectedCtx(req.getFirstType());
165+
if (affected != genericCtx) {
166+
auto *NTD = affected->getAsNominalTypeOrNominalTypeExtensionContext();
167+
emitDiagnostic(anchor->getLoc(), diag::type_does_not_conform_in_decl_ref,
168+
AffectedDecl->getDescriptiveKind(),
169+
AffectedDecl->getFullName(), NTD->getDeclaredType(), type,
170+
protocolType);
171+
} else {
172+
emitDiagnostic(anchor->getLoc(), diag::type_does_not_conform_decl_owner,
173+
AffectedDecl->getDescriptiveKind(),
174+
AffectedDecl->getFullName(), type, protocolType);
175+
}
176+
177+
emitDiagnostic(affected->getAsDeclOrDeclExtensionContext(),
178+
diag::where_type_does_not_conform_type, req.getFirstType(),
179+
type);
152180
}
153181
return true;
154182
}

trunk/test/Constraints/conditionally_defined_types.swift

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ let _ = SameType<Y>.T.self // expected-error {{'SameType<Y>.T.Type' (aka 'X.Type
5454
let _ = SameType<X>.T.self
5555

5656
struct Conforms<T> {}
57-
extension Conforms where T: P {
57+
extension Conforms where T: P { // expected-note 5 {{where 'T' = 'Y'}}
5858
typealias TypeAlias1 = T
5959
typealias TypeAlias2 = Y
6060
typealias TypeAlias3<U> = (T, U)
@@ -75,18 +75,18 @@ let _ = Conforms<X>.Decl3.self
7575
let _ = Conforms<X>.Decl4<X>.self
7676
let _ = Conforms<X>.Decl5<X>.self
7777

78-
let _ = Conforms<Y>.TypeAlias1.self // expected-error {{'Conforms<Y>.TypeAlias1' (aka 'Y') requires that 'Y' conform to 'P'}}
79-
let _ = Conforms<Y>.TypeAlias2.self // expected-error {{'Conforms<Y>.TypeAlias2' (aka 'Y') requires that 'Y' conform to 'P'}}
78+
let _ = Conforms<Y>.TypeAlias1.self // expected-error {{referencing type alias 'TypeAlias1' on 'Conforms' requires that 'Y' conform to 'P'}}
79+
let _ = Conforms<Y>.TypeAlias2.self // expected-error {{referencing type alias 'TypeAlias2' on 'Conforms' requires that 'Y' conform to 'P'}}
8080
let _ = Conforms<Y>.TypeAlias3<X>.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
81-
let _ = Conforms<Y>.Decl1.self // expected-error {{'Conforms<Y>.Decl1' requires that 'Y' conform to 'P'}}
82-
let _ = Conforms<Y>.Decl2.self // expected-error {{'Conforms<Y>.Decl2' requires that 'Y' conform to 'P'}}
83-
let _ = Conforms<Y>.Decl3.self // expected-error {{'Conforms<Y>.Decl3' requires that 'Y' conform to 'P'}}
81+
let _ = Conforms<Y>.Decl1.self // expected-error {{referencing struct 'Decl1' on 'Conforms' requires that 'Y' conform to 'P'}}
82+
let _ = Conforms<Y>.Decl2.self // expected-error {{referencing enum 'Decl2' on 'Conforms' requires that 'Y' conform to 'P'}}
83+
let _ = Conforms<Y>.Decl3.self // expected-error {{referencing class 'Decl3' on 'Conforms' requires that 'Y' conform to 'P'}}
8484
let _ = Conforms<Y>.Decl4<X>.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
8585
let _ = Conforms<Y>.Decl5<X>.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
8686

87-
extension Conforms: AssociatedType where T: P {}
87+
extension Conforms: AssociatedType where T: P {} // expected-note {{where 'T' = 'Y'}}
8888

89-
let _ = Conforms<Y>.T.self // expected-error {{'Conforms<Y>.T' (aka 'Y') requires that 'Y' conform to 'P'}}
89+
let _ = Conforms<Y>.T.self // expected-error {{referencing type alias 'T' on 'Conforms' requires that 'Y' conform to 'P'}}
9090

9191
let _ = Conforms<X>.T.self
9292

@@ -174,6 +174,9 @@ let _ = SameType<Y>.Decl4<Y>.Decl5<X>.self // expected-error {{'SameType<Y>.Decl
174174

175175
// Finally, extra complicated:
176176
extension Conforms.Decl4 where U: AssociatedType, U.T: P {
177+
// expected-note@-1 5 {{where 'U' = 'Y'}}
178+
// expected-note@-2 5 {{'U.T' = 'Z2.T' (aka 'Y')}}
179+
// expected-note@-3 5 {{'U.T' = 'Y.T'}}
177180
typealias TypeAlias1 = T
178181
typealias TypeAlias2 = Y
179182
typealias TypeAlias3<V> = (T, U, V)
@@ -197,34 +200,34 @@ let _ = Conforms<X>.Decl4<Z1>.Decl5<X>.self
197200
// Two different forms of badness, corresponding to the two requirements:
198201

199202
let _ = Conforms<X>.Decl4<Y>.TypeAlias1.self
200-
// expected-error@-1 {{'Conforms<X>.Decl4<Y>.TypeAlias1' (aka 'X') requires that 'Y.T' conform to 'P'}}
201-
// expected-error@-2 {{'Conforms<X>.Decl4<Y>.TypeAlias1' (aka 'X') requires that 'Y' conform to 'AssociatedType'}}
203+
// expected-error@-1 {{referencing type alias 'TypeAlias1' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
204+
// expected-error@-2 {{referencing type alias 'TypeAlias1' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
202205

203206
let _ = Conforms<X>.Decl4<Y>.TypeAlias2.self
204-
// expected-error@-1 {{'Conforms<X>.Decl4<Y>.TypeAlias2' (aka 'Y') requires that 'Y.T' conform to 'P'}}
205-
// expected-error@-2 {{'Conforms<X>.Decl4<Y>.TypeAlias2' (aka 'Y') requires that 'Y' conform to 'AssociatedType'}}
207+
// expected-error@-1 {{referencing type alias 'TypeAlias2' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
208+
// expected-error@-2 {{referencing type alias 'TypeAlias2' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
206209

207210
let _ = Conforms<X>.Decl4<Y>.TypeAlias3<X>.self // expected-error {{type 'Y' does not conform to protocol 'AssociatedType'}}
208211
let _ = Conforms<X>.Decl4<Y>.Decl1.self
209-
// expected-error@-1 {{'Conforms<X>.Decl4<Y>.Decl1' requires that 'Y.T' conform to 'P'}}
210-
// expected-error@-2 {{'Conforms<X>.Decl4<Y>.Decl1' requires that 'Y' conform to 'AssociatedType'}}
212+
// expected-error@-1 {{referencing struct 'Decl1' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
213+
// expected-error@-2 {{referencing struct 'Decl1' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
211214

212215
let _ = Conforms<X>.Decl4<Y>.Decl2.self
213-
// expected-error@-1 {{'Conforms<X>.Decl4<Y>.Decl2' requires that 'Y.T' conform to 'P'}}
214-
// expected-error@-2 {{'Conforms<X>.Decl4<Y>.Decl2' requires that 'Y' conform to 'AssociatedType'}}
216+
// expected-error@-1 {{referencing enum 'Decl2' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
217+
// expected-error@-2 {{referencing enum 'Decl2' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
215218

216219
let _ = Conforms<X>.Decl4<Y>.Decl3.self
217-
// expected-error@-1 {{'Conforms<X>.Decl4<Y>.Decl3' requires that 'Y.T' conform to 'P'}}
218-
// expected-error@-2 {{'Conforms<X>.Decl4<Y>.Decl3' requires that 'Y' conform to 'AssociatedType'}}
220+
// expected-error@-1 {{referencing class 'Decl3' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
221+
// expected-error@-2 {{referencing class 'Decl3' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
219222

220223
let _ = Conforms<X>.Decl4<Y>.Decl4<X>.self // expected-error {{type 'Y' does not conform to protocol 'AssociatedType'}}
221224
let _ = Conforms<X>.Decl4<Y>.Decl5<X>.self // expected-error {{type 'Y' does not conform to protocol 'AssociatedType'}}
222225

223-
let _ = Conforms<X>.Decl4<Z2>.TypeAlias1.self // expected-error {{'Conforms<X>.Decl4<Z2>.TypeAlias1' (aka 'X') requires that 'Z2.T' (aka 'Y') conform to 'P'}}
224-
let _ = Conforms<X>.Decl4<Z2>.TypeAlias2.self // expected-error {{'Conforms<X>.Decl4<Z2>.TypeAlias2' (aka 'Y') requires that 'Z2.T' (aka 'Y') conform to 'P'}}
226+
let _ = Conforms<X>.Decl4<Z2>.TypeAlias1.self // expected-error {{referencing type alias 'TypeAlias1' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
227+
let _ = Conforms<X>.Decl4<Z2>.TypeAlias2.self // expected-error {{referencing type alias 'TypeAlias2' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
225228
let _ = Conforms<X>.Decl4<Z2>.TypeAlias3<X>.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
226-
let _ = Conforms<X>.Decl4<Z2>.Decl1.self // expected-error {{'Conforms<X>.Decl4<Z2>.Decl1' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
227-
let _ = Conforms<X>.Decl4<Z2>.Decl2.self // expected-error {{'Conforms<X>.Decl4<Z2>.Decl2' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
228-
let _ = Conforms<X>.Decl4<Z2>.Decl3.self // expected-error {{'Conforms<X>.Decl4<Z2>.Decl3' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
229+
let _ = Conforms<X>.Decl4<Z2>.Decl1.self // expected-error {{referencing struct 'Decl1' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
230+
let _ = Conforms<X>.Decl4<Z2>.Decl2.self // expected-error {{referencing enum 'Decl2' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
231+
let _ = Conforms<X>.Decl4<Z2>.Decl3.self // expected-error {{referencing class 'Decl3' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
229232
let _ = Conforms<X>.Decl4<Z2>.Decl4<X>.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
230233
let _ = Conforms<X>.Decl4<Z2>.Decl5<X>.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}

trunk/test/Constraints/diagnostics.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ func f7() -> (c: Int, v: A) {
9393
return f6(g) // expected-error {{cannot convert return expression of type '(c: Int, i: A)' to return type '(c: Int, v: A)'}}
9494
}
9595

96-
func f8<T:P2>(_ n: T, _ f: @escaping (T) -> T) {}
96+
func f8<T:P2>(_ n: T, _ f: @escaping (T) -> T) {} // expected-note {{where 'T' = '(_, _)'}}
9797
f8(3, f4) // expected-error {{argument type 'Int' does not conform to expected type 'P2'}}
9898
typealias Tup = (Int, Double)
9999
func f9(_ x: Tup) -> Tup { return x }
100-
f8((1,2.0), f9) // expected-error {{'(Tup, @escaping (Tup) -> Tup) -> ()' (aka '((Int, Double), @escaping ((Int, Double)) -> (Int, Double)) -> ()') requires that '(_, _)' conform to 'P2'}}
100+
f8((1,2.0), f9) // expected-error {{global function 'f8' requires that '(_, _)' conform to 'P2'}}
101101

102102
// <rdar://problem/19658691> QoI: Incorrect diagnostic for calling nonexistent members on literals
103103
1.doesntExist(0) // expected-error {{value of type 'Int' has no member 'doesntExist'}}
@@ -1188,10 +1188,10 @@ func rdar17170728() {
11881188

11891189
// https://bugs.swift.org/browse/SR-5934 - failure to emit diagnostic for bad
11901190
// generic constraints
1191-
func elephant<T, U>(_: T) where T : Collection, T.Element == U, T.Element : Hashable {}
1191+
func elephant<T, U>(_: T) where T : Collection, T.Element == U, T.Element : Hashable {} // expected-note {{where 'U' = 'T'}}
11921192

11931193
func platypus<T>(a: [T]) {
1194-
_ = elephant(a) // expected-error {{'([T]) -> ()' requires that 'T' conform to 'Hashable'}}
1194+
_ = elephant(a) // expected-error {{global function 'elephant' requires that 'T' conform to 'Hashable'}}
11951195
}
11961196

11971197
// Another case of the above.

trunk/test/Constraints/generics.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ struct ProtosBound3<Foo: SubProto> where Foo: NSCopyish {} // expected-note {{'F
285285
struct AnyClassAndProtoBound<Foo> where Foo: AnyObject, Foo: SubProto {} // expected-note {{'Foo' declared as parameter to type 'AnyClassAndProtoBound'}}
286286
struct AnyClassAndProtoBound2<Foo> where Foo: SubProto, Foo: AnyObject {} // expected-note {{'Foo' declared as parameter to type 'AnyClassAndProtoBound2'}}
287287

288-
struct ClassAndProtoBound<Foo> where Foo: X, Foo: SubProto {}
288+
struct ClassAndProtoBound<Foo> where Foo: X, Foo: SubProto {} // expected-note {{where 'Foo' = 'X'}}
289289

290-
struct ClassAndProtosBound<Foo> where Foo: X, Foo: SubProto, Foo: NSCopyish {}
291-
struct ClassAndProtosBound2<Foo> where Foo: X, Foo: SubProto & NSCopyish {}
290+
struct ClassAndProtosBound<Foo> where Foo: X, Foo: SubProto, Foo: NSCopyish {} // expected-note 2 {{where 'Foo' = 'X'}}
291+
struct ClassAndProtosBound2<Foo> where Foo: X, Foo: SubProto & NSCopyish {} // expected-note 2 {{where 'Foo' = 'X'}}
292292

293293
extension Pair {
294294
init(first: T) {}
@@ -331,14 +331,14 @@ func testFixIts() {
331331
_ = AnyClassAndProtoBound() // expected-error {{generic parameter 'Foo' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{28-28=<<#Foo: SubProto & AnyObject#>>}}
332332
_ = AnyClassAndProtoBound2() // expected-error {{generic parameter 'Foo' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{29-29=<<#Foo: SubProto & AnyObject#>>}}
333333

334-
_ = ClassAndProtoBound() // expected-error {{'ClassAndProtoBound<X>' requires that 'X' conform to 'SubProto'}}
334+
_ = ClassAndProtoBound() // expected-error {{referencing initializer 'init()' on 'ClassAndProtoBound' requires that 'X' conform to 'SubProto'}}
335335

336336
_ = ClassAndProtosBound()
337-
// expected-error@-1 {{'ClassAndProtosBound<X>' requires that 'X' conform to 'SubProto'}}
338-
// expected-error@-2 {{'ClassAndProtosBound<X>' requires that 'X' conform to 'NSCopyish'}}
337+
// expected-error@-1 {{referencing initializer 'init()' on 'ClassAndProtosBound' requires that 'X' conform to 'NSCopyish'}}
338+
// expected-error@-2 {{referencing initializer 'init()' on 'ClassAndProtosBound' requires that 'X' conform to 'SubProto'}}
339339
_ = ClassAndProtosBound2()
340-
// expected-error@-1 {{'ClassAndProtosBound2<X>' requires that 'X' conform to 'SubProto'}}
341-
// expected-error@-2 {{'ClassAndProtosBound2<X>' requires that 'X' conform to 'NSCopyish'}}
340+
// expected-error@-1 {{referencing initializer 'init()' on 'ClassAndProtosBound2' requires that 'X' conform to 'NSCopyish'}}
341+
// expected-error@-2 {{referencing initializer 'init()' on 'ClassAndProtosBound2' requires that 'X' conform to 'SubProto'}}
342342

343343
_ = Pair() // expected-error {{generic parameter 'T' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{11-11=<Any, Any>}}
344344
_ = Pair(first: S()) // expected-error {{generic parameter 'U' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{11-11=<S, Any>}}
@@ -604,20 +604,20 @@ func rdar40537858() {
604604
var id: Id
605605
}
606606

607-
struct List<T: Collection, E: Hashable> {
607+
struct List<T: Collection, E: Hashable> { // expected-note {{where 'E' = 'S.Id'}}
608608
typealias Data = T.Element
609609
init(_: T, id: KeyPath<Data, E>) {}
610610
}
611611

612612
var arr: [S] = []
613-
_ = List(arr, id: \.id) // expected-error {{'List<[S], S.Id>' requires that 'S.Id' conform to 'Hashable'}}
613+
_ = List(arr, id: \.id) // expected-error {{referencing initializer 'init(_:id:)' on 'List' requires that 'S.Id' conform to 'Hashable'}}
614614

615-
enum E<T: P> {
615+
enum E<T: P> { // expected-note 2 {{where 'T' = 'S'}}
616616
case foo(T)
617617
case bar([T])
618618
}
619619

620620
var s = S(id: S.Id())
621-
let _: E = .foo(s) // expected-error {{'E<S>' requires that 'S' conform to 'P'}}
622-
let _: E = .bar([s]) // expected-error {{'E<S>' requires that 'S' conform to 'P'}}
621+
let _: E = .foo(s) // expected-error {{generic enum 'E' requires that 'S' conform to 'P'}}
622+
let _: E = .bar([s]) // expected-error {{generic enum 'E' requires that 'S' conform to 'P'}}
623623
}

trunk/test/Constraints/rdar39931339.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ struct S<T> {}
77
class C : P {}
88

99
extension S where T : P {
10+
// expected-note@-1 {{where 'T' = 'T'}}
11+
// expected-note@-2 {{where 'T' = 'Int'}}
1012
typealias A = Int
1113
typealias B<U> = S<U>
1214
}
@@ -17,7 +19,7 @@ extension S where T == Float {
1719

1820
class A<T, U> {}
1921

20-
extension A where T == [U], U: P {
22+
extension A where T == [U], U: P { // expected-note {{where 'U' = 'Float'}}
2123
typealias S1 = Int
2224
}
2325

@@ -29,16 +31,16 @@ class B<U> : A<[U], U> {}
2931

3032
_ = B<C>.S1() // Ok
3133
_ = B<Int>.S2() // Ok
32-
_ = B<Float>.S1() // expected-error {{'B<Float>.S1' (aka 'Int') requires that 'Float' conform to 'P'}}
34+
_ = B<Float>.S1() // expected-error {{referencing type alias 'S1' on 'A' requires that 'Float' conform to 'P'}}
3335
_ = B<String>.S2() // expected-error {{'B<String>.S2.Type' (aka 'Int.Type') requires the types '[String]' and '[Int]' be equivalent}}
3436

3537
_ = S<C>.A() // Ok
36-
_ = S<Int>.A() // expected-error {{'S<Int>.A' (aka 'Int') requires that 'Int' conform to 'P'}}
38+
_ = S<Int>.A() // expected-error {{referencing type alias 'A' on 'S' requires that 'Int' conform to 'P'}}
3739
_ = S<String>.B<Int>() // expected-error {{type 'String' does not conform to protocol 'P'}}
3840
_ = S<Int>.C() // expected-error {{'S<Int>.C.Type' (aka 'Int.Type') requires the types 'Int' and 'Float' be equivalent}}
3941

4042
func foo<T>(_ s: S<T>.Type) {
41-
_ = s.A() // expected-error {{'S<T>.A' (aka 'Int') requires that 'T' conform to 'P'}}
43+
_ = s.A() // expected-error {{referencing type alias 'A' on 'S' requires that 'T' conform to 'P'}}
4244
}
4345

4446
func bar<T: P>(_ s: S<T>.Type) {

trunk/test/Generics/deduction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ func callMin(_ x: Int, y: Int, a: Float, b: Float) {
210210
min2(a, b) // expected-error{{argument type 'Float' does not conform to expected type 'IsBefore'}}
211211
}
212212

213-
func rangeOfIsBefore<R : IteratorProtocol>(_ range: R) where R.Element : IsBefore {}
213+
func rangeOfIsBefore<R : IteratorProtocol>(_ range: R) where R.Element : IsBefore {} // expected-note {{'R.Element' = 'Double'}}
214214

215215
func callRangeOfIsBefore(_ ia: [Int], da: [Double]) {
216216
rangeOfIsBefore(ia.makeIterator())
217-
rangeOfIsBefore(da.makeIterator()) // expected-error{{'(IndexingIterator<[Double]>) -> ()' requires that 'Double' conform to 'IsBefore'}}
217+
rangeOfIsBefore(da.makeIterator()) // expected-error{{global function 'rangeOfIsBefore' requires that 'Double' conform to 'IsBefore'}}
218218
}
219219

220220
func testEqualIterElementTypes<A: IteratorProtocol, B: IteratorProtocol>(_ a: A, _ b: B) where A.Element == B.Element {}

trunk/test/Serialization/builtin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ var a : TheBuiltinInt64
1111

1212
// Check that it really is Builtin.Int64.
1313
var wrapped = Int64(a) // okay
14-
var badWrapped = Int32(a) // expected-error{{'Int32' requires that 'TheBuiltinInt64' conform to 'BinaryInteger'}}
14+
var badWrapped = Int32(a) // expected-error{{initializer 'init' requires that 'TheBuiltinInt64' conform to 'BinaryInteger'}}

trunk/test/decl/ext/protocol.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ extension S1 {
180180
// Protocol extensions with additional requirements
181181
// ----------------------------------------------------------------------------
182182
extension P4 where Self.AssocP4 : P1 {
183+
// expected-note@-1 {{where 'Self.AssocP4' = 'S4aHelper'}}
184+
// expected-note@-2 {{'Self.AssocP4' = 'Int'}}
183185
func extP4a() {
184186
acceptsP1(reqP4a())
185187
}
@@ -215,9 +217,9 @@ extension P4 where Self.AssocP4 == Bool {
215217
}
216218

217219
func testP4(_ s4a: S4a, s4b: S4b, s4c: S4c, s4d: S4d) {
218-
s4a.extP4a() // expected-error{{'() -> ()' requires that 'S4aHelper' conform to 'P1'}}
220+
s4a.extP4a() // expected-error{{referencing instance method 'extP4a()' on 'P4' requires that 'S4aHelper' conform to 'P1'}}
219221
s4b.extP4a() // ok
220-
s4c.extP4a() // expected-error{{'() -> ()' requires that 'Int' conform to 'P1'}}
222+
s4c.extP4a() // expected-error{{referencing instance method 'extP4a()' on 'P4' requires that 'Int' conform to 'P1'}}
221223
s4c.extP4Int() // okay
222224
var b1 = s4d.extP4a() // okay, "Bool" version
223225
b1 = true // checks type above

0 commit comments

Comments
 (0)