From 4dda7efc0fe8b0f67ad4f90249c368fe914c7b2c Mon Sep 17 00:00:00 2001 From: fummicc1 Date: Wed, 27 Mar 2024 12:32:25 +0900 Subject: [PATCH] [AST] Improve diagnostics message for swift users. Use `initializer` instead of `constructor` because it is more official word to express its meaning. --- include/swift/AST/DiagnosticsSema.def | 6 +- test/Constraints/dynamic_lookup.swift | 4 +- test/Constraints/dynamic_lookup_swift6.swift | 4 +- test/Constraints/members.swift | 2 +- test/Constraints/metatypes.swift | 4 +- test/Constraints/result_builder_diags.swift | 4 +- test/Constraints/subscript.swift | 4 +- test/Constraints/subscript_swift6.swift | 4 +- test/Parse/type_expr.swift | 66 +++++++++---------- test/SourceKit/Sema/sema_module.swift | 2 +- test/attr/dynamicReplacement.swift | 4 +- test/type/explicit_existential.swift | 4 +- test/type/explicit_existential_swift6.swift | 2 +- .../implicit_some/explicit_existential.swift | 2 +- test/type/nested_types.swift | 10 +-- 15 files changed, 61 insertions(+), 61 deletions(-) diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 86c66f6c5df..ec9633e4e9e 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -4663,7 +4663,7 @@ ERROR(value_of_module_type,none, "expected module member name after module name", ()) ERROR(value_of_metatype_type,none, - "expected member name or constructor call after type name%select{|; this " + "expected member name or initializer call after type name%select{|; this " "will be an error in Swift 6}0", (bool)) NOTE(add_parens_to_type,none, @@ -6510,9 +6510,9 @@ ERROR(dynamic_replacement_replaced_not_objc_dynamic, none, ERROR(dynamic_replacement_replacement_not_objc_dynamic, none, "%0 is marked @objc dynamic", (DeclName)) ERROR(dynamic_replacement_replaced_constructor_is_convenience, none, - "replaced constructor %0 is marked as convenience", (DeclNameRef)) + "replaced initializer %0 is marked as convenience", (DeclNameRef)) ERROR(dynamic_replacement_replaced_constructor_is_not_convenience, none, - "replaced constructor %0 is not marked as convenience", (DeclNameRef)) + "replaced initializer %0 is not marked as convenience", (DeclNameRef)) //------------------------------------------------------------------------------ // MARK: @_typeEraser() diff --git a/test/Constraints/dynamic_lookup.swift b/test/Constraints/dynamic_lookup.swift index 4eb3a5cac85..b221248786b 100644 --- a/test/Constraints/dynamic_lookup.swift +++ b/test/Constraints/dynamic_lookup.swift @@ -454,11 +454,11 @@ func test_dynamic_subscript_accepts_type_name_argument() { } func test(a: AnyObject, optA: AnyObject?) { - let _ = a[A] // expected-warning {{expected member name or constructor call after type name; this will be an error in Swift 6}} + let _ = a[A] // expected-warning {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} {{16-16=()}} // expected-note@-2 {{use '.self' to reference the type object}} {{16-16=.self}} - let _ = optA?[A] // expected-warning {{expected member name or constructor call after type name; this will be an error in Swift 6}} + let _ = optA?[A] // expected-warning {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} {{20-20=()}} // expected-note@-2 {{use '.self' to reference the type object}} {{20-20=.self}} } diff --git a/test/Constraints/dynamic_lookup_swift6.swift b/test/Constraints/dynamic_lookup_swift6.swift index 230c55d45de..6c54f2d7c2f 100644 --- a/test/Constraints/dynamic_lookup_swift6.swift +++ b/test/Constraints/dynamic_lookup_swift6.swift @@ -13,11 +13,11 @@ func test_dynamic_subscript_accepts_type_name_argument() { } func test(a: AnyObject, optA: AnyObject?) { - let _ = a[A] // expected-error {{expected member name or constructor call after type name}} + let _ = a[A] // expected-error {{expected member name or initializer call after type name}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} {{16-16=()}} // expected-note@-2 {{use '.self' to reference the type object}} {{16-16=.self}} - let _ = optA?[A] // expected-error {{expected member name or constructor call after type name}} + let _ = optA?[A] // expected-error {{expected member name or initializer call after type name}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} {{20-20=()}} // expected-note@-2 {{use '.self' to reference the type object}} {{20-20=.self}} } diff --git a/test/Constraints/members.swift b/test/Constraints/members.swift index 68440349c50..91bdba57027 100644 --- a/test/Constraints/members.swift +++ b/test/Constraints/members.swift @@ -617,7 +617,7 @@ func rdar50679161() { _ = { () -> Void in var foo = S - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{add arguments after the type to construct a value of the type}} // expected-note@-3 {{use '.self' to reference the type object}} print(foo) diff --git a/test/Constraints/metatypes.swift b/test/Constraints/metatypes.swift index cc0df3f3019..c36d286d1dd 100644 --- a/test/Constraints/metatypes.swift +++ b/test/Constraints/metatypes.swift @@ -15,11 +15,11 @@ let test5 : S.Type = S.self let test6 : AnyClass = S.self // expected-error {{cannot convert value of type 'S.Type' to specified type 'AnyClass' (aka 'any AnyObject.Type')}} func acceptMeta(_ meta: T.Type) { } -acceptMeta(A) // expected-error {{expected member name or constructor call after type name}} +acceptMeta(A) // expected-error {{expected member name or initializer call after type name}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} // expected-note@-2 {{use '.self' to reference the type object}} -acceptMeta((A) -> Void) // expected-error {{expected member name or constructor call after type name}} +acceptMeta((A) -> Void) // expected-error {{expected member name or initializer call after type name}} // expected-note@-1 {{use '.self' to reference the type object}} func id(_ x: T.Type) -> T.Type { x } diff --git a/test/Constraints/result_builder_diags.swift b/test/Constraints/result_builder_diags.swift index f628f31b9de..c9a7376cda3 100644 --- a/test/Constraints/result_builder_diags.swift +++ b/test/Constraints/result_builder_diags.swift @@ -313,9 +313,9 @@ func acceptMetatype(_: T.Type) -> Bool { true } func syntacticUses(_: T) { tuplify(true) { x in - if x && acceptMetatype(T) { // expected-error{{expected member name or constructor call after type name}} + if x && acceptMetatype(T) { // expected-error{{expected member name or initializer call after type name}} // expected-note@-1{{use '.self' to reference the type object}} - acceptMetatype(T) // expected-error{{expected member name or constructor call after type name}} + acceptMetatype(T) // expected-error{{expected member name or initializer call after type name}} // expected-note@-1{{use '.self' to reference the type object}} } } diff --git a/test/Constraints/subscript.swift b/test/Constraints/subscript.swift index 574b9f61c9f..31b4cc9a409 100644 --- a/test/Constraints/subscript.swift +++ b/test/Constraints/subscript.swift @@ -229,11 +229,11 @@ func test_subscript_accepts_type_name_argument() { } func test(a: A, optA: A?) { - let _ = a[A] // expected-warning {{expected member name or constructor call after type name; this will be an error in Swift 6}} + let _ = a[A] // expected-warning {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} {{16-16=()}} // expected-note@-2 {{use '.self' to reference the type object}} {{16-16=.self}} - let _ = optA?[A] // expected-warning {{expected member name or constructor call after type name; this will be an error in Swift 6}} + let _ = optA?[A] // expected-warning {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} {{20-20=()}} // expected-note@-2 {{use '.self' to reference the type object}} {{20-20=.self}} } diff --git a/test/Constraints/subscript_swift6.swift b/test/Constraints/subscript_swift6.swift index c3f93b491eb..61189b5d904 100644 --- a/test/Constraints/subscript_swift6.swift +++ b/test/Constraints/subscript_swift6.swift @@ -7,11 +7,11 @@ func test_subscript_accepts_type_name_argument() { } func test(a: A, optA: A?) { - let _ = a[A] // expected-error {{expected member name or constructor call after type name}} + let _ = a[A] // expected-error {{expected member name or initializer call after type name}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} {{16-16=()}} // expected-note@-2 {{use '.self' to reference the type object}} {{16-16=.self}} - let _ = optA?[A] // expected-error {{expected member name or constructor call after type name}} + let _ = optA?[A] // expected-error {{expected member name or initializer call after type name}} // expected-note@-1 {{add arguments after the type to construct a value of the type}} {{20-20=()}} // expected-note@-2 {{use '.self' to reference the type object}} {{20-20=.self}} } diff --git a/test/Parse/type_expr.swift b/test/Parse/type_expr.swift index 2ee2e6670cd..55ea4a084b1 100644 --- a/test/Parse/type_expr.swift +++ b/test/Parse/type_expr.swift @@ -87,10 +87,10 @@ func unqualifiedType() { let _ : () = Foo.meth() _ = Foo.instMeth - _ = Foo // expected-error{{expected member name or constructor call after type name}} expected-note{{add arguments}} {{10-10=()}} expected-note{{use '.self'}} {{10-10=.self}} + _ = Foo // expected-error{{expected member name or initializer call after type name}} expected-note{{add arguments}} {{10-10=()}} expected-note{{use '.self'}} {{10-10=.self}} _ = Foo.dynamicType // expected-error {{type 'Foo' has no member 'dynamicType'}} - _ = Bad // expected-error{{expected member name or constructor call after type name}} + _ = Bad // expected-error{{expected member name or initializer call after type name}} // expected-note@-1{{use '.self' to reference the type object}}{{10-10=.self}} CheckType.matches((Foo).self) @@ -106,7 +106,7 @@ func qualifiedType() { let _ : () = Foo.Bar.meth() _ = Foo.Bar.instMeth - _ = Foo.Bar // expected-error{{expected member name or constructor call after type name}} expected-note{{add arguments}} {{14-14=()}} expected-note{{use '.self'}} {{14-14=.self}} + _ = Foo.Bar // expected-error{{expected member name or initializer call after type name}} expected-note{{add arguments}} {{14-14=()}} expected-note{{use '.self'}} {{14-14=.self}} _ = Foo.Bar.dynamicType // expected-error {{type 'Foo.Bar' has no member 'dynamicType'}} CheckType.matches((Foo).Bar.self) @@ -120,10 +120,10 @@ func metaType() { let _ = Foo.Type.self let _ = Foo.Type.self - let _ = Foo.Type // expected-error{{expected member name or constructor call after type name}} + let _ = Foo.Type // expected-error{{expected member name or initializer call after type name}} // expected-note@-1 {{use '.self' to reference the type object}} - let _ = type(of: Foo.Type) // expected-error{{expected member name or constructor call after type name}} + let _ = type(of: Foo.Type) // expected-error{{expected member name or initializer call after type name}} // expected-note@-1 {{use '.self' to reference the type object}} } @@ -160,7 +160,7 @@ func genType() { CheckType>.matches(Gen<[Int : Foo].P1 & [Int : Foo].P2>.self) // FIXME?: This needs to go last or else it won't parse as intended. - _ = Gen // expected-error{{expected member name or constructor call after type name}} + _ = Gen // expected-error{{expected member name or initializer call after type name}} // expected-note@-1{{use '.self' to reference the type object}} // expected-note@-2{{add arguments after the type to construct a value of the type}} } @@ -173,7 +173,7 @@ func genQualifiedType() { let _ : () = Gen.Bar.meth() _ = Gen.Bar.instMeth - _ = Gen.Bar // expected-error{{expected member name or constructor call after type name}} + _ = Gen.Bar // expected-error{{expected member name or initializer call after type name}} // expected-note@-1{{add arguments after the type to construct a value of the type}} // expected-note@-2{{use '.self' to reference the type object}} _ = Gen.Bar.dynamicType // expected-error {{type 'Gen.Bar' has no member 'dynamicType'}} @@ -205,7 +205,7 @@ func typeOfShadowing() { } _ = type(of: Gen.Bar) // expected-error{{missing argument for parameter 'flag' in call}} {{28-28=, flag: <#Bool#>}} - _ = type(Gen.Bar) // expected-error{{expected member name or constructor call after type name}} + _ = type(Gen.Bar) // expected-error{{expected member name or initializer call after type name}} // expected-note@-1{{add arguments after the type to construct a value of the type}} // expected-note@-2{{use '.self' to reference the type object}} _ = type(of: Gen.Bar.self, flag: false) // No error here. @@ -220,7 +220,7 @@ func archetype(_: T) { _ = T.meth let _ : () = T.meth() - _ = T // expected-error{{expected member name or constructor call after type name}} expected-note{{add arguments}} {{8-8=()}} expected-note{{use '.self'}} {{8-8=.self}} + _ = T // expected-error{{expected member name or initializer call after type name}} expected-note{{add arguments}} {{8-8=()}} expected-note{{use '.self'}} {{8-8=.self}} } func assocType(_: T) where T.Zang: Zim { @@ -230,7 +230,7 @@ func assocType(_: T) where T.Zang: Zim { _ = T.Zang.meth let _ : () = T.Zang.meth() - _ = T.Zang // expected-error{{expected member name or constructor call after type name}} expected-note{{add arguments}} {{13-13=()}} expected-note{{use '.self'}} {{13-13=.self}} + _ = T.Zang // expected-error{{expected member name or initializer call after type name}} expected-note{{add arguments}} {{13-13=()}} expected-note{{use '.self'}} {{13-13=.self}} } class B { @@ -249,8 +249,8 @@ func derivedType() { _ = D.derivedMethod let _ : () = D.derivedMethod() - let _: B.Type = D // expected-error{{expected member name or constructor call after type name}} expected-note{{add arguments}} {{20-20=()}} expected-note{{use '.self'}} {{20-20=.self}} - let _: D.Type = D // expected-error{{expected member name or constructor call after type name}} expected-note{{add arguments}} {{20-20=()}} expected-note{{use '.self'}} {{20-20=.self}} + let _: B.Type = D // expected-error{{expected member name or initializer call after type name}} expected-note{{add arguments}} {{20-20=()}} expected-note{{use '.self'}} {{20-20=.self}} + let _: D.Type = D // expected-error{{expected member name or initializer call after type name}} expected-note{{add arguments}} {{20-20=()}} expected-note{{use '.self'}} {{20-20=.self}} } // Referencing a nonexistent member or constructor should not trigger errors @@ -277,7 +277,7 @@ class E { } func inAccessibleInit() { - _ = E // expected-error {{expected member name or constructor call after type name}} expected-note {{use '.self'}} {{8-8=.self}} + _ = E // expected-error {{expected member name or initializer call after type name}} expected-note {{use '.self'}} {{8-8=.self}} } enum F: Int { @@ -289,8 +289,8 @@ struct G { } func implicitInit() { - _ = F // expected-error {{expected member name or constructor call after type name}} expected-note {{add arguments}} {{8-8=()}} expected-note {{use '.self'}} {{8-8=.self}} - _ = G // expected-error {{expected member name or constructor call after type name}} expected-note {{add arguments}} {{8-8=()}} expected-note {{use '.self'}} {{8-8=.self}} + _ = F // expected-error {{expected member name or initializer call after type name}} expected-note {{add arguments}} {{8-8=()}} expected-note {{use '.self'}} {{8-8=.self}} + _ = G // expected-error {{expected member name or initializer call after type name}} expected-note {{add arguments}} {{8-8=()}} expected-note {{use '.self'}} {{8-8=.self}} } // https://github.com/apple/swift/issues/43119 @@ -315,9 +315,9 @@ func testFunctionCollectionTypes() { _ = 2 + () -> Int // expected-error {{expected type before '->'}} _ = () -> (Int, Int).2 // expected-error {{expected type after '->'}} - _ = (Int) -> Int // expected-error {{expected member name or constructor call after type name}} expected-note{{use '.self' to reference the type object}} + _ = (Int) -> Int // expected-error {{expected member name or initializer call after type name}} expected-note{{use '.self' to reference the type object}} - _ = @convention(c) () -> Int // expected-error{{expected member name or constructor call after type name}} expected-note{{use '.self' to reference the type object}} + _ = @convention(c) () -> Int // expected-error{{expected member name or initializer call after type name}} expected-note{{use '.self' to reference the type object}} _ = 1 + (@convention(c) () -> Int).self // expected-error{{cannot convert value of type '(@convention(c) () -> Int).Type' to expected argument type 'Int'}} _ = (@autoclosure () -> Int) -> (Int, Int).2 // expected-error {{expected type after '->'}} _ = ((@autoclosure () -> Int) -> (Int, Int)).1 // expected-error {{type '(@autoclosure () -> Int) -> (Int, Int)' has no member '1'}} @@ -332,8 +332,8 @@ func testFunctionCollectionTypes() { } func compositionType() { - _ = P1 & P2 // expected-error {{expected member name or constructor call after type name}} expected-note{{use '.self'}} {{7-7=(}} {{14-14=).self}} - _ = any P1 & P1 // expected-error {{expected member name or constructor call after type name}} expected-note{{use '.self'}} {{7-7=(}} {{18-18=).self}} + _ = P1 & P2 // expected-error {{expected member name or initializer call after type name}} expected-note{{use '.self'}} {{7-7=(}} {{14-14=).self}} + _ = any P1 & P1 // expected-error {{expected member name or initializer call after type name}} expected-note{{use '.self'}} {{7-7=(}} {{18-18=).self}} _ = P1 & P2.self // expected-error {{binary operator '&' cannot be applied to operands of type '(any P1).Type' and '(any P2).Type'}} _ = (P1 & P2).self // Ok. _ = (P1 & (P2)).self // Ok. @@ -353,12 +353,12 @@ func compositionType() { func tupleType() { _ = (Foo, Foo) - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{use '.self' to reference the type object}} {{17-17=.self}} _ = (Foo, Foo).self CheckType<(Foo, Foo)>.matches((Foo, Foo)) - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{use '.self' to reference the type object}} {{43-43=.self}} // Check that we resolve these type expressions correctly. @@ -405,23 +405,23 @@ func tupleType() { func functionType() { _ = Foo -> Foo // expected-error@-1 {{single argument function types require parentheses}} {{7-7=(}} {{10-10=)}} - // expected-error@-2 {{expected member name or constructor call after type name}} + // expected-error@-2 {{expected member name or initializer call after type name}} // expected-note@-3 {{use '.self' to reference the type object}} {{7-7=(}} {{17-17=).self}} _ = (Foo) -> Foo - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{use '.self' to reference the type object}} {{7-7=(}} {{19-19=).self}} _ = (Foo) -> Foo -> Foo // expected-error@-1 {{single argument function types require parentheses}} {{16-16=(}} {{19-19=)}} - // expected-error@-2 {{expected member name or constructor call after type name}} + // expected-error@-2 {{expected member name or initializer call after type name}} // expected-note@-3 {{use '.self' to reference the type object}} {{7-7=(}} {{26-26=).self}} _ = P1 & P2 -> Foo // expected-error @-1 {{single argument function types require parentheses}} {{7-7=(}} {{14-14=)}} - // expected-error @-2 {{expected member name or constructor call after type name}} + // expected-error @-2 {{expected member name or initializer call after type name}} // expected-note @-3 {{use '.self' to reference the type object}} {{7-7=(}} {{21-21=).self}} _ = P1 & P2 -> P3 & P1 -> Foo // expected-error @-1 {{single argument function types require parentheses}} {{18-18=(}} {{25-25=)}} // expected-error @-2 {{single argument function types require parentheses}} {{7-7=(}} {{14-14=)}} - // expected-error @-3 {{expected member name or constructor call after type name}} + // expected-error @-3 {{expected member name or initializer call after type name}} // expected-note @-4 {{use '.self'}} {{7-7=(}} {{32-32=).self}} _ = (Foo -> Foo).self // expected-error {{single argument function types require parentheses}} {{8-8=(}} {{11-11=)}} _ = (P1 & P2 -> P3 & P2).self // expected-error {{single argument function types require parentheses}} {{8-8=(}} {{15-15=)}} @@ -482,7 +482,7 @@ func complexSequence() { _ = try P1 & P2 throws -> P3 & P1 // expected-warning @-1 {{no calls to throwing functions occur within 'try' expression}} // expected-error @-2 {{single argument function types require parentheses}} {{11-11=(}} {{18-18=)}} - // expected-error @-3 {{expected member name or constructor call after type name}} + // expected-error @-3 {{expected member name or initializer call after type name}} // expected-note @-4 {{use '.self' to reference the type object}} {{11-11=(}} {{36-36=).self}} } @@ -496,32 +496,32 @@ func testMissingSelf() { // See test/Compatibility/type_expr.swift. takesOneArg(Int) - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{add arguments after the type to construct a value of the type}} // expected-note@-3 {{use '.self' to reference the type object}} takesOneArg(Swift.Int) - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{add arguments after the type to construct a value of the type}} // expected-note@-3 {{use '.self' to reference the type object}} takesTwoArgs(Int, 0) - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{add arguments after the type to construct a value of the type}} // expected-note@-3 {{use '.self' to reference the type object}} takesTwoArgs(Swift.Int, 0) - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{add arguments after the type to construct a value of the type}} // expected-note@-3 {{use '.self' to reference the type object}} Swift.Int // expected-warning {{expression of type 'Int.Type' is unused}} - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{add arguments after the type to construct a value of the type}} // expected-note@-3 {{use '.self' to reference the type object}} _ = Swift.Int - // expected-error@-1 {{expected member name or constructor call after type name}} + // expected-error@-1 {{expected member name or initializer call after type name}} // expected-note@-2 {{add arguments after the type to construct a value of the type}} // expected-note@-3 {{use '.self' to reference the type object}} } diff --git a/test/SourceKit/Sema/sema_module.swift b/test/SourceKit/Sema/sema_module.swift index 14f3d226c8a..224307deb50 100644 --- a/test/SourceKit/Sema/sema_module.swift +++ b/test/SourceKit/Sema/sema_module.swift @@ -4,4 +4,4 @@ Swift // CHECK: key.kind: source.lang.swift.ref.struct, // CHECK: key.severity: source.diagnostic.severity.error, // CHECK-NEXT: key.id: "value_of_metatype_type", -// CHECK-NEXT: key.description: "expected member name or constructor call after type name", +// CHECK-NEXT: key.description: "expected member name or initializer call after type name", diff --git a/test/attr/dynamicReplacement.swift b/test/attr/dynamicReplacement.swift index f0985eb261b..e66c0691721 100644 --- a/test/attr/dynamicReplacement.swift +++ b/test/attr/dynamicReplacement.swift @@ -40,10 +40,10 @@ extension TheReplaceables { } extension K { - @_dynamicReplacement(for: init(i:)) // expected-error{{replaced constructor 'init(i:)' is not marked as convenience}} + @_dynamicReplacement(for: init(i:)) // expected-error{{replaced initializer 'init(i:)' is not marked as convenience}} convenience init(ri: Int) { } - @_dynamicReplacement(for: init(c:)) // expected-error{{replaced constructor 'init(c:)' is marked as convenience}}) + @_dynamicReplacement(for: init(c:)) // expected-error{{replaced initializer 'init(c:)' is marked as convenience}}) init(rc: Int) { } @_dynamicReplacement(for:finalFunction()) diff --git a/test/type/explicit_existential.swift b/test/type/explicit_existential.swift index 92ac3cbdcbb..7075d0fbe88 100644 --- a/test/type/explicit_existential.swift +++ b/test/type/explicit_existential.swift @@ -214,7 +214,7 @@ func testAnyTypeExpr() { func test(_: (any P).Type) {} test((any P).self) - // expected-error@+2 {{expected member name or constructor call after type name}} + // expected-error@+2 {{expected member name or initializer call after type name}} // expected-note@+1 {{use '.self' to reference the type object}} let invalid = any P test(invalid) @@ -361,4 +361,4 @@ var example1: any (any IteratorProtocol) = 5 // expected-error{{redundant 'any' protocol PP {} struct A : PP {} let _: any PP = A() // Ok -let _: any (any PP) = A() // expected-error{{redundant 'any' in type 'any (any PP)'}} {{8-12=}} \ No newline at end of file +let _: any (any PP) = A() // expected-error{{redundant 'any' in type 'any (any PP)'}} {{8-12=}} diff --git a/test/type/explicit_existential_swift6.swift b/test/type/explicit_existential_swift6.swift index 77f086ff45b..433432681cb 100644 --- a/test/type/explicit_existential_swift6.swift +++ b/test/type/explicit_existential_swift6.swift @@ -237,7 +237,7 @@ func testAnyTypeExpr() { func test(_: (any P).Type) {} test((any P).self) - // expected-error@+2 {{expected member name or constructor call after type name}} + // expected-error@+2 {{expected member name or initializer call after type name}} // expected-note@+1 {{use '.self' to reference the type object}} let invalid = any P test(invalid) diff --git a/test/type/implicit_some/explicit_existential.swift b/test/type/implicit_some/explicit_existential.swift index 318265baa57..4340f222ac8 100644 --- a/test/type/implicit_some/explicit_existential.swift +++ b/test/type/implicit_some/explicit_existential.swift @@ -186,7 +186,7 @@ func testAnyTypeExpr() { func test(_: (any P).Type) {} test((any P).self) - // expected-error@+2 {{expected member name or constructor call after type name}} + // expected-error@+2 {{expected member name or initializer call after type name}} // expected-note@+1 {{use '.self' to reference the type object}} let invalid = any P test(invalid) diff --git a/test/type/nested_types.swift b/test/type/nested_types.swift index 6c9fb01ddb3..235f6e45b69 100644 --- a/test/type/nested_types.swift +++ b/test/type/nested_types.swift @@ -95,20 +95,20 @@ do { func test() { blackHole(Self.E) - // expected-warning@-1 {{expected member name or constructor call after type name; this will be an error in Swift 6}} + // expected-warning@-1 {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-2 {{use '.self' to reference the type object}} blackHole((Test).E) - // expected-warning@-1 {{expected member name or constructor call after type name; this will be an error in Swift 6}} + // expected-warning@-1 {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-2 {{use '.self' to reference the type object}} blackHole([Test].Element) - // expected-warning@-1 {{expected member name or constructor call after type name; this will be an error in Swift 6}} + // expected-warning@-1 {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-2 {{use '.self' to reference the type object}} // expected-note@-3 {{add arguments after the type to construct a value of the type}} blackHole([Int : Test].Element) - // expected-warning@-1 {{expected member name or constructor call after type name; this will be an error in Swift 6}} + // expected-warning@-1 {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-2 {{use '.self' to reference the type object}} blackHole(Test?.Wrapped) - // expected-warning@-1 {{expected member name or constructor call after type name; this will be an error in Swift 6}} + // expected-warning@-1 {{expected member name or initializer call after type name; this will be an error in Swift 6}} // expected-note@-2 {{use '.self' to reference the type object}} // expected-note@-3 {{add arguments after the type to construct a value of the type}} }