Skip to content

Commit 4672c11

Browse files
committed
Fix up some test cases whose diagnostics changed for the better.
1 parent ee99c8a commit 4672c11

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/Constraints/diagnostics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ String().asdf // expected-error {{value of type 'String' has no member 'asdf'}}
234234

235235
// <rdar://problem/21553065> Spurious diagnostic: '_' can only appear in a pattern or on the left side of an assignment
236236
protocol r21553065Protocol {}
237-
class r21553065Class<T : AnyObject> {}
238-
_ = r21553065Class<r21553065Protocol>() // expected-error {{'r21553065Protocol' is not convertible to 'AnyObject'}}
237+
class r21553065Class<T : AnyObject> {} // expected-note{{requirement specified as 'T' : 'AnyObject'}}
238+
_ = r21553065Class<r21553065Protocol>() // expected-error {{'r21553065Class' requires that 'r21553065Protocol' be a class type}}
239239

240240
// Type variables not getting erased with nested closures
241241
struct Toe {

test/Constraints/generics.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ protocol SubProto: BaseProto {}
265265
struct FullyGeneric<Foo> {} // expected-note 11 {{'Foo' declared as parameter to type 'FullyGeneric'}} expected-note 1 {{generic type 'FullyGeneric' declared here}}
266266

267267
struct AnyClassBound<Foo: AnyObject> {} // expected-note {{'Foo' declared as parameter to type 'AnyClassBound'}} expected-note {{generic type 'AnyClassBound' declared here}}
268+
// expected-note@-1{{requirement specified as 'Foo' : 'AnyObject'}}
268269
struct AnyClassBound2<Foo> where Foo: AnyObject {} // expected-note {{'Foo' declared as parameter to type 'AnyClassBound2'}}
270+
// expected-note@-1{{requirement specified as 'Foo' : 'AnyObject' [with Foo = Any]}}
269271

270272
struct ProtoBound<Foo: SubProto> {} // expected-note {{'Foo' declared as parameter to type 'ProtoBound'}} expected-note {{generic type 'ProtoBound' declared here}}
271273
struct ProtoBound2<Foo> where Foo: SubProto {} // expected-note {{'Foo' declared as parameter to type 'ProtoBound2'}}
@@ -301,11 +303,11 @@ func testFixIts() {
301303
_ = FullyGeneric<Any>()
302304

303305
_ = AnyClassBound() // expected-error {{generic parameter 'Foo' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{20-20=<AnyObject>}}
304-
_ = AnyClassBound<Any>() // expected-error {{'Any' is not convertible to 'AnyObject'}}
306+
_ = AnyClassBound<Any>() // expected-error {{'AnyClassBound' requires that 'Any' be a class type}}
305307
_ = AnyClassBound<AnyObject>()
306308

307309
_ = AnyClassBound2() // expected-error {{generic parameter 'Foo' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{21-21=<AnyObject>}}
308-
_ = AnyClassBound2<Any>() // expected-error {{'Any' is not convertible to 'AnyObject'}}
310+
_ = AnyClassBound2<Any>() // expected-error {{'AnyClassBound2' requires that 'Any' be a class type}}
309311
_ = AnyClassBound2<AnyObject>()
310312

311313
_ = ProtoBound() // expected-error {{generic parameter 'Foo' could not be inferred}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{17-17=<<#Foo: SubProto#>>}}

0 commit comments

Comments
 (0)