Skip to content

Commit baa20ae

Browse files
authored
Merge pull request #67909 from nishithshah2211/imperative-fixits
[Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
2 parents 4ba0173 + 8e2e625 commit baa20ae

File tree

77 files changed

+312
-313
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+312
-313
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2694,9 +2694,9 @@ NOTE(inherited_protocol_does_not_conform,none,
26942694
NOTE(no_witnesses,none,
26952695
"protocol requires "
26962696
"%select{initializer %1|function %1|property %1|subscript}0 with type %2"
2697-
"%select{|; do you want to add a stub?}3",
2697+
"%select{|; add a stub for conformance}3",
26982698
(RequirementKind, const ValueDecl *, Type, bool))
2699-
NOTE(missing_witnesses_general,none, "do you want to add protocol stubs?",
2699+
NOTE(missing_witnesses_general,none, "add stubs for conformance",
27002700
())
27012701
NOTE(ambiguous_witnesses,none,
27022702
"multiple matching "
@@ -2709,7 +2709,7 @@ NOTE(ambiguous_witnesses_wrong_name,none,
27092709
"subscript operators}0 with type %2",
27102710
(RequirementKind, const ValueDecl *, Type))
27112711
NOTE(no_witnesses_type,none,
2712-
"protocol requires nested type %0; do you want to add it?",
2712+
"protocol requires nested type %0; add nested type %0 for conformance",
27132713
(const AssociatedTypeDecl *))
27142714
NOTE(default_associated_type_req_fail,none,
27152715
"default type %0 for associated type %1 (from protocol %2) "
@@ -6657,16 +6657,15 @@ WARNING(debug_long_expression, none,
66576657

66586658
ERROR(empty_switch_stmt,none,
66596659
"'switch' statement body must have at least one 'case' or 'default' "
6660-
"block; do you want to add a default case?",())
6660+
"block; add a default case",())
66616661
ERROR(non_exhaustive_switch,none, "switch must be exhaustive", ())
66626662
ERROR(possibly_non_exhaustive_switch,none,
66636663
"the compiler is unable to check that this switch is exhaustive in reasonable time",
66646664
())
66656665

66666666
NOTE(missing_several_cases,none,
6667-
"do you want to add "
6668-
"%select{missing cases|a default clause}0"
6669-
"?", (bool))
6667+
"add "
6668+
"%select{missing cases|a default clause}0", (bool))
66706669
NOTE(missing_unknown_case,none,
66716670
"handle unknown values using \"@unknown default\"", ())
66726671

test/AutoDiff/Sema/DerivedConformances/derived_differentiable_diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import _Differentiation
44

55
protocol TangentVectorP: Differentiable {
6-
// expected-note @+1 {{protocol requires property 'requirement' with type 'Int'; do you want to add a stub?}}
6+
// expected-note @+1 {{protocol requires property 'requirement' with type 'Int'; add a stub for conformance}}
77
var requirement: Int { get }
88
}
99

test/AutoDiff/Sema/differentiable_attr_type_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public protocol DoubleDifferentiableDistribution: DifferentiableDistribution
557557

558558
public protocol HasRequirement {
559559
@differentiable(reverse)
560-
// expected-note @+1 {{protocol requires function 'requirement' with type '<T> (T, T) -> T'; do you want to add a stub?}}
560+
// expected-note @+1 {{protocol requires function 'requirement' with type '<T> (T, T) -> T'; add a stub for conformance}}
561561
func requirement<T: Differentiable>(_ x: T, _ y: T) -> T
562562
}
563563

test/ClangImporter/enum-new.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ func test() {
1313
case .Yellow, .Magenta, .Black, .Cyan: break
1414
}
1515

16-
switch getColorOptions() { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
16+
switch getColorOptions() { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
1717
case ColorOptions.Pastel: break
1818
case ColorOptions.Swift: break
1919
}
2020

21-
switch 5 as Int16 { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; do you want to add a default case?}}
21+
switch 5 as Int16 { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; add a default case}}
2222
}
2323
}

test/Compatibility/special_func_name.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -swift-version 4
22

33
protocol P1 {
4-
static func `init`(_: Int) // expected-note {{protocol requires function 'init' with type '(Int) -> ()'; do you want to add a stub?}}
4+
static func `init`(_: Int) // expected-note {{protocol requires function 'init' with type '(Int) -> ()'; add a stub for conformance}}
55
// expected-note@-1 {{did you mean 'init'?}}
66
}
77

@@ -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'; add a stub for conformance}}
1818
}
1919

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

test/Concurrency/async_conformance.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import Foundation
66

77
// async objc requirement, sync witness
88
@objc protocol Tracker {
9-
func track(event: String) async // expected-note {{protocol requires function 'track(event:)' with type '(String) async -> ()'; do you want to add a stub?}}
9+
func track(event: String) async // expected-note {{protocol requires function 'track(event:)' with type '(String) async -> ()'; add a stub for conformance}}
1010
}
1111
class Dog: NSObject, Tracker { // expected-error {{type 'Dog' does not conform to protocol 'Tracker'}}
1212
func track(event: String) {} // expected-note {{candidate is not 'async', but @objc protocol requirement is}}
1313
}
1414

1515
// sync objc requirement, async witness
1616
@objc protocol Runner {
17-
func run(event: String) // expected-note {{protocol requires function 'run(event:)' with type '(String) -> ()'; do you want to add a stub?}}
17+
func run(event: String) // expected-note {{protocol requires function 'run(event:)' with type '(String) -> ()'; add a stub for conformance}}
1818
}
1919
class Athlete: NSObject, Runner { // expected-error {{type 'Athlete' does not conform to protocol 'Runner'}}
2020
func run(event: String) async {} // expected-note {{candidate is 'async', but @objc protocol requirement is not}}
@@ -33,7 +33,7 @@ class Foodie: Snacker {
3333

3434
// sync swift protocol, async witness
3535
protocol Backer {
36-
func back(stonk: String) // expected-note {{protocol requires function 'back(stonk:)' with type '(String) -> ()'; do you want to add a stub?}}
36+
func back(stonk: String) // expected-note {{protocol requires function 'back(stonk:)' with type '(String) -> ()'; add a stub for conformance}}
3737
}
3838

3939
class Investor: Backer { // expected-error {{type 'Investor' does not conform to protocol 'Backer'}}

test/Concurrency/async_initializer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ struct Location {
148148
}
149149

150150
protocol DefaultConstructable {
151-
init() // expected-note {{protocol requires initializer 'init()' with type '()'; do you want to add a stub?}} {{+2:43-43=\n init() {\n <#code#>\n \}\n}}
151+
init() // expected-note {{protocol requires initializer 'init()' with type '()'; add a stub for conformance}} {{+2:43-43=\n init() {\n <#code#>\n \}\n}}
152152
}
153153
extension Location: DefaultConstructable {} // expected-error {{type 'Location' does not conform to protocol 'DefaultConstructable'}}
154154

test/Constraints/associated_types.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ protocol XReqt {}
6262
protocol YReqt {}
6363

6464
protocol SameTypedDefaultWithReqts {
65-
associatedtype X: XReqt // expected-note{{protocol requires nested type 'X'; do you want to add it?}}
66-
associatedtype Y: YReqt // expected-note{{protocol requires nested type 'Y'; do you want to add it?}}
65+
associatedtype X: XReqt // expected-note{{protocol requires nested type 'X'; add nested type 'X' for conformance}}
66+
associatedtype Y: YReqt // expected-note{{protocol requires nested type 'Y'; add nested type 'Y' for conformance}}
6767
static var x: X { get }
6868
static var y: Y { get }
6969
}
@@ -86,7 +86,7 @@ struct UsesSameTypedDefaultWithoutSatisfyingReqts: SameTypedDefaultWithReqts {
8686
}
8787

8888
protocol SameTypedDefaultBaseWithReqts {
89-
associatedtype X: XReqt // expected-note{{protocol requires nested type 'X'; do you want to add it?}}
89+
associatedtype X: XReqt // expected-note{{protocol requires nested type 'X'; add nested type 'X' for conformance}}
9090
static var x: X { get }
9191
}
9292
protocol SameTypedDefaultDerivedWithReqts: SameTypedDefaultBaseWithReqts {

test/Constraints/issue-52995.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// https://github.com/apple/swift/issues/52995
44

55
protocol Nested {
6-
associatedtype U // expected-note {{protocol requires nested type 'U'; do you want to add it?}}
6+
associatedtype U // expected-note {{protocol requires nested type 'U'; add nested type 'U' for conformance}}
77
}
88

99
class A<M> {

test/Constraints/issue-54820.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
protocol Protocol {
66
associatedtype Index: Comparable
77
subscript(bounds: Range<Index>) -> Int { get }
8-
// expected-note@+1 {{protocol requires subscript with type '(Wrapper<Base>.Index) -> Int' (aka '(Base.Index) -> Int'); do you want to add a stub?}}
8+
// expected-note@+1 {{protocol requires subscript with type '(Wrapper<Base>.Index) -> Int' (aka '(Base.Index) -> Int'); add a stub for conformance}}
99
subscript(position: Index) -> Int { get }
1010
}
1111

test/Constraints/moveonly_constraints.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ func copyableExistentials(_ a: Any, _ e1: Error, _ e2: any Error, _ ah: AnyHasha
256256
// ensure that associated types can't be witnessed by move-only types
257257

258258
protocol HasType<Ty> {
259-
associatedtype Ty // expected-note 3{{protocol requires nested type 'Ty'; do you want to add it?}}
259+
associatedtype Ty // expected-note 3{{protocol requires nested type 'Ty'; add nested type 'Ty' for conformance}}
260260
}
261261

262262
class SomeGuy: HasType { // expected-error {{type 'SomeGuy' does not conform to protocol 'HasType'}}

test/Constraints/result_builder_diags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ struct MyView {
641641
}
642642

643643
@TupleBuilder var emptySwitch: some P {
644-
switch Optional.some(1) { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; do you want to add a default case?}}
644+
switch Optional.some(1) { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; add a default case}}
645645
}
646646
}
647647

test/Constraints/same_types.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
33

44
protocol Fooable {
5-
associatedtype Foo // expected-note{{protocol requires nested type 'Foo'; do you want to add it?}}
5+
associatedtype Foo // expected-note{{protocol requires nested type 'Foo'; add nested type 'Foo' for conformance}}
66

77
var foo: Foo { get }
88
}

test/Generics/associated_type_where_clause.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ConcreteConforms2: Conforms { typealias T = Int }
2222
struct ConcreteConformsNonFoo2: Conforms { typealias T = Float }
2323

2424
protocol NestedConforms {
25-
associatedtype U where U: Conforms, U.T: Foo2 // expected-note{{protocol requires nested type 'U'; do you want to add it?}}
25+
associatedtype U where U: Conforms, U.T: Foo2 // expected-note{{protocol requires nested type 'U'; add nested type 'U' for conformance}}
2626

2727
func foo(_: U)
2828
}
@@ -62,7 +62,7 @@ func needsNestedConformsDefault<X: NestedConformsDefault>(_: X.Type) {
6262
}
6363

6464
protocol NestedSameType {
65-
associatedtype U: Conforms where U.T == Int // expected-note{{protocol requires nested type 'U'; do you want to add it?}}
65+
associatedtype U: Conforms where U.T == Int // expected-note{{protocol requires nested type 'U'; add nested type 'U' for conformance}}
6666

6767
func foo(_: U)
6868
}

test/Generics/constrained_type_witnesses.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
protocol P {
44
associatedtype A
5-
// expected-note@-1 5{{protocol requires nested type 'A'; do you want to add it?}}
5+
// expected-note@-1 5{{protocol requires nested type 'A'; add nested type 'A' for conformance}}
66
}
77

88
struct S1<T> {}

test/Parse/ConditionalCompilation/switch_case.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func foo(x: E, intVal: Int) {
137137
}
138138

139139
// Empty check.
140-
switch intVal { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; do you want to add a default case?}}
140+
switch intVal { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; add a default case}}
141141
#if NEVER
142142
case 1:
143143
break

test/Parse/matching_patterns.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ case _: // expected-warning {{case is already handled by previous patterns; cons
5656

5757
var e : Any = 0
5858

59-
switch e { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
59+
switch e { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
6060
// 'is' pattern.
6161
case is Int,
6262
is A<Int>,

test/Parse/matching_patterns_reference_bindings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ case (inout a, inout a): // expected-error {{invalid redeclaration of 'a'}}
6868

6969
var e : Any = 0
7070

71-
switch e { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
71+
switch e { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
7272
// 'is' pattern.
7373
case is Int,
7474
is A<Int>,

test/Parse/switch.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ default:
7171
}
7272

7373
// Multiple cases per case block
74-
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
74+
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
7575
case 0: // expected-error {{'case' label in a 'switch' must have at least one executable statement}} {{8-8= break}}
7676
case 1:
7777
x = 0
@@ -83,7 +83,7 @@ default:
8383
x = 0
8484
}
8585

86-
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
86+
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
8787
case 0:
8888
x = 0
8989
case 1: // expected-error {{'case' label in a 'switch' must have at least one executable statement}} {{8-8= break}}
@@ -95,7 +95,7 @@ case 0:
9595
default: // expected-error {{'default' label in a 'switch' must have at least one executable statement}} {{9-9= break}}
9696
}
9797

98-
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
98+
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
9999
case 0:
100100
; // expected-error {{';' statements are not allowed}} {{3-5=}}
101101
case 1:
@@ -142,22 +142,22 @@ default: // expected-error{{additional 'case' blocks cannot appear after the 'de
142142
x = 0
143143
}
144144

145-
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
145+
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
146146
default where x == 0: // expected-error{{'default' cannot be used with a 'where' guard expression}}
147147
x = 0
148148
}
149149

150-
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
150+
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
151151
case 0: // expected-error {{'case' label in a 'switch' must have at least one executable statement}} {{8-8= break}}
152152
}
153153

154-
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
154+
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
155155
case 0: // expected-error{{'case' label in a 'switch' must have at least one executable statement}} {{8-8= break}}
156156
case 1:
157157
x = 0
158158
}
159159

160-
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
160+
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
161161
case 0:
162162
x = 0
163163
case 1: // expected-error{{'case' label in a 'switch' must have at least one executable statement}} {{8-8= break}}
@@ -299,7 +299,7 @@ func patternVarDiffMutability(x: Int, y: Double) {
299299
}
300300

301301
func test_label(x : Int) {
302-
Gronk: // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
302+
Gronk: // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
303303
switch x {
304304
case 42: return
305305
}
@@ -637,7 +637,7 @@ func testReturnBeforeIncompleteUnknownDefault() {
637637
}
638638

639639
func testReturnBeforeIncompleteUnknownDefault2() {
640-
switch x { // expected-error {{switch must be exhaustive}} expected-note {{do you want to add a default clause?}}
640+
switch x { // expected-error {{switch must be exhaustive}} expected-note {{add a default clause}}
641641
case 1:
642642
return
643643
@unknown // expected-error {{unknown attribute 'unknown'}}

test/Parse/switch_incomplete.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
// <rdar://problem/15971438> Incomplete switch was parsing to an AST that
44
// triggered an assertion failure.
5-
// expected-error@+1 {{switch must be exhaustive}} expected-note@+1{{do you want to add a default clause?}}
5+
// expected-error@+1 {{switch must be exhaustive}} expected-note@+1{{add a default clause}}
66
switch 1 { // expected-note{{to match this opening '{'}}
77
case 1: // expected-error@+1{{expected '}' at end of 'switch' statement}}

test/Sema/accessibility_private.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class Sub : Container {
114114

115115
protocol VeryImportantProto {
116116
associatedtype Assoc
117-
var value: Int { get set } // expected-note {{protocol requires property 'value' with type 'Int'; do you want to add a stub?}}
117+
var value: Int { get set } // expected-note {{protocol requires property 'value' with type 'Int'; add a stub for conformance}}
118118
}
119119

120120
private struct VIPPrivateType : VeryImportantProto {

test/Sema/call_as_function_protocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-typecheck-verify-swift
22

33
protocol P0 {
4-
// expected-note @+1 {{protocol requires function 'callAsFunction()' with type '() -> Missing'; do you want to add a stub?}}
4+
// expected-note @+1 {{protocol requires function 'callAsFunction()' with type '() -> Missing'; add a stub for conformance}}
55
func callAsFunction() -> Self
66
}
77
func testProtocol(_ x: P0) {

test/Sema/circular_decl_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct SomeStruct<A> {
7171

7272
// <rdar://problem/27680407> Infinite recursion when using fully-qualified associatedtype name that has not been defined with typealias
7373
protocol rdar27680407Proto {
74-
associatedtype T // expected-note {{protocol requires nested type 'T'; do you want to add it?}}
74+
associatedtype T // expected-note {{protocol requires nested type 'T'; add nested type 'T' for conformance}}
7575

7676
init(value: T)
7777
}

test/Sema/const_pass_as_arguments.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func main_member(_ u: Utils, _ i: Int, _ d: Double, _ s: String) {
4242
}
4343

4444
protocol ConstFan {
45-
static _const var v: String { get } // expected-note {{protocol requires property 'v' with type 'String'; do you want to add a stub?}}
45+
static _const var v: String { get } // expected-note {{protocol requires property 'v' with type 'String'; add a stub for conformance}}
4646
}
4747

4848
class ConstFanClass1: ConstFan { // expected-error {{type 'ConstFanClass1' does not conform to protocol 'ConstFan'}}

test/Sema/exhaustive_switch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ do {
778778

779779
func foo(_ str: String) -> Int {
780780
switch str { // expected-error {{switch must be exhaustive}}
781-
// expected-note@-1 {{do you want to add a default clause?}}
781+
// expected-note@-1 {{add a default clause}}
782782
case let (x as Int) as Any:
783783
return x
784784
}

test/Sema/fixits-derived-conformances.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import Types
66

77
extension GenericEnum: Equatable { }
88
// expected-error@-1 {{extension outside of file declaring generic enum 'GenericEnum' prevents automatic synthesis of '==' for protocol 'Equatable'}}
9-
// expected-note@-2 {{do you want to add protocol stubs?}}{{35-35=\n public static func == (lhs: GenericEnum, rhs: GenericEnum) -> Bool {\n <#code#>\n \}\n}}
9+
// expected-note@-2 {{add stubs for conformance}}{{35-35=\n public static func == (lhs: GenericEnum, rhs: GenericEnum) -> Bool {\n <#code#>\n \}\n}}
1010

1111
extension Struct: Equatable { }
1212
// expected-error@-1 {{extension outside of file declaring struct 'Struct' prevents automatic synthesis of '==' for protocol 'Equatable'}}
13-
// expected-note@-2 {{do you want to add protocol stubs?}}{{30-30=\n public static func == (lhs: Struct, rhs: Struct) -> Bool {\n <#code#>\n \}\n}}
13+
// expected-note@-2 {{add stubs for conformance}}{{30-30=\n public static func == (lhs: Struct, rhs: Struct) -> Bool {\n <#code#>\n \}\n}}
1414
extension GenericStruct: Equatable { }
1515
// expected-error@-1 {{extension outside of file declaring generic struct 'GenericStruct' prevents automatic synthesis of '==' for protocol 'Equatable'}}
16-
// expected-note@-2 {{do you want to add protocol stubs?}}{{37-37=\n public static func == (lhs: GenericStruct, rhs: GenericStruct) -> Bool {\n <#code#>\n \}\n}}
16+
// expected-note@-2 {{add stubs for conformance}}{{37-37=\n public static func == (lhs: GenericStruct, rhs: GenericStruct) -> Bool {\n <#code#>\n \}\n}}
1717

1818
extension Enum: CaseIterable { }
1919
// expected-error@-1 {{extension outside of file declaring enum 'Enum' prevents automatic synthesis of 'allCases' for protocol 'CaseIterable'}}
20-
// expected-note@-2 {{do you want to add protocol stubs?}}{{31-31=\n public static var allCases: [Enum]\n}}
20+
// expected-note@-2 {{add stubs for conformance}}{{31-31=\n public static var allCases: [Enum]\n}}
2121

0 commit comments

Comments
 (0)