Skip to content

Commit 63b802c

Browse files
committed
[AST/Printing] Don't omit empty labels in special names
This makes diagnostics more verbose and accurate, because it's possible to distinguish how many parameters there are based on the message itself. Also there are multiple diagnostic messages in a format of `<descriptive-kind> <decl-name> ...` that get printed as e.g. `subscript 'subscript'` if empty labels are omitted.
1 parent 18e6ea7 commit 63b802c

40 files changed

+122
-122
lines changed

lib/AST/Identifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ llvm::raw_ostream &DeclName::print(llvm::raw_ostream &os,
184184
}
185185

186186
llvm::raw_ostream &DeclName::printPretty(llvm::raw_ostream &os) const {
187-
return print(os, /*skipEmptyArgumentNames=*/true);
187+
return print(os, /*skipEmptyArgumentNames=*/!isSpecial());
188188
}
189189

190190
ObjCSelector::ObjCSelector(ASTContext &ctx, unsigned numArgs,

test/ClangImporter/availability.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ func test_unavailable_accessors(_ obj: UnavailableAccessors,
5454
UnavailableAccessors.setterUnavailableClass = 0 // expected-error {{setter for 'setterUnavailableClass' is unavailable}}
5555
UnavailableAccessors.setterUnavailableClass += 1 // expected-error {{setter for 'setterUnavailableClass' is unavailable}}
5656

57-
_ = sub[0] // expected-error {{getter for 'subscript' is unavailable: bad subscript getter}}
58-
sub[0] = "" // expected-error {{setter for 'subscript' is unavailable: bad subscript setter}}
59-
sub[0] += "" // expected-error {{getter for 'subscript' is unavailable: bad subscript getter}} expected-error {{setter for 'subscript' is unavailable: bad subscript setter}}
57+
_ = sub[0] // expected-error {{getter for 'subscript(_:)' is unavailable: bad subscript getter}}
58+
sub[0] = "" // expected-error {{setter for 'subscript(_:)' is unavailable: bad subscript setter}}
59+
sub[0] += "" // expected-error {{getter for 'subscript(_:)' is unavailable: bad subscript getter}} expected-error {{setter for 'subscript(_:)' is unavailable: bad subscript setter}}
6060

61-
_ = subGetter[0] // expected-error {{getter for 'subscript' is unavailable: bad subscript getter}}
61+
_ = subGetter[0] // expected-error {{getter for 'subscript(_:)' is unavailable: bad subscript getter}}
6262
subGetter[0] = ""
63-
subGetter[0] += "" // expected-error {{getter for 'subscript' is unavailable: bad subscript getter}}
63+
subGetter[0] += "" // expected-error {{getter for 'subscript(_:)' is unavailable: bad subscript getter}}
6464

6565
_ = subSetter[0]
66-
subSetter[0] = "" // expected-error {{setter for 'subscript' is unavailable: bad subscript setter}}
67-
subSetter[0] += "" // expected-error {{setter for 'subscript' is unavailable: bad subscript setter}}
66+
subSetter[0] = "" // expected-error {{setter for 'subscript(_:)' is unavailable: bad subscript setter}}
67+
subSetter[0] += "" // expected-error {{setter for 'subscript(_:)' is unavailable: bad subscript setter}}
6868

69-
_ = subReadOnly[0] // expected-error {{getter for 'subscript' is unavailable}}
69+
_ = subReadOnly[0] // expected-error {{getter for 'subscript(_:)' is unavailable}}
7070
}
7171

7272
func test_deprecated(_ s:UnsafeMutablePointer<CChar>, _ obj: AccessorDeprecations,
@@ -100,19 +100,19 @@ func test_deprecated(_ s:UnsafeMutablePointer<CChar>, _ obj: AccessorDeprecation
100100
AccessorDeprecations.setterDeprecatedClass = 0 // expected-warning {{setter for 'setterDeprecatedClass' is deprecated}}
101101
AccessorDeprecations.setterDeprecatedClass += 1 // expected-warning {{setter for 'setterDeprecatedClass' is deprecated}}
102102

103-
_ = sub[0] // expected-warning {{getter for 'subscript' is deprecated: bad subscript getter}}
104-
sub[0] = "" // expected-warning {{setter for 'subscript' is deprecated: bad subscript setter}}
105-
sub[0] += "" // expected-warning {{getter for 'subscript' is deprecated: bad subscript getter}} expected-warning {{setter for 'subscript' is deprecated: bad subscript setter}}
103+
_ = sub[0] // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter}}
104+
sub[0] = "" // expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter}}
105+
sub[0] += "" // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter}} expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter}}
106106

107-
_ = subGetter[0] // expected-warning {{getter for 'subscript' is deprecated: bad subscript getter}}
107+
_ = subGetter[0] // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter}}
108108
subGetter[0] = ""
109-
subGetter[0] += "" // expected-warning {{getter for 'subscript' is deprecated: bad subscript getter}}
109+
subGetter[0] += "" // expected-warning {{getter for 'subscript(_:)' is deprecated: bad subscript getter}}
110110

111111
_ = subSetter[0]
112-
subSetter[0] = "" // expected-warning {{setter for 'subscript' is deprecated: bad subscript setter}}
113-
subSetter[0] += "" // expected-warning {{setter for 'subscript' is deprecated: bad subscript setter}}
112+
subSetter[0] = "" // expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter}}
113+
subSetter[0] += "" // expected-warning {{setter for 'subscript(_:)' is deprecated: bad subscript setter}}
114114

115-
_ = subReadOnly[0] // expected-warning {{getter for 'subscript' is deprecated}}
115+
_ = subReadOnly[0] // expected-warning {{getter for 'subscript(_:)' is deprecated}}
116116
}
117117

118118
func test_NSInvocation(_ x: NSInvocation, // expected-error {{'NSInvocation' is unavailable}}

test/Compatibility/attr_override.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class A {
4040
var v9: Int { return 5 } // expected-note{{attempt to override property here}}
4141
var v10: Int { return 5 } // expected-note{{attempt to override property here}}
4242

43-
subscript (i: Int) -> String { // expected-note{{potential overridden subscript 'subscript' here}}
43+
subscript (i: Int) -> String { // expected-note{{potential overridden subscript 'subscript(_:)' here}}
4444
get {
4545
return "hello"
4646
}
@@ -49,7 +49,7 @@ class A {
4949
}
5050
}
5151

52-
subscript (d: Double) -> String { // expected-note{{overridden declaration is here}} expected-note{{potential overridden subscript 'subscript' here}}
52+
subscript (d: Double) -> String { // expected-note{{overridden declaration is here}} expected-note{{potential overridden subscript 'subscript(_:)' here}}
5353
get {
5454
return "hello"
5555
}
@@ -58,11 +58,11 @@ class A {
5858
}
5959
}
6060

61-
subscript (i: Int8) -> A { // expected-note{{potential overridden subscript 'subscript' here}}
61+
subscript (i: Int8) -> A { // expected-note{{potential overridden subscript 'subscript(_:)' here}}
6262
get { return self }
6363
}
6464

65-
subscript (i: Int16) -> A { // expected-note{{attempt to override subscript here}} expected-note{{potential overridden subscript 'subscript' here}}
65+
subscript (i: Int16) -> A { // expected-note{{attempt to override subscript here}} expected-note{{potential overridden subscript 'subscript(_:)' here}}
6666
get { return self }
6767
set { }
6868
}

test/Compatibility/special_func_name.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct S12 : P1 { // expected-error {{type 'S12' does not conform to protocol 'P
1414
}
1515

1616
protocol P2 {
17-
init(_: Int) // expected-note {{protocol requires initializer 'init' with type 'Int'; do you want to add a stub?}}
17+
init(_: Int) // expected-note {{protocol requires initializer 'init(_:)' with type 'Int'; do you want to add a stub?}}
1818
}
1919

2020
struct S21 : P2 { // expected-error {{type 'S21' does not conform to protocol 'P2'}}

test/Compatibility/tuple_arguments_4.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ do {
513513
}
514514

515515
struct InitTwo {
516-
init(_ x: Int, _ y: Int) {} // expected-note 5 {{'init' declared here}}
516+
init(_ x: Int, _ y: Int) {} // expected-note 5 {{'init(_:_:)' declared here}}
517517
}
518518

519519
struct InitTuple {
@@ -564,7 +564,7 @@ do {
564564
}
565565

566566
struct SubscriptTwo {
567-
subscript(_ x: Int, _ y: Int) -> Int { get { return 0 } set { } } // expected-note 5 {{'subscript' declared here}}
567+
subscript(_ x: Int, _ y: Int) -> Int { get { return 0 } set { } } // expected-note 5 {{'subscript(_:_:)' declared here}}
568568
}
569569

570570
struct SubscriptTuple {
@@ -915,7 +915,7 @@ struct GenericInitLabeled<T> {
915915
}
916916

917917
struct GenericInitTwo<T> {
918-
init(_ x: T, _ y: T) {} // expected-note 10 {{'init' declared here}}
918+
init(_ x: T, _ y: T) {} // expected-note 10 {{'init(_:_:)' declared here}}
919919
}
920920

921921
struct GenericInitTuple<T> {
@@ -1041,7 +1041,7 @@ struct GenericSubscriptLabeled<T> {
10411041
}
10421042

10431043
struct GenericSubscriptTwo<T> {
1044-
subscript(_ x: T, _ y: T) -> Int { get { return 0 } set { } } // expected-note 5 {{'subscript' declared here}}
1044+
subscript(_ x: T, _ y: T) -> Int { get { return 0 } set { } } // expected-note 5 {{'subscript(_:_:)' declared here}}
10451045
}
10461046

10471047
struct GenericSubscriptLabeledTuple<T> {

test/Constraints/diag_ambiguities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func g(_ x: Int, _ y: Int) -> () {} // expected-note{{found this candidate}}
2727
C(g) // expected-error{{ambiguous use of 'g'}}
2828

2929
func h<T>(_ x: T) -> () {}
30-
C(h) // expected-error{{ambiguous use of 'init'}}
30+
C(h) // expected-error{{ambiguous use of 'init(_:)'}}
3131

3232
func rdar29691909_callee(_ o: AnyObject?) -> Any? { return o } // expected-note {{found this candidate}}
3333
func rdar29691909_callee(_ o: AnyObject) -> Any { return o } // expected-note {{found this candidate}}

test/Constraints/diagnostics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ func r23641896() {
681681
var g = "Hello World"
682682
g.replaceSubrange(0...2, with: "ce") // expected-error {{cannot convert value of type 'ClosedRange<Int>' to expected argument type 'Range<String.Index>'}}
683683

684-
_ = g[12] // expected-error {{'subscript' is unavailable: cannot subscript String with an Int, see the documentation comment for discussion}}
684+
_ = g[12] // expected-error {{'subscript(_:)' is unavailable: cannot subscript String with an Int, see the documentation comment for discussion}}
685685

686686
}
687687

@@ -1199,7 +1199,7 @@ func platypus<T>(a: [T]) {
11991199
func badTypes() {
12001200
let sequence:AnySequence<[Int]> = AnySequence() { AnyIterator() { [3] }}
12011201
let array = [Int](sequence)
1202-
// expected-error@-1 {{initializer 'init' requires the types 'Int' and '[Int]' be equivalent}}
1202+
// expected-error@-1 {{initializer 'init(_:)' requires the types 'Int' and '[Int]' be equivalent}}
12031203
}
12041204

12051205
// rdar://34357545

test/Constraints/generics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ struct V27515965 {
253253

254254
func test(x: S27515965) -> V27515965 {
255255
return V27515965(x)
256-
// expected-error@-1 {{initializer 'init' requires the types 'Any' and 'Float' be equivalent}}
256+
// expected-error@-1 {{initializer 'init(_:)' requires the types 'Any' and 'Float' be equivalent}}
257257
}
258258

259259
protocol BaseProto {}

test/Constraints/lvalues.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ r23331567 { $0 += 1 }
233233
// <rdar://problem/30685195> Compiler crash with invalid assignment
234234
struct G<T> {
235235
subscript(x: Int) -> T { get { } nonmutating set { } }
236-
// expected-note@-1 {{'subscript' declared here}}
236+
// expected-note@-1 {{'subscript(_:)' declared here}}
237237
}
238238

239239
func wump<T>(to: T, _ body: (G<T>) -> ()) {}

test/Constraints/rdar44569159.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ struct A {
1313

1414
func foo(_ v: Double) {
1515
_ = A()[S(value: v)]
16-
// expected-error@-1 {{subscript 'subscript' requires that 'Double' conform to 'P'}}
16+
// expected-error@-1 {{subscript 'subscript(_:)' requires that 'Double' conform to 'P'}}
1717
// expected-error@-2 {{referencing initializer 'init(value:)' on 'S' requires that 'Double' conform to 'P'}}
1818
}

test/Constraints/subscript.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extension Int {
6868
subscript(key: String) -> Double { get {} } // expected-note {{found this candidate}}
6969
}
7070

71-
let _ = 1["1"] // expected-error {{ambiguous use of 'subscript'}}
71+
let _ = 1["1"] // expected-error {{ambiguous use of 'subscript(_:)'}}
7272

7373
let squares = [ 1, 2, 3 ].reduce([:]) { (dict, n) in
7474
var dict = dict

test/Constraints/tuple.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ struct MagicKingdom<K> : Kingdom {
169169
}
170170
func magify<T>(_ t: T) -> MagicKingdom<T> { return MagicKingdom() }
171171
func foo(_ pair: (Int, Int)) -> Victory<(x: Int, y: Int)> {
172-
return Victory(magify(pair)) // expected-error {{initializer 'init' requires the types '(x: Int, y: Int)' and '(Int, Int)' be equivalent}}
172+
return Victory(magify(pair)) // expected-error {{initializer 'init(_:)' requires the types '(x: Int, y: Int)' and '(Int, Int)' be equivalent}}
173173
}
174174

175175

test/Constraints/tuple_arguments.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ do {
514514
}
515515

516516
struct InitTwo {
517-
init(_ x: Int, _ y: Int) {} // expected-note 5 {{'init' declared here}}
517+
init(_ x: Int, _ y: Int) {} // expected-note 5 {{'init(_:_:)' declared here}}
518518
}
519519

520520
struct InitTuple {
@@ -565,7 +565,7 @@ do {
565565
}
566566

567567
struct SubscriptTwo {
568-
subscript(_ x: Int, _ y: Int) -> Int { get { return 0 } set { } } // expected-note 5 {{'subscript' declared here}}
568+
subscript(_ x: Int, _ y: Int) -> Int { get { return 0 } set { } } // expected-note 5 {{'subscript(_:_:)' declared here}}
569569
}
570570

571571
struct SubscriptTuple {
@@ -916,7 +916,7 @@ struct GenericInitLabeled<T> {
916916
}
917917

918918
struct GenericInitTwo<T> {
919-
init(_ x: T, _ y: T) {} // expected-note 10 {{'init' declared here}}
919+
init(_ x: T, _ y: T) {} // expected-note 10 {{'init(_:_:)' declared here}}
920920
}
921921

922922
struct GenericInitTuple<T> {
@@ -1042,7 +1042,7 @@ struct GenericSubscriptLabeled<T> {
10421042
}
10431043

10441044
struct GenericSubscriptTwo<T> {
1045-
subscript(_ x: T, _ y: T) -> Int { get { return 0 } set { } } // expected-note 5 {{'subscript' declared here}}
1045+
subscript(_ x: T, _ y: T) -> Int { get { return 0 } set { } } // expected-note 5 {{'subscript(_:_:)' declared here}}
10461046
}
10471047

10481048
struct GenericSubscriptLabeledTuple<T> {

test/IDE/reconstruct_type_from_mangled_name.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func hasLocalDecls() {
262262
// CHECK: FAILURE for 'localMethod'
263263
func localMethod() {}
264264

265-
// CHECK: FAILURE for 'subscript'
265+
// CHECK: FAILURE for 'subscript(_:)'
266266
subscript(x: Int) { get {} set {} }
267267

268268
// CHECK: decl: FAILURE for ''
@@ -304,7 +304,7 @@ struct HasSubscript {
304304
// FIXME
305305
// CHECK: decl: FAILURE for 'T' usr=s:14swift_ide_test19HasGenericSubscriptV1Txmfp
306306
struct HasGenericSubscript<T> {
307-
// CHECK: subscript<U>(t: T) -> U { get set } for 'subscript' usr=s:14swift_ide_test19HasGenericSubscriptVyqd__xclui
307+
// CHECK: subscript<U>(t: T) -> U { get set } for 'subscript(_:)' usr=s:14swift_ide_test19HasGenericSubscriptVyqd__xclui
308308
// FIXME
309309
// CHECK: decl: FAILURE for 'U'
310310
// FIXME

test/NameBinding/accessibility.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ _ = Foo() // expected-error {{'Foo' initializer is inaccessible due to 'internal
5454
// <rdar://problem/27982012> QoI: Poor diagnostic for inaccessible initializer
5555
struct rdar27982012 {
5656
var x: Int
57-
private init(_ x: Int) { self.x = x } // expected-note {{'init' declared here}}
57+
private init(_ x: Int) { self.x = x } // expected-note {{'init(_:)' declared here}}
5858
}
5959

6060
_ = { rdar27982012($0.0) }((1, 2)) // expected-error {{initializer is inaccessible due to 'private' protection level}}

test/NameBinding/scope_map.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class LazyProperties {
325325

326326
// CHECK-EXPANDED: TypeDecl {{.*}} StructContainsAbstractStorageDecls [114:1 - 130:1] expanded
327327
// CHECK-EXPANDED-NEXT: `-TypeOrExtensionBody {{.*}} 'StructContainsAbstractStorageDecls' [114:43 - 130:1] expanded
328-
// CHECK-EXPANDED-NEXT: {{^}} |-Accessors {{.*}} scope_map.(file).StructContainsAbstractStorageDecls.subscript@{{.*}}scope_map.swift:115:3 [115:37 - 121:3] expanded
328+
// CHECK-EXPANDED-NEXT: {{^}} |-Accessors {{.*}} scope_map.(file).StructContainsAbstractStorageDecls.subscript(_:_:)@{{.*}}scope_map.swift:115:3 [115:37 - 121:3] expanded
329329
// CHECK-EXPANDED-NEXT: {{^}} |-AbstractFunctionDecl {{.*}} _ [116:5 - 117:5] expanded
330330
// CHECK-EXPANDED-NEXT: {{^}} `-AbstractFunctionParams {{.*}} _ param 0:0 [116:5 - 117:5] expanded
331331
// CHECK-EXPANDED-NEXT: {{^}} `-AbstractFunctionParams {{.*}} _ param 1:0 [116:5 - 117:5] expanded
@@ -404,7 +404,7 @@ class LazyProperties {
404404
// CHECK-EXPANDED-NEXT: {{^}} `-BraceStmt {{.*}} [167:32 - 167:42] expanded
405405
// CHECK-EXPANDED-NEXT: {{^}} `-AbstractFunctionParams {{.*}} defaultArguments(i:j:) param 0:1 [167:48 - 175:1] expanded
406406

407-
// CHECK-EXPANDED: -Accessors {{.*}} scope_map.(file).ProtoWithSubscript.subscript@{{.*}}scope_map.swift:183:3 [183:33 - 183:43] expanded
407+
// CHECK-EXPANDED: -Accessors {{.*}} scope_map.(file).ProtoWithSubscript.subscript(_:)@{{.*}}scope_map.swift:183:3 [183:33 - 183:43] expanded
408408
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDecl {{.*}} _ [183:35 - 183:35] expanded
409409
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParams {{.*}} _ param 0:0 [183:35 - 183:35] expanded
410410
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParams {{.*}} _ param 1:0 [183:35 - 183:35] expanded

test/Parse/pointer_conversion.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func takesRawBuffer(_ b: UnsafeRawBufferPointer) {}
348348

349349
// <rdar://problem/29586888> UnsafeRawBufferPointer range subscript is inconsistent with Collection.
350350
func f29586888(b: UnsafeRawBufferPointer) {
351-
takesRawBuffer(b[1..<2]) // expected-error {{'subscript' is unavailable: use 'UnsafeRawBufferPointer(rebasing:)' to convert a slice into a zero-based raw buffer.}}
351+
takesRawBuffer(b[1..<2]) // expected-error {{'subscript(_:)' is unavailable: use 'UnsafeRawBufferPointer(rebasing:)' to convert a slice into a zero-based raw buffer.}}
352352
let slice = b[1..<2]
353353
takesRawBuffer(slice) // expected-error {{cannot convert value of type 'UnsafeRawBufferPointer.SubSequence' (aka 'Slice<UnsafeRawBufferPointer>') to expected argument type 'UnsafeRawBufferPointer'}}
354354
}

test/Sema/availability.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ClassWithUnavailable {
4141
}
4242

4343
@available(*, unavailable)
44-
subscript (i: Int) -> Int { // expected-note{{'subscript' has been explicitly marked unavailable here}}
44+
subscript (i: Int) -> Int { // expected-note{{'subscript(_:)' has been explicitly marked unavailable here}}
4545
return i
4646
}
4747
}
@@ -55,7 +55,7 @@ func testInit() {
5555
}
5656

5757
func testSubscript(cwu: ClassWithUnavailable) {
58-
_ = cwu[5] // expected-error{{'subscript' is unavailable}}
58+
_ = cwu[5] // expected-error{{'subscript(_:)' is unavailable}}
5959
}
6060

6161
/* FIXME 'nil == a' fails to type-check with a bogus error message

test/Sema/availability_versions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ class ClassWithUnavailableInitializer {
253253
convenience init(s: String) {
254254
// expected-note@-1 {{add @available attribute to enclosing initializer}}
255255

256-
self.init(5) // expected-error {{'init' is only available on OS X 10.51 or newer}}
256+
self.init(5) // expected-error {{'init(_:)' is only available on OS X 10.51 or newer}}
257257
// expected-note@-1 {{add 'if #available' version check}}
258258
}
259259

@@ -267,12 +267,12 @@ func callUnavailableInitializer() {
267267
// expected-note@-1 2{{add @available attribute to enclosing global function}}
268268

269269
_ = ClassWithUnavailableInitializer()
270-
_ = ClassWithUnavailableInitializer(5) // expected-error {{'init' is only available on OS X 10.51 or newer}}
270+
_ = ClassWithUnavailableInitializer(5) // expected-error {{'init(_:)' is only available on OS X 10.51 or newer}}
271271
// expected-note@-1 {{add 'if #available' version check}}
272272

273273
let i = ClassWithUnavailableInitializer.self
274274
_ = i.init()
275-
_ = i.init(5) // expected-error {{'init' is only available on OS X 10.51 or newer}}
275+
_ = i.init(5) // expected-error {{'init(_:)' is only available on OS X 10.51 or newer}}
276276
// expected-note@-1 {{add 'if #available' version check}}
277277
}
278278

@@ -290,7 +290,7 @@ class SubOfClassWithUnavailableInitializer : SuperWithWithUnavailableInitializer
290290
override init(_ val: Int) {
291291
// expected-note@-1 {{add @available attribute to enclosing initializer}}
292292

293-
super.init(5) // expected-error {{'init' is only available on OS X 10.51 or newer}}
293+
super.init(5) // expected-error {{'init(_:)' is only available on OS X 10.51 or newer}}
294294
// expected-note@-1 {{add 'if #available' version check}}
295295
}
296296

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{{initializer 'init' requires that 'TheBuiltinInt64' conform to 'BinaryInteger'}}
14+
var badWrapped = Int32(a) // expected-error{{initializer 'init(_:)' requires that 'TheBuiltinInt64' conform to 'BinaryInteger'}}

0 commit comments

Comments
 (0)