[Diagnostics] Use imperative msg for protocol conformance & switch-case fixits

This commit changes fixit messages from a question/suggestion to an
imperative message for protocol conformances and switch-case. Addresses
https://github.com/apple/swift/issues/67510.
This commit is contained in:
Nishith Shah
2023-08-13 18:24:16 -07:00
parent 3113e83c4e
commit 8e2e625543
77 changed files with 312 additions and 313 deletions

View File

@@ -2689,9 +2689,9 @@ NOTE(inherited_protocol_does_not_conform,none,
NOTE(no_witnesses,none,
"protocol requires "
"%select{initializer %1|function %1|property %1|subscript}0 with type %2"
"%select{|; do you want to add a stub?}3",
"%select{|; add a stub for conformance}3",
(RequirementKind, const ValueDecl *, Type, bool))
NOTE(missing_witnesses_general,none, "do you want to add protocol stubs?",
NOTE(missing_witnesses_general,none, "add stubs for conformance",
())
NOTE(ambiguous_witnesses,none,
"multiple matching "
@@ -2704,7 +2704,7 @@ NOTE(ambiguous_witnesses_wrong_name,none,
"subscript operators}0 with type %2",
(RequirementKind, const ValueDecl *, Type))
NOTE(no_witnesses_type,none,
"protocol requires nested type %0; do you want to add it?",
"protocol requires nested type %0; add nested type %0 for conformance",
(const AssociatedTypeDecl *))
NOTE(default_associated_type_req_fail,none,
"default type %0 for associated type %1 (from protocol %2) "
@@ -6643,16 +6643,15 @@ WARNING(debug_long_expression, none,
ERROR(empty_switch_stmt,none,
"'switch' statement body must have at least one 'case' or 'default' "
"block; do you want to add a default case?",())
"block; add a default case",())
ERROR(non_exhaustive_switch,none, "switch must be exhaustive", ())
ERROR(possibly_non_exhaustive_switch,none,
"the compiler is unable to check that this switch is exhaustive in reasonable time",
())
NOTE(missing_several_cases,none,
"do you want to add "
"%select{missing cases|a default clause}0"
"?", (bool))
"add "
"%select{missing cases|a default clause}0", (bool))
NOTE(missing_unknown_case,none,
"handle unknown values using \"@unknown default\"", ())

View File

@@ -3,7 +3,7 @@
import _Differentiation
protocol TangentVectorP: Differentiable {
// expected-note @+1 {{protocol requires property 'requirement' with type 'Int'; do you want to add a stub?}}
// expected-note @+1 {{protocol requires property 'requirement' with type 'Int'; add a stub for conformance}}
var requirement: Int { get }
}

View File

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

View File

@@ -13,11 +13,11 @@ func test() {
case .Yellow, .Magenta, .Black, .Cyan: break
}
switch getColorOptions() { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch getColorOptions() { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
case ColorOptions.Pastel: break
case ColorOptions.Swift: break
}
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?}}
switch 5 as Int16 { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; add a default case}}
}
}

View File

@@ -1,7 +1,7 @@
// RUN: %target-typecheck-verify-swift -swift-version 4
protocol P1 {
static func `init`(_: Int) // expected-note {{protocol requires function 'init' with type '(Int) -> ()'; do you want to add a stub?}}
static func `init`(_: Int) // expected-note {{protocol requires function 'init' with type '(Int) -> ()'; add a stub for conformance}}
// expected-note@-1 {{did you mean 'init'?}}
}
@@ -14,7 +14,7 @@ struct S12 : P1 { // expected-error {{type 'S12' does not conform to protocol 'P
}
protocol P2 {
init(_: Int) // expected-note {{protocol requires initializer 'init(_:)' with type 'Int'; do you want to add a stub?}}
init(_: Int) // expected-note {{protocol requires initializer 'init(_:)' with type 'Int'; add a stub for conformance}}
}
struct S21 : P2 { // expected-error {{type 'S21' does not conform to protocol 'P2'}}

View File

@@ -6,7 +6,7 @@ import Foundation
// async objc requirement, sync witness
@objc protocol Tracker {
func track(event: String) async // expected-note {{protocol requires function 'track(event:)' with type '(String) async -> ()'; do you want to add a stub?}}
func track(event: String) async // expected-note {{protocol requires function 'track(event:)' with type '(String) async -> ()'; add a stub for conformance}}
}
class Dog: NSObject, Tracker { // expected-error {{type 'Dog' does not conform to protocol 'Tracker'}}
func track(event: String) {} // expected-note {{candidate is not 'async', but @objc protocol requirement is}}
@@ -14,7 +14,7 @@ class Dog: NSObject, Tracker { // expected-error {{type 'Dog' does not conform t
// sync objc requirement, async witness
@objc protocol Runner {
func run(event: String) // expected-note {{protocol requires function 'run(event:)' with type '(String) -> ()'; do you want to add a stub?}}
func run(event: String) // expected-note {{protocol requires function 'run(event:)' with type '(String) -> ()'; add a stub for conformance}}
}
class Athlete: NSObject, Runner { // expected-error {{type 'Athlete' does not conform to protocol 'Runner'}}
func run(event: String) async {} // expected-note {{candidate is 'async', but @objc protocol requirement is not}}
@@ -33,7 +33,7 @@ class Foodie: Snacker {
// sync swift protocol, async witness
protocol Backer {
func back(stonk: String) // expected-note {{protocol requires function 'back(stonk:)' with type '(String) -> ()'; do you want to add a stub?}}
func back(stonk: String) // expected-note {{protocol requires function 'back(stonk:)' with type '(String) -> ()'; add a stub for conformance}}
}
class Investor: Backer { // expected-error {{type 'Investor' does not conform to protocol 'Backer'}}

View File

@@ -148,7 +148,7 @@ struct Location {
}
protocol DefaultConstructable {
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}}
init() // expected-note {{protocol requires initializer 'init()' with type '()'; add a stub for conformance}} {{+2:43-43=\n init() {\n <#code#>\n \}\n}}
}
extension Location: DefaultConstructable {} // expected-error {{type 'Location' does not conform to protocol 'DefaultConstructable'}}

View File

@@ -62,8 +62,8 @@ protocol XReqt {}
protocol YReqt {}
protocol SameTypedDefaultWithReqts {
associatedtype X: XReqt // expected-note{{protocol requires nested type 'X'; do you want to add it?}}
associatedtype Y: YReqt // expected-note{{protocol requires nested type 'Y'; do you want to add it?}}
associatedtype X: XReqt // expected-note{{protocol requires nested type 'X'; add nested type 'X' for conformance}}
associatedtype Y: YReqt // expected-note{{protocol requires nested type 'Y'; add nested type 'Y' for conformance}}
static var x: X { get }
static var y: Y { get }
}
@@ -86,7 +86,7 @@ struct UsesSameTypedDefaultWithoutSatisfyingReqts: SameTypedDefaultWithReqts {
}
protocol SameTypedDefaultBaseWithReqts {
associatedtype X: XReqt // expected-note{{protocol requires nested type 'X'; do you want to add it?}}
associatedtype X: XReqt // expected-note{{protocol requires nested type 'X'; add nested type 'X' for conformance}}
static var x: X { get }
}
protocol SameTypedDefaultDerivedWithReqts: SameTypedDefaultBaseWithReqts {

View File

@@ -3,7 +3,7 @@
// https://github.com/apple/swift/issues/52995
protocol Nested {
associatedtype U // expected-note {{protocol requires nested type 'U'; do you want to add it?}}
associatedtype U // expected-note {{protocol requires nested type 'U'; add nested type 'U' for conformance}}
}
class A<M> {

View File

@@ -5,7 +5,7 @@
protocol Protocol {
associatedtype Index: Comparable
subscript(bounds: Range<Index>) -> Int { get }
// expected-note@+1 {{protocol requires subscript with type '(Wrapper<Base>.Index) -> Int' (aka '(Base.Index) -> Int'); do you want to add a stub?}}
// expected-note@+1 {{protocol requires subscript with type '(Wrapper<Base>.Index) -> Int' (aka '(Base.Index) -> Int'); add a stub for conformance}}
subscript(position: Index) -> Int { get }
}

View File

@@ -256,7 +256,7 @@ func copyableExistentials(_ a: Any, _ e1: Error, _ e2: any Error, _ ah: AnyHasha
// ensure that associated types can't be witnessed by move-only types
protocol HasType<Ty> {
associatedtype Ty // expected-note 3{{protocol requires nested type 'Ty'; do you want to add it?}}
associatedtype Ty // expected-note 3{{protocol requires nested type 'Ty'; add nested type 'Ty' for conformance}}
}
class SomeGuy: HasType { // expected-error {{type 'SomeGuy' does not conform to protocol 'HasType'}}

View File

@@ -641,7 +641,7 @@ struct MyView {
}
@TupleBuilder var emptySwitch: some P {
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?}}
switch Optional.some(1) { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; add a default case}}
}
}

View File

@@ -2,7 +2,7 @@
// RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s
protocol Fooable {
associatedtype Foo // expected-note{{protocol requires nested type 'Foo'; do you want to add it?}}
associatedtype Foo // expected-note{{protocol requires nested type 'Foo'; add nested type 'Foo' for conformance}}
var foo: Foo { get }
}

View File

@@ -22,7 +22,7 @@ struct ConcreteConforms2: Conforms { typealias T = Int }
struct ConcreteConformsNonFoo2: Conforms { typealias T = Float }
protocol NestedConforms {
associatedtype U where U: Conforms, U.T: Foo2 // expected-note{{protocol requires nested type 'U'; do you want to add it?}}
associatedtype U where U: Conforms, U.T: Foo2 // expected-note{{protocol requires nested type 'U'; add nested type 'U' for conformance}}
func foo(_: U)
}
@@ -62,7 +62,7 @@ func needsNestedConformsDefault<X: NestedConformsDefault>(_: X.Type) {
}
protocol NestedSameType {
associatedtype U: Conforms where U.T == Int // expected-note{{protocol requires nested type 'U'; do you want to add it?}}
associatedtype U: Conforms where U.T == Int // expected-note{{protocol requires nested type 'U'; add nested type 'U' for conformance}}
func foo(_: U)
}

View File

@@ -2,7 +2,7 @@
protocol P {
associatedtype A
// expected-note@-1 5{{protocol requires nested type 'A'; do you want to add it?}}
// expected-note@-1 5{{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
struct S1<T> {}

View File

@@ -137,7 +137,7 @@ func foo(x: E, intVal: Int) {
}
// Empty check.
switch intVal { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; do you want to add a default case?}}
switch intVal { // expected-error {{'switch' statement body must have at least one 'case' or 'default' block; add a default case}}
#if NEVER
case 1:
break

View File

@@ -56,7 +56,7 @@ case _: // expected-warning {{case is already handled by previous patterns; cons
var e : Any = 0
switch e { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch e { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
// 'is' pattern.
case is Int,
is A<Int>,

View File

@@ -68,7 +68,7 @@ case (inout a, inout a): // expected-error {{invalid redeclaration of 'a'}}
var e : Any = 0
switch e { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch e { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
// 'is' pattern.
case is Int,
is A<Int>,

View File

@@ -71,7 +71,7 @@ default:
}
// Multiple cases per case block
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
case 0: // expected-error {{'case' label in a 'switch' must have at least one executable statement}} {{8-8= break}}
case 1:
x = 0
@@ -83,7 +83,7 @@ default:
x = 0
}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
case 0:
x = 0
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:
default: // expected-error {{'default' label in a 'switch' must have at least one executable statement}} {{9-9= break}}
}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
case 0:
; // expected-error {{';' statements are not allowed}} {{3-5=}}
case 1:
@@ -142,22 +142,22 @@ default: // expected-error{{additional 'case' blocks cannot appear after the 'de
x = 0
}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
default where x == 0: // expected-error{{'default' cannot be used with a 'where' guard expression}}
x = 0
}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
case 0: // expected-error {{'case' label in a 'switch' must have at least one executable statement}} {{8-8= break}}
}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
case 0: // expected-error{{'case' label in a 'switch' must have at least one executable statement}} {{8-8= break}}
case 1:
x = 0
}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
switch x { // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
case 0:
x = 0
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) {
}
func test_label(x : Int) {
Gronk: // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
Gronk: // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
switch x {
case 42: return
}
@@ -637,7 +637,7 @@ func testReturnBeforeIncompleteUnknownDefault() {
}
func testReturnBeforeIncompleteUnknownDefault2() {
switch x { // expected-error {{switch must be exhaustive}} expected-note {{do you want to add a default clause?}}
switch x { // expected-error {{switch must be exhaustive}} expected-note {{add a default clause}}
case 1:
return
@unknown // expected-error {{unknown attribute 'unknown'}}

View File

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

View File

@@ -114,7 +114,7 @@ class Sub : Container {
protocol VeryImportantProto {
associatedtype Assoc
var value: Int { get set } // expected-note {{protocol requires property 'value' with type 'Int'; do you want to add a stub?}}
var value: Int { get set } // expected-note {{protocol requires property 'value' with type 'Int'; add a stub for conformance}}
}
private struct VIPPrivateType : VeryImportantProto {

View File

@@ -1,7 +1,7 @@
// RUN: %target-typecheck-verify-swift
protocol P0 {
// expected-note @+1 {{protocol requires function 'callAsFunction()' with type '() -> Missing'; do you want to add a stub?}}
// expected-note @+1 {{protocol requires function 'callAsFunction()' with type '() -> Missing'; add a stub for conformance}}
func callAsFunction() -> Self
}
func testProtocol(_ x: P0) {

View File

@@ -71,7 +71,7 @@ struct SomeStruct<A> {
// <rdar://problem/27680407> Infinite recursion when using fully-qualified associatedtype name that has not been defined with typealias
protocol rdar27680407Proto {
associatedtype T // expected-note {{protocol requires nested type 'T'; do you want to add it?}}
associatedtype T // expected-note {{protocol requires nested type 'T'; add nested type 'T' for conformance}}
init(value: T)
}

View File

@@ -42,7 +42,7 @@ func main_member(_ u: Utils, _ i: Int, _ d: Double, _ s: String) {
}
protocol ConstFan {
static _const var v: String { get } // expected-note {{protocol requires property 'v' with type 'String'; do you want to add a stub?}}
static _const var v: String { get } // expected-note {{protocol requires property 'v' with type 'String'; add a stub for conformance}}
}
class ConstFanClass1: ConstFan { // expected-error {{type 'ConstFanClass1' does not conform to protocol 'ConstFan'}}

View File

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

View File

@@ -6,16 +6,16 @@ import Types
extension GenericEnum: Equatable { }
// expected-error@-1 {{extension outside of file declaring generic enum 'GenericEnum' prevents automatic synthesis of '==' for protocol 'Equatable'}}
// 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}}
// expected-note@-2 {{add stubs for conformance}}{{35-35=\n public static func == (lhs: GenericEnum, rhs: GenericEnum) -> Bool {\n <#code#>\n \}\n}}
extension Struct: Equatable { }
// expected-error@-1 {{extension outside of file declaring struct 'Struct' prevents automatic synthesis of '==' for protocol 'Equatable'}}
// 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}}
// expected-note@-2 {{add stubs for conformance}}{{30-30=\n public static func == (lhs: Struct, rhs: Struct) -> Bool {\n <#code#>\n \}\n}}
extension GenericStruct: Equatable { }
// expected-error@-1 {{extension outside of file declaring generic struct 'GenericStruct' prevents automatic synthesis of '==' for protocol 'Equatable'}}
// 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}}
// expected-note@-2 {{add stubs for conformance}}{{37-37=\n public static func == (lhs: GenericStruct, rhs: GenericStruct) -> Bool {\n <#code#>\n \}\n}}
extension Enum: CaseIterable { }
// expected-error@-1 {{extension outside of file declaring enum 'Enum' prevents automatic synthesis of 'allCases' for protocol 'CaseIterable'}}
// expected-note@-2 {{do you want to add protocol stubs?}}{{31-31=\n public static var allCases: [Enum]\n}}
// expected-note@-2 {{add stubs for conformance}}{{31-31=\n public static var allCases: [Enum]\n}}

View File

@@ -1,7 +1,7 @@
// RUN: %target-typecheck-verify-swift
protocol P {
subscript<Value>(x: Value) -> Int { // expected-note {{protocol requires subscript with type '<Value> (Value) -> Int'; do you want to add a stub?}}
subscript<Value>(x: Value) -> Int { // expected-note {{protocol requires subscript with type '<Value> (Value) -> Int'; add a stub for conformance}}
get
}
}

View File

@@ -125,7 +125,7 @@ func tryToCastIt(_ fd: borrowing FileDescriptor) {
}
protocol GiveSendable<T> {
associatedtype T: Sendable // expected-note {{protocol requires nested type 'T'; do you want to add it?}}
associatedtype T: Sendable // expected-note {{protocol requires nested type 'T'; add nested type 'T' for conformance}}
func give() -> T
}

View File

@@ -9,4 +9,4 @@ class C1: P1, P2 {}
// RUN: %sourcekitd-test -req=sema %s -- %s | %FileCheck %s
// CHECK: key.description: "type 'C1' does not conform to protocol 'P1'"
// CHECK: key.description: "type 'C1' does not conform to protocol 'P2'"
// CHECK: key.description: "do you want to add protocol stubs?"
// CHECK: key.description: "add stubs for conformance"

View File

@@ -1,7 +1,7 @@
// RUN: %target-typecheck-verify-swift
protocol NeedsF0 {
func f0() // expected-note {{protocol requires function 'f0()' with type '() -> ()'; do you want to add a stub?}}
func f0() // expected-note {{protocol requires function 'f0()' with type '() -> ()'; add a stub for conformance}}
}
struct S0 : NeedsF0 { // expected-error {{type 'S0' does not conform to protocol 'NeedsF0'}}

View File

@@ -157,10 +157,10 @@ takesEmpty(EmptyWitness())
// Note: the SimpleThrowsClosure protocol is not @rethrows
protocol SimpleThrowsClosure {
func doIt(_: () throws -> ()) rethrows
// expected-note@-1 {{protocol requires function 'doIt' with type '(() throws -> ()) throws -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'doIt' with type '(() throws -> ()) throws -> ()'; add a stub for conformance}}
func doIt2<T : Empty>(_: T) rethrows
// expected-note@-1 {{protocol requires function 'doIt2' with type '<T> (T) throws -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'doIt2' with type '<T> (T) throws -> ()'; add a stub for conformance}}
}
struct ConformsToSimpleThrowsClosure<T : RethrowingProtocol> : SimpleThrowsClosure {
@@ -239,4 +239,4 @@ enum HorseError : Error {
func hasRethrowsConformanceAndThrowsBody<T : Empty>(_: T) rethrows {
throw HorseError.bolted
// expected-error@-1 {{a function declared 'rethrows' may only throw if its parameter does}}
}
}

View File

@@ -60,7 +60,7 @@ extension SIMD3 where SIMD3.Scalar == Float {
// Test case with circular overrides
protocol P {
associatedtype A
// expected-note@-1 {{protocol requires nested type 'A'; do you want to add it?}}
// expected-note@-1 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
func run(a: A)
}

View File

@@ -25,7 +25,7 @@ class Sub: Super {
// Witness checking
protocol P1 {
func g() // expected-note{{protocol requires function 'g()' with type '() -> ()'; do you want to add a stub?}}
func g() // expected-note{{protocol requires function 'g()' with type '() -> ()'; add a stub for conformance}}
}
struct ConformsToP1: P1 { // expected-error{{type 'ConformsToP1' does not conform to protocol 'P1'}}

View File

@@ -1,7 +1,7 @@
// RUN: %target-typecheck-verify-swift -swift-version 5
protocol P1 {
static func `init`(_: Int) // expected-note {{protocol requires function 'init' with type '(Int) -> ()'; do you want to add a stub?}}
static func `init`(_: Int) // expected-note {{protocol requires function 'init' with type '(Int) -> ()'; add a stub for conformance}}
// expected-note@-1 {{did you mean 'init'?}}
}
@@ -14,7 +14,7 @@ struct S12 : P1 { // expected-error {{type 'S12' does not conform to protocol 'P
}
protocol P2 {
init(_: Int) // expected-note {{protocol requires initializer 'init(_:)' with type 'Int'; do you want to add a stub?}}
init(_: Int) // expected-note {{protocol requires initializer 'init(_:)' with type 'Int'; add a stub for conformance}}
}
struct S21 : P2 { // expected-error {{type 'S21' does not conform to protocol 'P2'}}

View File

@@ -5,12 +5,12 @@ func assertTypeWitnessForP2_A<T: P2, U>(in: T.Type, is: U.Type) where T.A == U {
protocol P1 {
associatedtype A
// expected-note@-1 2 {{protocol requires nested type 'A'; do you want to add it?}}
// expected-note@-1 2 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
// expected-note@-2 2 {{multiple matching types named 'A'}}
}
protocol P2: P1 {
associatedtype A
// expected-note@-1 2 {{protocol requires nested type 'A'; do you want to add it?}}
// expected-note@-1 2 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
// expected-note@-2 2 {{multiple matching types named 'A'}}
}

View File

@@ -22,7 +22,7 @@ fileprivate protocol R : Q {
private protocol S : R {
func privateRequirement()
func privateRequirementCannotWork()
// expected-note@-1 {{protocol requires function 'privateRequirementCannotWork()' with type '() -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'privateRequirementCannotWork()' with type '() -> ()'; add a stub for conformance}}
}
extension S {
@@ -48,7 +48,7 @@ fileprivate protocol Rpkg : Qpkg {
private protocol Spkg : Rpkg {
func privateRequirement()
func privateRequirementCannotWork()
// expected-note@-1 {{protocol requires function 'privateRequirementCannotWork()' with type '() -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'privateRequirementCannotWork()' with type '() -> ()'; add a stub for conformance}}
}
extension Spkg {

View File

@@ -3,8 +3,8 @@
class C { }
protocol P {
associatedtype AssocP : C // expected-note{{protocol requires nested type 'AssocP'; do you want to add it?}}
associatedtype AssocA : AnyObject // expected-note{{protocol requires nested type 'AssocA'; do you want to add it?}}
associatedtype AssocP : C // expected-note{{protocol requires nested type 'AssocP'; add nested type 'AssocP' for conformance}}
associatedtype AssocA : AnyObject // expected-note{{protocol requires nested type 'AssocA'; add nested type 'AssocA' for conformance}}
}
struct X : P { // expected-error{{type 'X' does not conform to protocol 'P'}}
@@ -78,9 +78,9 @@ struct X1d : P1 {
}
protocol P2 {
func f(_: (Int) -> Int) // expected-note{{expected sendability to match requirement here}} expected-note 2{{protocol requires function 'f' with type '((Int) -> Int) -> ()'; do you want to add a stub?}}
func f(_: (Int) -> Int) // expected-note{{expected sendability to match requirement here}} expected-note 2{{protocol requires function 'f' with type '((Int) -> Int) -> ()'; add a stub for conformance}}
func g(_: @escaping (Int) -> Int) // expected-note 2 {{expected sendability to match requirement here}}
func h(_: @Sendable (Int) -> Int) // expected-note 2 {{protocol requires function 'h' with type '(@Sendable (Int) -> Int) -> ()'; do you want to add a stub?}}
func h(_: @Sendable (Int) -> Int) // expected-note 2 {{protocol requires function 'h' with type '(@Sendable (Int) -> Int) -> ()'; add a stub for conformance}}
func i(_: @escaping @Sendable (Int) -> Int)
}
@@ -139,7 +139,7 @@ struct S3b: P3b {
// FIXME: resolveTypeWitnessViaLookup must not happen independently in the
// general case.
protocol P4 {
associatedtype A: GenClass<B> // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A: GenClass<B> // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B
}
struct S4: P4 { // expected-error {{type 'S4' does not conform to protocol 'P4'}}

View File

@@ -4,7 +4,7 @@
// not crash.
protocol P {
var x: Int { get set } // expected-note {{protocol requires property 'x' with type 'Int'; do you want to add a stub?}}
var x: Int { get set } // expected-note {{protocol requires property 'x' with type 'Int'; add a stub for conformance}}
}
struct S : P { // expected-error {{type 'S' does not conform to protocol 'P'}}

View File

@@ -75,7 +75,7 @@ struct P5Conformer : P5 { // expected-error {{does not conform}}
protocol P6Base {
associatedtype Foo // expected-note{{protocol requires nested type 'Foo'; do you want to add it?}}
associatedtype Foo // expected-note{{protocol requires nested type 'Foo'; add nested type 'Foo' for conformance}}
func foo()
func bar() -> Foo
}
@@ -103,7 +103,7 @@ struct A: OptionSet {
// Type witness cannot have its own generic parameters
// FIXME: Crappy diagnostic
protocol PA {
associatedtype A // expected-note 3 {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note 3 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
struct BadCase1 : PA { // expected-error {{type 'BadCase1' does not conform to protocol 'PA'}}
@@ -135,17 +135,17 @@ let diagnose: UInt32 = "reta"
// Test that we attempt to resolve a value witness unless mapping its interface
// type into the conformance context produces an invalid type.
protocol P7 {
associatedtype A: Sequence // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A: Sequence // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
subscript(subscript1 _: A) -> Never { get }
subscript<T>(subscript2 _: T) -> Never where T: Sequence, T.Element == A { get }
// expected-note@-1 {{protocol requires subscript with type '<T> (subscript2: T) -> Never'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires subscript with type '<T> (subscript2: T) -> Never'; add a stub for conformance}}
func method1(_: A)
func method2() -> A.Element
func method3<T>(_: T) where T: Sequence, T.Element == A
// expected-note@-1 {{protocol requires function 'method3' with type '<T> (T) -> ()'; do you want to add a stub?}}
func method4(_: Never) // expected-note {{protocol requires function 'method4' with type '(Never) -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'method3' with type '<T> (T) -> ()'; add a stub for conformance}}
func method4(_: Never) // expected-note {{protocol requires function 'method4' with type '(Never) -> ()'; add a stub for conformance}}
}
do {
struct Conformer: P7 {} // expected-error {{type 'Conformer' does not conform to protocol 'P7'}}
@@ -154,11 +154,11 @@ do {
protocol P8 {
associatedtype A: Sequence where A.Element == Never
func method1(_: A) // expected-note {{protocol requires function 'method1' with type '(Conformer.A) -> ()' (aka '(Array<Bool>) -> ()'); do you want to add a stub?}}
func method2() -> A.Element // expected-note {{protocol requires function 'method2()' with type '() -> Bool'; do you want to add a stub?}}
func method1(_: A) // expected-note {{protocol requires function 'method1' with type '(Conformer.A) -> ()' (aka '(Array<Bool>) -> ()'); add a stub for conformance}}
func method2() -> A.Element // expected-note {{protocol requires function 'method2()' with type '() -> Bool'; add a stub for conformance}}
func method3<T>(_: T) where T: Sequence, T.Element == A
// expected-note@-1 {{protocol requires function 'method3' with type '<T> (T) -> ()'; do you want to add a stub?}}
func method4(_: Never) // expected-note {{protocol requires function 'method4' with type '(Never) -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'method3' with type '<T> (T) -> ()'; add a stub for conformance}}
func method4(_: Never) // expected-note {{protocol requires function 'method4' with type '(Never) -> ()'; add a stub for conformance}}
}
do {
struct Conformer: P8 {
@@ -175,13 +175,13 @@ protocol P9a {
protocol P9b: P9a where A: Sequence {
subscript(subscript1 _: A.Element) -> Never { get }
subscript<T>(subscript2 _: T) -> Never where T: Sequence, T.Element == A.Element { get }
// expected-note@-1 {{protocol requires subscript with type '<T> (subscript2: T) -> Never'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires subscript with type '<T> (subscript2: T) -> Never'; add a stub for conformance}}
func method1(_: A) // expected-note {{protocol requires function 'method1' with type '(Conformer.A) -> ()' (aka '(Bool) -> ()'); do you want to add a stub?}}
func method1(_: A) // expected-note {{protocol requires function 'method1' with type '(Conformer.A) -> ()' (aka '(Bool) -> ()'); add a stub for conformance}}
func method2() -> A.Element
func method3<T>(_: T) where T: Sequence, T.Element == A
// expected-note@-1 {{protocol requires function 'method3' with type '<T> (T) -> ()'; do you want to add a stub?}}
func method4(_: Never) // expected-note {{protocol requires function 'method4' with type '(Never) -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'method3' with type '<T> (T) -> ()'; add a stub for conformance}}
func method4(_: Never) // expected-note {{protocol requires function 'method4' with type '(Never) -> ()'; add a stub for conformance}}
}
do {
struct Conformer: P9b {
@@ -195,11 +195,11 @@ protocol P10a {
associatedtype A
}
protocol P10b: P10a where A: Sequence, A.Element == Never {
func method1(_: A) // expected-note {{protocol requires function 'method1' with type '(Conformer.A) -> ()' (aka '(Array<Bool>) -> ()'); do you want to add a stub?}}
func method2() -> A.Element // expected-note {{protocol requires function 'method2()' with type '() -> Bool'; do you want to add a stub?}}
func method1(_: A) // expected-note {{protocol requires function 'method1' with type '(Conformer.A) -> ()' (aka '(Array<Bool>) -> ()'); add a stub for conformance}}
func method2() -> A.Element // expected-note {{protocol requires function 'method2()' with type '() -> Bool'; add a stub for conformance}}
func method3<T>(_: T) where T: Sequence, T.Element == A
// expected-note@-1 {{protocol requires function 'method3' with type '<T> (T) -> ()'; do you want to add a stub?}}
func method4(_: Never) // expected-note {{protocol requires function 'method4' with type '(Never) -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'method3' with type '<T> (T) -> ()'; add a stub for conformance}}
func method4(_: Never) // expected-note {{protocol requires function 'method4' with type '(Never) -> ()'; add a stub for conformance}}
}
do {
struct Conformer: P10b {
@@ -214,7 +214,7 @@ protocol P11 {
associatedtype A: Equatable
// FIXME: Should not resolve witness for 'method', but Type::subst doesn't care
// about conditional requirements when querying type witnesses.
// expected-note@+1 {{protocol requires function 'method()' with type '() -> Conformer.A' (aka '() -> Array<any P11>'); do you want to add a stub?}}
// expected-note@+1 {{protocol requires function 'method()' with type '() -> Conformer.A' (aka '() -> Array<any P11>'); add a stub for conformance}}
func method() -> A
}
do {
@@ -229,7 +229,7 @@ do {
}
protocol P12 {
associatedtype A: Sequence where A.Element == Never // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A: Sequence where A.Element == Never // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
// FIXME: Should not resolve witness for 'prop', but getInterfaceType() returns
// '(Self) -> Never' instead of '(Self) -> Self.A.Element', and the invalid
// type parameter is never found (see 'hasInvalidTypeInConformanceContext').
@@ -239,7 +239,7 @@ protocol P12 {
// Instead, patterns should be refactored to use interface types, at least if
// they appear in type contexts.
//
// expected-note@+1 {{protocol requires property 'prop' with type '(Conformer) -> Never'; do you want to add a stub?}}
// expected-note@+1 {{protocol requires property 'prop' with type '(Conformer) -> Never'; add a stub for conformance}}
var prop: (Self) -> A.Element { get }
}
do {

View File

@@ -1,14 +1,14 @@
// RUN: %target-typecheck-verify-swift
protocol Protocol1 {
func foo(arg1: Int, arg2: String) -> String // expected-note{{protocol requires function 'foo(arg1:arg2:)' with type '(Int, String) -> String'; do you want to add a stub?}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
func bar() throws -> String // expected-note{{protocol requires function 'bar()' with type '() throws -> String'; do you want to add a stub?}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
func generic<T>(t: T) // expected-note{{protocol requires function 'generic(t:)' with type '<T> (t: T) -> ()'; do you want to add a stub?}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
var baz: Int { get } // expected-note{{protocol requires property 'baz' with type 'Int'; do you want to add a stub?}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
var baz2: Int { get set } // expected-note{{protocol requires property 'baz2' with type 'Int'; do you want to add a stub?}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
subscript(arg: Int) -> String { get } //expected-note{{rotocol requires subscript with type '(Int) -> String'; do you want to add a stub?}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
subscript(arg1: Int, arg2: Int) -> String { get set } //expected-note{{protocol requires subscript with type '(Int, Int) -> String'; do you want to add a stub?}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
func foo(arg1: Int, arg2: String) -> String // expected-note{{protocol requires function 'foo(arg1:arg2:)' with type '(Int, String) -> String'; add a stub for conformance}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
func bar() throws -> String // expected-note{{protocol requires function 'bar()' with type '() throws -> String'; add a stub for conformance}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
func generic<T>(t: T) // expected-note{{protocol requires function 'generic(t:)' with type '<T> (t: T) -> ()'; add a stub for conformance}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; add a stub for conformance}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
var baz: Int { get } // expected-note{{protocol requires property 'baz' with type 'Int'; add a stub for conformance}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
var baz2: Int { get set } // expected-note{{protocol requires property 'baz2' with type 'Int'; add a stub for conformance}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
subscript(arg: Int) -> String { get } //expected-note{{rotocol requires subscript with type '(Int) -> String'; add a stub for conformance}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
subscript(arg1: Int, arg2: Int) -> String { get set } //expected-note{{protocol requires subscript with type '(Int, Int) -> String'; add a stub for conformance}} {{14:27-27=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n func generic<T>(t: T) {\n <#code#>\n \}\n\n required init(arg: Int) {\n <#code#>\n \}\n\n var baz: Int\n\n var baz2: Int\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
}
class Adopter: Protocol1 { // expected-error{{type 'Adopter' does not conform to protocol 'Protocol1'}}
@@ -17,13 +17,13 @@ class Adopter: Protocol1 { // expected-error{{type 'Adopter' does not conform to
protocol Protocol2 {
func foo(arg1: Int, arg2: String) -> String // expected-note{{protocol requires function 'foo(arg1:arg2:)' with type '(Int, String) -> String'; do you want to add a stub?}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
func bar() throws -> String // expected-note{{protocol requires function 'bar()' with type '() throws -> String'; do you want to add a stub?}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
func foo(arg1: Int, arg2: String) -> String // expected-note{{protocol requires function 'foo(arg1:arg2:)' with type '(Int, String) -> String'; add a stub for conformance}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
func bar() throws -> String // expected-note{{protocol requires function 'bar()' with type '() throws -> String'; add a stub for conformance}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'}} {{none}}
var baz: Int { get } // expected-note{{protocol requires property 'baz' with type 'Int'; do you want to add a stub?}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
var baz2: Int { get set } // expected-note{{protocol requires property 'baz2' with type 'Int'; do you want to add a stub?}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
subscript(arg: Int) -> String { get } //expected-note{{rotocol requires subscript with type '(Int) -> String'; do you want to add a stub?}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
subscript(arg1: Int, arg2: Int) -> String { get set } //expected-note{{protocol requires subscript with type '(Int, Int) -> String'; do you want to add a stub?}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
var baz: Int { get } // expected-note{{protocol requires property 'baz' with type 'Int'; add a stub for conformance}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
var baz2: Int { get set } // expected-note{{protocol requires property 'baz2' with type 'Int'; add a stub for conformance}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
subscript(arg: Int) -> String { get } //expected-note{{rotocol requires subscript with type '(Int) -> String'; add a stub for conformance}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
subscript(arg1: Int, arg2: Int) -> String { get set } //expected-note{{protocol requires subscript with type '(Int, Int) -> String'; add a stub for conformance}} {{31:32-32=\n func foo(arg1: Int, arg2: String) -> String {\n <#code#>\n \}\n\n func bar() throws -> String {\n <#code#>\n \}\n\n var baz: Int {\n <#code#>\n \}\n\n var baz2: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n subscript(arg: Int) -> String {\n <#code#>\n \}\n\n subscript(arg1: Int, arg2: Int) -> String {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
}
class Adopter2 {}
@@ -42,7 +42,7 @@ struct Adopter3: ProtocolWithAssocType { //expected-error{{type 'Adopter3' does
protocol ProtocolWithAssocType2 {
associatedtype AssocType //expected-note{{protocol requires nested type 'AssocType'; do you want to add it?}} {{+4:45-45=\n typealias AssocType = <#type#>\n}}
associatedtype AssocType //expected-note{{protocol requires nested type 'AssocType'; add nested type 'AssocType' for conformance}} {{+4:45-45=\n typealias AssocType = <#type#>\n}}
}
struct Adopter4 {
}
@@ -52,8 +52,8 @@ extension Adopter4: ProtocolWithAssocType2 { //expected-error{{type 'Adopter4' d
protocol ProtocolWithSelfRequirement {
func foo() -> Self // expected-note{{protocol requires function 'foo()' with type '() -> Adopter5'; do you want to add a stub?}} {{+3:47-47=\n func foo() -> Adopter5 {\n <#code#>\n \}\n\n func foo(lhs: Adopter5, rhs: Adopter5) -> Adopter5 {\n <#code#>\n \}\n}}
func foo(lhs: Self, rhs: Self) -> Self //expected-note{{protocol requires function 'foo(lhs:rhs:)' with type '(Adopter5, Adopter5) -> Adopter5'; do you want to add a stub?}} {{+2:47-47=\n func foo() -> Adopter5 {\n <#code#>\n \}\n\n func foo(lhs: Adopter5, rhs: Adopter5) -> Adopter5 {\n <#code#>\n \}\n}}
func foo() -> Self // expected-note{{protocol requires function 'foo()' with type '() -> Adopter5'; add a stub for conformance}} {{+3:47-47=\n func foo() -> Adopter5 {\n <#code#>\n \}\n\n func foo(lhs: Adopter5, rhs: Adopter5) -> Adopter5 {\n <#code#>\n \}\n}}
func foo(lhs: Self, rhs: Self) -> Self //expected-note{{protocol requires function 'foo(lhs:rhs:)' with type '(Adopter5, Adopter5) -> Adopter5'; add a stub for conformance}} {{+2:47-47=\n func foo() -> Adopter5 {\n <#code#>\n \}\n\n func foo(lhs: Adopter5, rhs: Adopter5) -> Adopter5 {\n <#code#>\n \}\n}}
}
struct Adopter5: ProtocolWithSelfRequirement { //expected-error{{type 'Adopter5' does not conform to protocol 'ProtocolWithSelfRequirement'}}
}
@@ -61,8 +61,8 @@ struct Adopter5: ProtocolWithSelfRequirement { //expected-error{{type 'Adopter5'
protocol ProtocolWithSelfRequirement2 {
func foo() -> Self // expected-note{{protocol requires function 'foo()' with type '() -> Adopter6'; do you want to add a stub?}} {{+4:51-51=\n func foo() -> Adopter6 {\n <#code#>\n \}\n\n func foo(lhs: Adopter6, rhs: Adopter6) -> Adopter6 {\n <#code#>\n \}\n}}
func foo(lhs: Self, rhs: Self) -> Self //expected-note{{protocol requires function 'foo(lhs:rhs:)' with type '(Adopter6, Adopter6) -> Adopter6'; do you want to add a stub?}} {{+3:51-51=\n func foo() -> Adopter6 {\n <#code#>\n \}\n\n func foo(lhs: Adopter6, rhs: Adopter6) -> Adopter6 {\n <#code#>\n \}\n}}
func foo() -> Self // expected-note{{protocol requires function 'foo()' with type '() -> Adopter6'; add a stub for conformance}} {{+4:51-51=\n func foo() -> Adopter6 {\n <#code#>\n \}\n\n func foo(lhs: Adopter6, rhs: Adopter6) -> Adopter6 {\n <#code#>\n \}\n}}
func foo(lhs: Self, rhs: Self) -> Self //expected-note{{protocol requires function 'foo(lhs:rhs:)' with type '(Adopter6, Adopter6) -> Adopter6'; add a stub for conformance}} {{+3:51-51=\n func foo() -> Adopter6 {\n <#code#>\n \}\n\n func foo(lhs: Adopter6, rhs: Adopter6) -> Adopter6 {\n <#code#>\n \}\n}}
}
struct Adopter6 {}
extension Adopter6: ProtocolWithSelfRequirement2 { //expected-error{{type 'Adopter6' does not conform to protocol 'ProtocolWithSelfRequirement2'}}
@@ -70,15 +70,15 @@ extension Adopter6: ProtocolWithSelfRequirement2 { //expected-error{{type 'Adopt
protocol ProtocolWithSelfRequirement3 {
func foo() -> Self // expected-note{{protocol requires function 'foo()' with type '() -> Self'; do you want to add a stub?}} {{+3:47-47=\n func foo() -> Self {\n <#code#>\n \}\n\n func foo(lhs: Adopter7, rhs: Adopter7) -> Self {\n <#code#>\n \}\n}}
func foo(lhs: Self, rhs: Self) -> Self //expected-note{{protocol requires function 'foo(lhs:rhs:)' with type '(Adopter7, Adopter7) -> Self'; do you want to add a stub?}} {{+2:47-47=\n func foo() -> Self {\n <#code#>\n \}\n\n func foo(lhs: Adopter7, rhs: Adopter7) -> Self {\n <#code#>\n \}\n}}
func foo() -> Self // expected-note{{protocol requires function 'foo()' with type '() -> Self'; add a stub for conformance}} {{+3:47-47=\n func foo() -> Self {\n <#code#>\n \}\n\n func foo(lhs: Adopter7, rhs: Adopter7) -> Self {\n <#code#>\n \}\n}}
func foo(lhs: Self, rhs: Self) -> Self //expected-note{{protocol requires function 'foo(lhs:rhs:)' with type '(Adopter7, Adopter7) -> Self'; add a stub for conformance}} {{+2:47-47=\n func foo() -> Self {\n <#code#>\n \}\n\n func foo(lhs: Adopter7, rhs: Adopter7) -> Self {\n <#code#>\n \}\n}}
}
class Adopter7: ProtocolWithSelfRequirement3 { //expected-error{{type 'Adopter7' does not conform to protocol 'ProtocolWithSelfRequirement3'}}
}
public protocol ProtocolWithPublicAccess1 {
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}} {{+5:71-71=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; add a stub for conformance}} {{+5:71-71=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
}
public protocol ProtocolWithPublicAccess2 {
associatedtype AssocType //expected-note{{protocol requires nested type 'AssocType'}} {{+2:71-71=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
@@ -89,7 +89,7 @@ class Adopter8: ProtocolWithPublicAccess1, ProtocolWithPublicAccess2 {
}
public protocol ProtocolWithPublicAccess3 {
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}} {{+5:78-78=\n public func foo() {\n <#code#>\n \}\n\n public typealias AssocType = <#type#>\n}}
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; add a stub for conformance}} {{+5:78-78=\n public func foo() {\n <#code#>\n \}\n\n public typealias AssocType = <#type#>\n}}
}
public protocol ProtocolWithPublicAccess4 {
associatedtype AssocType //expected-note{{protocol requires nested type 'AssocType'}} {{+2:78-78=\n public func foo() {\n <#code#>\n \}\n\n public typealias AssocType = <#type#>\n}}
@@ -100,7 +100,7 @@ public class Adopter9: ProtocolWithPublicAccess3, ProtocolWithPublicAccess4 {
}
private protocol ProtocolWithPrivateAccess1 {
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}} {{+5:74-74=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; add a stub for conformance}} {{+5:74-74=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
}
private protocol ProtocolWithPrivateAccess2 {
associatedtype AssocType //expected-note{{protocol requires nested type 'AssocType'}} {{+2:74-74=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
@@ -111,7 +111,7 @@ class Adopter10: ProtocolWithPrivateAccess1, ProtocolWithPrivateAccess2 {
}
private protocol ProtocolWithPrivateAccess3 {
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}} {{+5:81-81=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; add a stub for conformance}} {{+5:81-81=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
}
private protocol ProtocolWithPrivateAccess4 {
associatedtype AssocType //expected-note{{protocol requires nested type 'AssocType'}} {{+2:81-81=\n func foo() {\n <#code#>\n \}\n\n typealias AssocType = <#type#>\n}}
@@ -122,57 +122,57 @@ public class Adopter11: ProtocolWithPrivateAccess3, ProtocolWithPrivateAccess4 {
}
protocol ProtocolRequiresInit1 {
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{+2:48-48=\n init(arg: Int) {\n <#code#>\n \}\n}}
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; add a stub for conformance}} {{+2:48-48=\n init(arg: Int) {\n <#code#>\n \}\n}}
}
final class Adopter12 : ProtocolRequiresInit1 {} //expected-error {{type 'Adopter12' does not conform to protocol 'ProtocolRequiresInit1'}}
protocol ProtocolRequiresInit2 {
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{+3:46-46=\n convenience init(arg: Int) {\n <#code#>\n \}\n}}
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; add a stub for conformance}} {{+3:46-46=\n convenience init(arg: Int) {\n <#code#>\n \}\n}}
}
final class Adopter13 {}
extension Adopter13 : ProtocolRequiresInit2 {} //expected-error {{type 'Adopter13' does not conform to protocol 'ProtocolRequiresInit2'}}
protocol ProtocolRequiresInit3 {
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; do you want to add a stub?}} {{+3:46-46=\n init(arg: Int) {\n <#code#>\n \}\n}}
init(arg: Int) // expected-note{{protocol requires initializer 'init(arg:)' with type '(arg: Int)'; add a stub for conformance}} {{+3:46-46=\n init(arg: Int) {\n <#code#>\n \}\n}}
}
struct Adopter14 {}
extension Adopter14 : ProtocolRequiresInit3 {} //expected-error {{type 'Adopter14' does not conform to protocol 'ProtocolRequiresInit3'}}
protocol ProtocolChain1 {
func foo1() // expected-note {{protocol requires function 'foo1()' with type '() -> ()'; do you want to add a stub?}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func foo2() // expected-note {{protocol requires function 'foo2()' with type '() -> ()'; do you want to add a stub?}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func foo3() // expected-note {{protocol requires function 'foo3()' with type '() -> ()'; do you want to add a stub?}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
var foo4 : Int {get set } // expected-note {{protocol requires property 'foo4' with type 'Int'; do you want to add a stub?}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func foo1() // expected-note {{protocol requires function 'foo1()' with type '() -> ()'; add a stub for conformance}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func foo2() // expected-note {{protocol requires function 'foo2()' with type '() -> ()'; add a stub for conformance}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func foo3() // expected-note {{protocol requires function 'foo3()' with type '() -> ()'; add a stub for conformance}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
var foo4 : Int {get set } // expected-note {{protocol requires property 'foo4' with type 'Int'; add a stub for conformance}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
}
protocol ProtocolChain2 : ProtocolChain1 {
func bar1() // expected-note {{protocol requires function 'bar1()' with type '() -> ()'; do you want to add a stub?}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func bar2() // expected-note {{protocol requires function 'bar2()' with type '() -> ()'; do you want to add a stub?}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func bar3() // expected-note {{protocol requires function 'bar3()' with type '() -> ()'; do you want to add a stub?}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
var bar4 : Int {get set } // expected-note {{protocol requires property 'bar4' with type 'Int'; do you want to add a stub?}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func bar1() // expected-note {{protocol requires function 'bar1()' with type '() -> ()'; add a stub for conformance}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func bar2() // expected-note {{protocol requires function 'bar2()' with type '() -> ()'; add a stub for conformance}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
func bar3() // expected-note {{protocol requires function 'bar3()' with type '() -> ()'; add a stub for conformance}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
var bar4 : Int {get set } // expected-note {{protocol requires property 'bar4' with type 'Int'; add a stub for conformance}}{{154:35-35=\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func bar3() {\n <#code#>\n \}\n\n var bar4: Int\n\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3() {\n <#code#>\n \}\n\n var foo4: Int\n}}
}
class Adopter15 : ProtocolChain2 {} //expected-error {{type 'Adopter15' does not conform to protocol 'ProtocolChain2'}} expected-error {{type 'Adopter15' does not conform to protocol 'ProtocolChain1'}}
protocol ProtocolParallel1 {
associatedtype Foo1 // expected-note {{protocol requires nested type 'Foo1'; do you want to add it?}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Foo2 // expected-note {{protocol requires nested type 'Foo2'; do you want to add it?}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Foo3 // expected-note {{protocol requires nested type 'Foo3'; do you want to add it?}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Foo1 // expected-note {{protocol requires nested type 'Foo1'; add nested type 'Foo1' for conformance}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Foo2 // expected-note {{protocol requires nested type 'Foo2'; add nested type 'Foo2' for conformance}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Foo3 // expected-note {{protocol requires nested type 'Foo3'; add nested type 'Foo3' for conformance}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
// FIXME: Why do we add stubs for all missing requirements when the note implies a single one?
func Foo4() // expected-note {{protocol requires function 'Foo4()' with type '() -> ()'; do you want to add a stub?}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
func Foo4() // expected-note {{protocol requires function 'Foo4()' with type '() -> ()'; add a stub for conformance}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
}
protocol ProtocolParallel2 {
associatedtype Bar1 // expected-note {{protocol requires nested type 'Bar1'; do you want to add it?}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Bar2 // expected-note {{protocol requires nested type 'Bar2'; do you want to add it?}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Bar3 // expected-note {{protocol requires nested type 'Bar3'; do you want to add it?}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
func Bar4() // expected-note {{protocol requires function 'Bar4()' with type '() -> ()'; do you want to add a stub?}}{{171:57-57=\n func Bar4() {\n <#code#>\n \}\n}}
associatedtype Bar1 // expected-note {{protocol requires nested type 'Bar1'; add nested type 'Bar1' for conformance}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Bar2 // expected-note {{protocol requires nested type 'Bar2'; add nested type 'Bar2' for conformance}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
associatedtype Bar3 // expected-note {{protocol requires nested type 'Bar3'; add nested type 'Bar3' for conformance}}{{171:57-57=\n typealias Foo1 = <#type#>\n\n typealias Foo2 = <#type#>\n\n typealias Foo3 = <#type#>\n\n func Foo4() {\n <#code#>\n \}\n\n typealias Bar1 = <#type#>\n\n typealias Bar2 = <#type#>\n\n typealias Bar3 = <#type#>\n}}
func Bar4() // expected-note {{protocol requires function 'Bar4()' with type '() -> ()'; add a stub for conformance}}{{171:57-57=\n func Bar4() {\n <#code#>\n \}\n}}
}
class Adopter16 : ProtocolParallel1, ProtocolParallel2 {} // expected-error {{type 'Adopter16' does not conform to protocol 'ProtocolParallel1'}} expected-error {{type 'Adopter16' does not conform to protocol 'ProtocolParallel2'}}
protocol ProtocolParallel3 {
func foo1() // expected-note{{protocol requires function 'foo1()' with type '() -> ()'; do you want to add a stub?}}{{+7:56-56=\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n}}
func foo2() // expected-note{{protocol requires function 'foo2()' with type '() -> ()'; do you want to add a stub?}}{{+6:56-56=\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n}}
func foo1() // expected-note{{protocol requires function 'foo1()' with type '() -> ()'; add a stub for conformance}}{{+7:56-56=\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n}}
func foo2() // expected-note{{protocol requires function 'foo2()' with type '() -> ()'; add a stub for conformance}}{{+6:56-56=\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n}}
}
protocol ProtocolParallel4 {
func bar1()
@@ -184,14 +184,14 @@ class Adopter17: ProtocolParallel3, ProtocolParallel4 { // expected-error {{type
}
protocol ProtocolHasSubscriptFunction {
func `subscript`() // expected-note{{protocol requires function 'subscript()' with type '() -> ()'; do you want to add a stub?}} {{+2:74-74=\n func `subscript`() {\n <#code#>\n \}\n}}
func `subscript`() // expected-note{{protocol requires function 'subscript()' with type '() -> ()'; add a stub for conformance}} {{+2:74-74=\n func `subscript`() {\n <#code#>\n \}\n}}
}
class ProtocolHasSubscriptFunctionAdopter: ProtocolHasSubscriptFunction { // expected-error{{type 'ProtocolHasSubscriptFunctionAdopter' does not conform to protocol 'ProtocolHasSubscriptFunction'}}
}
protocol ProtocolHasConsumingRequirement {
__consuming func foo() // expected-note {{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}} {{+2:81-81=\n func foo() {\n <#code#>\n \}\n}}
__consuming func foo() // expected-note {{protocol requires function 'foo()' with type '() -> ()'; add a stub for conformance}} {{+2:81-81=\n func foo() {\n <#code#>\n \}\n}}
}
struct ProtocolHasConsumingRequirementAdopter: ProtocolHasConsumingRequirement { // expected-error {{type 'ProtocolHasConsumingRequirementAdopter' does not conform to protocol 'ProtocolHasConsumingRequirement'}}

View File

@@ -6,7 +6,7 @@
protocol P0_A { associatedtype T }
protocol P0_B { associatedtype T }
class C0: P0_A, P0_B {} // expected-error{{type 'C0' does not conform to protocol 'P0_A'}} expected-error{{type 'C0' does not conform to protocol 'P0_B'}} expected-note{{do you want to add protocol stubs?}}{{23-23=\n typealias T = <#type#>\n}}
class C0: P0_A, P0_B {} // expected-error{{type 'C0' does not conform to protocol 'P0_A'}} expected-error{{type 'C0' does not conform to protocol 'P0_B'}} expected-note{{add stubs for conformance}}{{23-23=\n typealias T = <#type#>\n}}
protocol P1 {
@available(*, deprecated)
@@ -27,7 +27,7 @@ protocol P2 {
func foo4<T: P2>(_: T)
}
class C1 : P1, P2 {} // expected-error{{type 'C1' does not conform to protocol 'P1'}} expected-error{{type 'C1' does not conform to protocol 'P2'}} expected-note{{do you want to add protocol stubs?}}{{20-20=\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3(arg: Int, arg2: String) {\n <#code#>\n \}\n\n func foo4<T>(_: T) where T : P1 {\n <#code#>\n \}\n\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func foo3(arg: Int, arg2: Int) {\n <#code#>\n \}\n}}
class C1 : P1, P2 {} // expected-error{{type 'C1' does not conform to protocol 'P1'}} expected-error{{type 'C1' does not conform to protocol 'P2'}} expected-note{{add stubs for conformance}}{{20-20=\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func foo3(arg: Int, arg2: String) {\n <#code#>\n \}\n\n func foo4<T>(_: T) where T : P1 {\n <#code#>\n \}\n\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n\n func foo3(arg: Int, arg2: Int) {\n <#code#>\n \}\n}}
protocol P3 {
associatedtype T1
@@ -42,7 +42,7 @@ protocol P4 : P3 {
associatedtype T6 = T3
}
class C2 : P4 {} // expected-error{{type 'C2' does not conform to protocol 'P4'}} expected-error{{type 'C2' does not conform to protocol 'P3'}} expected-note{{do you want to add protocol stubs?}}{{16-16=\n typealias T1 = <#type#>\n\n typealias T2 = <#type#>\n\n typealias T3 = <#type#>\n}}
class C2 : P4 {} // expected-error{{type 'C2' does not conform to protocol 'P4'}} expected-error{{type 'C2' does not conform to protocol 'P3'}} expected-note{{add stubs for conformance}}{{16-16=\n typealias T1 = <#type#>\n\n typealias T2 = <#type#>\n\n typealias T3 = <#type#>\n}}
protocol P5 {
func foo1()
@@ -58,7 +58,7 @@ protocol P6: P5 {
func foo3<T: P4>(_: T)
}
class C3 : P6 {} // expected-error{{type 'C3' does not conform to protocol 'P5'}} expected-error{{type 'C3' does not conform to protocol 'P6'}} expected-note{{do you want to add protocol stubs?}}{{16-16=\n func foo1() {\n <#code#>\n \}\n\n func foo2(arg: Int, arg2: String) {\n <#code#>\n \}\n\n func foo2(arg: Int, arg2: Int) {\n <#code#>\n \}\n\n func foo3<T>(_: T) where T : P3 {\n <#code#>\n \}\n}}
class C3 : P6 {} // expected-error{{type 'C3' does not conform to protocol 'P5'}} expected-error{{type 'C3' does not conform to protocol 'P6'}} expected-note{{add stubs for conformance}}{{16-16=\n func foo1() {\n <#code#>\n \}\n\n func foo2(arg: Int, arg2: String) {\n <#code#>\n \}\n\n func foo2(arg: Int, arg2: Int) {\n <#code#>\n \}\n\n func foo3<T>(_: T) where T : P3 {\n <#code#>\n \}\n}}
// =============================================================================
// Test how we print stubs for mutating and non-mutating requirements.
@@ -73,18 +73,18 @@ protocol MutabilityProto {
subscript() -> Int { get nonmutating set }
}
class Class1: MutabilityProto { // expected-error{{type 'Class1' does not conform to protocol 'MutabilityProto'}} expected-note{{do you want to add protocol stubs?}} {{32-32=\n func foo() {\n <#code#>\n \}\n\n subscript() -> Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
class Class1: MutabilityProto { // expected-error{{type 'Class1' does not conform to protocol 'MutabilityProto'}} expected-note{{add stubs for conformance}} {{32-32=\n func foo() {\n <#code#>\n \}\n\n subscript() -> Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
}
struct Struct1: MutabilityProto { // expected-error{{type 'Struct1' does not conform to protocol 'MutabilityProto'}} expected-note{{do you want to add protocol stubs?}} {{34-34=\n mutating func foo() {\n <#code#>\n \}\n\n subscript() -> Int {\n get {\n <#code#>\n \}\n nonmutating set {\n <#code#>\n \}\n \}\n}}
struct Struct1: MutabilityProto { // expected-error{{type 'Struct1' does not conform to protocol 'MutabilityProto'}} expected-note{{add stubs for conformance}} {{34-34=\n mutating func foo() {\n <#code#>\n \}\n\n subscript() -> Int {\n get {\n <#code#>\n \}\n nonmutating set {\n <#code#>\n \}\n \}\n}}
}
import fixit_stub_mutability_proto_module
class Class2: ExternalMutabilityProto { // expected-error{{type 'Class2' does not conform to protocol 'ExternalMutabilityProto'}} expected-note{{do you want to add protocol stubs?}} {{40-40=\n func foo() {\n <#code#>\n \}\n\n subscript() -> Int {\n get {\n <#code#>\n \}\n set(newValue) {\n <#code#>\n \}\n \}\n}}
class Class2: ExternalMutabilityProto { // expected-error{{type 'Class2' does not conform to protocol 'ExternalMutabilityProto'}} expected-note{{add stubs for conformance}} {{40-40=\n func foo() {\n <#code#>\n \}\n\n subscript() -> Int {\n get {\n <#code#>\n \}\n set(newValue) {\n <#code#>\n \}\n \}\n}}
}
struct Struct2: ExternalMutabilityProto { // expected-error{{type 'Struct2' does not conform to protocol 'ExternalMutabilityProto'}} expected-note{{do you want to add protocol stubs?}} {{42-42=\n mutating func foo() {\n <#code#>\n \}\n\n subscript() -> Int {\n mutating get {\n <#code#>\n \}\n nonmutating set(newValue) {\n <#code#>\n \}\n \}\n}}
struct Struct2: ExternalMutabilityProto { // expected-error{{type 'Struct2' does not conform to protocol 'ExternalMutabilityProto'}} expected-note{{add stubs for conformance}} {{42-42=\n mutating func foo() {\n <#code#>\n \}\n\n subscript() -> Int {\n mutating get {\n <#code#>\n \}\n nonmutating set(newValue) {\n <#code#>\n \}\n \}\n}}
}
protocol PropertyMutabilityProto {
@@ -92,14 +92,14 @@ protocol PropertyMutabilityProto {
var stored: Int { mutating get set }
}
class Class3: PropertyMutabilityProto { // expected-error{{type 'Class3' does not conform to protocol 'PropertyMutabilityProto'}} expected-note{{do you want to add protocol stubs?}} {{40-40=\n var computed: Int\n\n var stored: Int\n}}
class Class3: PropertyMutabilityProto { // expected-error{{type 'Class3' does not conform to protocol 'PropertyMutabilityProto'}} expected-note{{add stubs for conformance}} {{40-40=\n var computed: Int\n\n var stored: Int\n}}
}
struct Struct3: PropertyMutabilityProto { // expected-error{{type 'Struct3' does not conform to protocol 'PropertyMutabilityProto'}} expected-note{{do you want to add protocol stubs?}} {{42-42=\n var computed: Int {\n mutating get {\n <#code#>\n \}\n nonmutating set {\n <#code#>\n \}\n \}\n\n var stored: Int\n}}
struct Struct3: PropertyMutabilityProto { // expected-error{{type 'Struct3' does not conform to protocol 'PropertyMutabilityProto'}} expected-note{{add stubs for conformance}} {{42-42=\n var computed: Int {\n mutating get {\n <#code#>\n \}\n nonmutating set {\n <#code#>\n \}\n \}\n\n var stored: Int\n}}
}
class Class4 {}
extension Class4: PropertyMutabilityProto { // expected-error{{type 'Class4' does not conform to protocol 'PropertyMutabilityProto'}} expected-note{{do you want to add protocol stubs?}} {{44-44=\n var computed: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n var stored: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
extension Class4: PropertyMutabilityProto { // expected-error{{type 'Class4' does not conform to protocol 'PropertyMutabilityProto'}} expected-note{{add stubs for conformance}} {{44-44=\n var computed: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n\n var stored: Int {\n get {\n <#code#>\n \}\n set {\n <#code#>\n \}\n \}\n}}
}
// https://github.com/apple/swift/issues/52274
@@ -109,5 +109,5 @@ protocol FooProto {
func doSomething(then completion: @escaping CompletionType)
}
struct FooType : FooProto { // expected-error {{type 'FooType' does not conform to protocol 'FooProto'}} expected-note {{do you want to add protocol stubs?}} {{28-28=\n func doSomething(then completion: @escaping CompletionType) {\n <#code#>\n \}\n}}
struct FooType : FooProto { // expected-error {{type 'FooType' does not conform to protocol 'FooProto'}} expected-note {{add stubs for conformance}} {{28-28=\n func doSomething(then completion: @escaping CompletionType) {\n <#code#>\n \}\n}}
}

View File

@@ -9,12 +9,12 @@ struct Notification {}
struct MyApp: AmbiguousFuncProtocol {
// expected-error@-1 {{type 'MyApp' does not conform to protocol 'AmbiguousFuncProtocol'}}
// expected-note@-2 {{do you want to add protocol stubs?}} {{38-38=\n func application(received: Ambiguous.Notification) {\n <#code#>\n \}\n}}
// expected-note@-2 {{add stubs for conformance}} {{38-38=\n func application(received: Ambiguous.Notification) {\n <#code#>\n \}\n}}
}
extension MyApp: AmbiguousVarProtocol {
// expected-error@-1 {{type 'MyApp' does not conform to protocol 'AmbiguousVarProtocol'}}
// expected-note@-2 {{do you want to add protocol stubs?}} {{40-40=\n var notification: Ambiguous.Notification? {\n <#code#>\n \}\n}}
// expected-note@-2 {{add stubs for conformance}} {{40-40=\n var notification: Ambiguous.Notification? {\n <#code#>\n \}\n}}
}
// FIXME: There's a remaining common ambiguity that occurs with nested types

View File

@@ -10,4 +10,4 @@ protocol P2 {
func bar2()
}
class C1 : P1, P2 {} // expected-error{{type 'C1' does not conform to protocol 'P1'}} expected-error{{type 'C1' does not conform to protocol 'P2'}} expected-note{{do you want to add protocol stubs?}}{{20-20=\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n}}
class C1 : P1, P2 {} // expected-error{{type 'C1' does not conform to protocol 'P1'}} expected-error{{type 'C1' does not conform to protocol 'P2'}} expected-note{{add stubs for conformance}}{{20-20=\n func foo1() {\n <#code#>\n \}\n\n func foo2() {\n <#code#>\n \}\n\n func bar1() {\n <#code#>\n \}\n\n func bar2() {\n <#code#>\n \}\n}}

View File

@@ -57,7 +57,7 @@ class SillyClass {}
protocol HasDefault {
func foo()
// expected-note@-1 {{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'foo()' with type '() -> ()'; add a stub for conformance}}
}
extension HasDefault where Self == SillyClass {

View File

@@ -3,7 +3,7 @@
// Generic parameter packs cannot witness associated type requirements
protocol HasAssoc {
associatedtype A
// expected-note@-1 {{protocol requires nested type 'A'; do you want to add it?}}
// expected-note@-1 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
struct HasPack<each A>: HasAssoc {}

View File

@@ -9,7 +9,7 @@ import deserialized_witness_mismatch_other
protocol HasCurrent {
var current: Self { get }
// expected-note@-1 {{protocol requires property 'current' with type 'TimeZone'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires property 'current' with type 'TimeZone'; add a stub for conformance}}
}
extension TimeZone : HasCurrent {}

View File

@@ -5,21 +5,21 @@
protocol None {
associatedtype V
// expected-note@+2 {{protocol requires property 'someProp' with type 'CA_N.V' (aka 'Int'); do you want to add a stub?}}
// expected-note@+1 2 {{protocol requires property 'someProp' with type 'Self.V'; do you want to add a stub?}}
// expected-note@+2 {{protocol requires property 'someProp' with type 'CA_N.V' (aka 'Int'); add a stub for conformance}}
// expected-note@+1 2 {{protocol requires property 'someProp' with type 'Self.V'; add a stub for conformance}}
var someProp : V { get }
}
protocol T {
associatedtype V
// expected-note@+2 {{protocol requires property 'someProp' with type 'CAT_T.V' (aka 'Int'); do you want to add a stub?}}
// expected-note@+1 {{protocol requires property 'someProp' with type 'Self.V'; do you want to add a stub?}}
// expected-note@+2 {{protocol requires property 'someProp' with type 'CAT_T.V' (aka 'Int'); add a stub for conformance}}
// expected-note@+1 {{protocol requires property 'someProp' with type 'Self.V'; add a stub for conformance}}
var someProp : V { get throws }
}
protocol A {
associatedtype V
// expected-note@+1 2 {{protocol requires property 'someProp' with type 'Self.V'; do you want to add a stub?}}
// expected-note@+1 2 {{protocol requires property 'someProp' with type 'Self.V'; add a stub for conformance}}
var someProp : V { get async }
}
@@ -239,17 +239,17 @@ func composed4<U : T & None >(u : U) {
// redefining the protocols to make sure the fix-its are matched
protocol NoEffects {
// expected-note@+1 2 {{protocol requires property 'someProp' with type 'Int'; do you want to add a stub?}}
// expected-note@+1 2 {{protocol requires property 'someProp' with type 'Int'; add a stub for conformance}}
var someProp : Int { get }
}
protocol Throws {
// expected-note@+1 2 {{protocol requires property 'someProp' with type 'Int'; do you want to add a stub?}}
// expected-note@+1 2 {{protocol requires property 'someProp' with type 'Int'; add a stub for conformance}}
var someProp : Int { get throws }
}
protocol Async {
// expected-note@+1 3 {{protocol requires property 'someProp' with type 'Int'; do you want to add a stub?}}
// expected-note@+1 3 {{protocol requires property 'someProp' with type 'Int'; add a stub for conformance}}
var someProp : Int { get async }
}

View File

@@ -855,7 +855,7 @@ do {
class BadConformanceClass: CompositionBrokenClassConformance_a {}
// expected-error@-1 {{type 'BadConformanceClass' does not conform to protocol 'CompositionBrokenClassConformance_a'}}
protocol CompositionBrokenClassConformance_a {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
protocol CompositionBrokenClassConformance_b: CompositionBrokenClassConformance_a {
func method(_: A)

View File

@@ -5,7 +5,7 @@
// Requirement is settable, so witness cannot satisfy it //
protocol Foo1 {
static var bar: Self { get set } // expected-note {{protocol requires property 'bar' with type 'Bar1'; do you want to add a stub?}}
static var bar: Self { get set } // expected-note {{protocol requires property 'bar' with type 'Bar1'; add a stub for conformance}}
}
enum Bar1: Foo1 { // expected-error {{type 'Bar1' does not conform to protocol 'Foo1'}}
@@ -15,7 +15,7 @@ enum Bar1: Foo1 { // expected-error {{type 'Bar1' does not conform to protocol '
// Witness has associated values, which is unsupported //
protocol Foo2 {
static var bar: Self { get set } // expected-note {{protocol requires property 'bar' with type 'Bar2'; do you want to add a stub?}}
static var bar: Self { get set } // expected-note {{protocol requires property 'bar' with type 'Bar2'; add a stub for conformance}}
}
enum Bar2: Foo2 { // expected-error {{type 'Bar2' does not conform to protocol 'Foo2'}}
@@ -23,7 +23,7 @@ enum Bar2: Foo2 { // expected-error {{type 'Bar2' does not conform to protocol '
}
protocol Foo3 {
static var bar: Self { get } // expected-note {{protocol requires property 'bar' with type 'Bar3'; do you want to add a stub?}}
static var bar: Self { get } // expected-note {{protocol requires property 'bar' with type 'Bar3'; add a stub for conformance}}
}
enum Bar3: Foo3 { // expected-error {{type 'Bar3' does not conform to protocol 'Foo3'}}
@@ -33,7 +33,7 @@ enum Bar3: Foo3 { // expected-error {{type 'Bar3' does not conform to protocol '
// Requirement is not static, so it cannot be witnessed by the enum case //
protocol Foo4 {
var bar: Self { get } // expected-note {{protocol requires property 'bar' with type 'Bar4'; do you want to add a stub?}}
var bar: Self { get } // expected-note {{protocol requires property 'bar' with type 'Bar4'; add a stub for conformance}}
}
enum Bar4: Foo4 { // expected-error {{type 'Bar4' does not conform to protocol 'Foo4'}}
@@ -41,7 +41,7 @@ enum Bar4: Foo4 { // expected-error {{type 'Bar4' does not conform to protocol '
}
protocol Foo5 {
var bar: Self { get set } // expected-note {{protocol requires property 'bar' with type 'Bar5'; do you want to add a stub?}}
var bar: Self { get set } // expected-note {{protocol requires property 'bar' with type 'Bar5'; add a stub for conformance}}
}
enum Bar5: Foo5 { // expected-error {{type 'Bar5' does not conform to protocol 'Foo5'}}
@@ -51,7 +51,7 @@ enum Bar5: Foo5 { // expected-error {{type 'Bar5' does not conform to protocol '
// Requirement does not have Self type, so it cannot be witnessed by the enum case //
protocol Foo6 {
static var bar: Int { get } // expected-note {{protocol requires property 'bar' with type 'Int'; do you want to add a stub?}}
static var bar: Int { get } // expected-note {{protocol requires property 'bar' with type 'Int'; add a stub for conformance}}
}
enum Bar6: Foo6 { // expected-error {{type 'Bar6' does not conform to protocol 'Foo6'}}
@@ -101,7 +101,7 @@ enum Bar10: Foo10 {
// Witness does not have a payload, but requirement is a function
protocol Foo11 {
static func bar(h: Int) -> Self // expected-note {{protocol requires function 'bar(h:)' with type '(Int) -> Bar11'; do you want to add a stub?}}
static func bar(h: Int) -> Self // expected-note {{protocol requires function 'bar(h:)' with type '(Int) -> Bar11'; add a stub for conformance}}
}
enum Bar11: Foo11 { // expected-error {{type 'Bar11' does not conform to protocol 'Foo11'}}
@@ -111,7 +111,7 @@ enum Bar11: Foo11 { // expected-error {{type 'Bar11' does not conform to protoco
// Witness is static, but requirement is not
protocol Foo12 {
func bar(i: Int) -> Self // expected-note {{protocol requires function 'bar(i:)' with type '(Int) -> Bar12'; do you want to add a stub?}}
func bar(i: Int) -> Self // expected-note {{protocol requires function 'bar(i:)' with type '(Int) -> Bar12'; add a stub for conformance}}
}
enum Bar12: Foo12 { // expected-error {{type 'Bar12' does not conform to protocol 'Foo12'}}

View File

@@ -18,7 +18,7 @@ protocol BaseProto {}
protocol ProtoRefinesClass : Generic<Int>, BaseProto {
func requirementUsesClassTypes(_: ConcreteAlias, _: GenericAlias)
// expected-note@-1 {{protocol requires function 'requirementUsesClassTypes' with type '(Generic<Int>.ConcreteAlias, Generic<Int>.GenericAlias) -> ()' (aka '(String, (Int, Int)) -> ()'); do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'requirementUsesClassTypes' with type '(Generic<Int>.ConcreteAlias, Generic<Int>.GenericAlias) -> ()' (aka '(String, (Int, Int)) -> ()'); add a stub for conformance}}
}
func duplicateOverload<T : ProtoRefinesClass>(_: T) {}

View File

@@ -19,7 +19,7 @@ protocol BaseProto {}
protocol ProtoRefinesClass where Self : Generic<Int>, Self : BaseProto {
func requirementUsesClassTypes(_: ConcreteAlias, _: GenericAlias)
// expected-note@-1 {{protocol requires function 'requirementUsesClassTypes' with type '(Generic<Int>.ConcreteAlias, Generic<Int>.GenericAlias) -> ()' (aka '(String, (Int, Int)) -> ()'); do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'requirementUsesClassTypes' with type '(Generic<Int>.ConcreteAlias, Generic<Int>.GenericAlias) -> ()' (aka '(String, (Int, Int)) -> ()'); add a stub for conformance}}
}
func duplicateOverload<T : ProtoRefinesClass>(_: T) {}

View File

@@ -82,10 +82,10 @@ struct NotFormattedPrintable : FormattedPrintable { // expected-error{{type 'Not
// Protocol compositions in inheritance clauses
protocol Left {
func l() // expected-note {{protocol requires function 'l()' with type '() -> ()'; do you want to add a stub?}}
func l() // expected-note {{protocol requires function 'l()' with type '() -> ()'; add a stub for conformance}}
}
protocol Right {
func r() // expected-note {{protocol requires function 'r()' with type '() -> ()'; do you want to add a stub?}}
func r() // expected-note {{protocol requires function 'r()' with type '() -> ()'; add a stub for conformance}}
}
typealias Both = Left & Right

View File

@@ -129,11 +129,11 @@ struct XProp0b : PropertyP0 { // expected-error{{type 'XProp0b' does not conform
// Inference from subscripts
protocol SubscriptP0 {
associatedtype Index
// expected-note@-1 2 {{protocol requires nested type 'Index'; do you want to add it?}}
// expected-note@-1 2 {{protocol requires nested type 'Index'; add nested type 'Index' for conformance}}
associatedtype Element : PSimple
// expected-note@-1 {{unable to infer associated type 'Element' for protocol 'SubscriptP0'}}
// expected-note@-2 2 {{protocol requires nested type 'Element'; do you want to add it?}}
// expected-note@-2 2 {{protocol requires nested type 'Element'; add nested type 'Element' for conformance}}
subscript (i: Index) -> Element { get }
}
@@ -160,9 +160,9 @@ struct XSubP0d : SubscriptP0 {
// Inference from properties and subscripts
protocol CollectionLikeP0 {
associatedtype Index
// expected-note@-1 {{protocol requires nested type 'Index'; do you want to add it?}}
// expected-note@-1 {{protocol requires nested type 'Index'; add nested type 'Index' for conformance}}
associatedtype Element
// expected-note@-1 {{protocol requires nested type 'Element'; do you want to add it?}}
// expected-note@-1 {{protocol requires nested type 'Element'; add nested type 'Element' for conformance}}
var startIndex: Index { get }
var endIndex: Index { get }
@@ -358,7 +358,7 @@ struct X12 : P12 {
// the associated type
protocol Cookie {
associatedtype Dough
// expected-note@-1 {{protocol requires nested type 'Dough'; do you want to add it?}}
// expected-note@-1 {{protocol requires nested type 'Dough'; add nested type 'Dough' for conformance}}
init(t: Dough)
}
@@ -385,7 +385,7 @@ struct Int8Vector : Vector {
// https://github.com/apple/swift/issues/47063
protocol P13 {
associatedtype Arg // expected-note{{protocol requires nested type 'Arg'; do you want to add it?}}
associatedtype Arg // expected-note{{protocol requires nested type 'Arg'; add nested type 'Arg' for conformance}}
func foo(arg: Arg)
}
@@ -432,7 +432,7 @@ protocol P15f {
}
protocol P15g: P15c, P15f {
associatedtype A // expected-note{{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note{{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
@@ -503,7 +503,7 @@ struct Foo: RefinesAssocWithDefault {
}
protocol P20 {
associatedtype T // expected-note{{protocol requires nested type 'T'; do you want to add it?}}
associatedtype T // expected-note{{protocol requires nested type 'T'; add nested type 'T' for conformance}}
typealias TT = T?
}
struct S19 : P20 { // expected-error{{type 'S19' does not conform to protocol 'P20'}}
@@ -538,12 +538,12 @@ protocol P32 {
var bar: B { get }
}
protocol P33 {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
var baz: A { get }
}
protocol P34 {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
func boo() -> A
}
@@ -627,9 +627,9 @@ protocol P40a {
func foo(arg: A)
}
protocol P40b: P40a {
associatedtype C = (A, B.A, D.D, E) -> Self // expected-note {{protocol requires nested type 'C'; do you want to add it?}}
associatedtype D: P40b // expected-note {{protocol requires nested type 'D'; do you want to add it?}}
associatedtype E: Equatable // expected-note {{protocol requires nested type 'E'; do you want to add it?}}
associatedtype C = (A, B.A, D.D, E) -> Self // expected-note {{protocol requires nested type 'C'; add nested type 'C' for conformance}}
associatedtype D: P40b // expected-note {{protocol requires nested type 'D'; add nested type 'D' for conformance}}
associatedtype E: Equatable // expected-note {{protocol requires nested type 'E'; add nested type 'E' for conformance}}
}
protocol P40c: P40b where D == S40<Never> {}
struct S40<E: Equatable>: P40c {

View File

@@ -104,7 +104,7 @@ protocol P11a {
}
protocol P11b: P11a where A == Never {}
protocol Q11 {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
do {
struct Conformer: Q11, P11b {}
@@ -144,8 +144,8 @@ do {
}
protocol P15a {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B = Never // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B = Never // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol P15b: P15a where A == B {}
do {
@@ -155,8 +155,8 @@ do {
}
protocol P16a where A == B {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B = Never // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B = Never // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol P16b: P16a {}
do {
@@ -165,12 +165,12 @@ do {
}
protocol P17a where A == Never {
associatedtype A = B // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A = B // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol P17b {
associatedtype A = B // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A = B // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol P17c where A == Never {
associatedtype A
@@ -206,9 +206,9 @@ do {
}
protocol P20 where A == B.Element, B == B.SubSequence, C.Element == B.Element {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B: Collection
associatedtype C: Collection = Array<Character> // expected-note {{protocol requires nested type 'C'; do you want to add it?}}
associatedtype C: Collection = Array<Character> // expected-note {{protocol requires nested type 'C'; add nested type 'C' for conformance}}
}
do {
struct Conformer: P20 { // expected-error {{type 'Conformer' does not conform to protocol 'P20'}}
@@ -217,9 +217,9 @@ do {
}
protocol P21 where A == B {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B = C // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype C // expected-note {{protocol requires nested type 'C'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B = C // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
associatedtype C // expected-note {{protocol requires nested type 'C'; add nested type 'C' for conformance}}
}
do {
struct Conformer<C>: P21 {} // expected-error {{type 'Conformer<C>' does not conform to protocol 'P21'}}
@@ -236,8 +236,8 @@ do {
}
protocol P23 {
associatedtype A: P23 = B.A // expected-note 2 {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B: P23 = A.B // expected-note 2 {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A: P23 = B.A // expected-note 2 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B: P23 = A.B // expected-note 2 {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
do {
struct Conformer: P23 {} // expected-error {{type 'Conformer' does not conform to protocol 'P23'}}
@@ -245,8 +245,8 @@ do {
}
protocol P24 where A == B.A {
associatedtype A: P24 // expected-note 2 {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B: P24 = A.B // expected-note 2 {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A: P24 // expected-note 2 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B: P24 = A.B // expected-note 2 {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
do {
struct Conformer: P24 {} // expected-error {{type 'Conformer' does not conform to protocol 'P24'}}
@@ -275,15 +275,15 @@ do {
}
protocol P26 where C == B, F == G {
associatedtype A = Int // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B = A // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype C // expected-note {{protocol requires nested type 'C'; do you want to add it?}}
associatedtype A = Int // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B = A // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
associatedtype C // expected-note {{protocol requires nested type 'C'; add nested type 'C' for conformance}}
associatedtype D // expected-note {{protocol requires nested type 'D'; do you want to add it?}}
associatedtype E = D // expected-note {{protocol requires nested type 'E'; do you want to add it?}}
associatedtype D // expected-note {{protocol requires nested type 'D'; add nested type 'D' for conformance}}
associatedtype E = D // expected-note {{protocol requires nested type 'E'; add nested type 'E' for conformance}}
associatedtype F // expected-note {{protocol requires nested type 'F'; do you want to add it?}}
associatedtype G = [B] // expected-note {{protocol requires nested type 'G'; do you want to add it?}}
associatedtype F // expected-note {{protocol requires nested type 'F'; add nested type 'F' for conformance}}
associatedtype G = [B] // expected-note {{protocol requires nested type 'G'; add nested type 'G' for conformance}}
}
do {
struct Conformer<D>: P26 {} // expected-error {{type 'Conformer<D>' does not conform to protocol 'P26'}}
@@ -341,8 +341,8 @@ protocol P29b where B == Never {
associatedtype B
}
protocol P29c where A == B {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol Q29a: P29a, P29b, P29c {}
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
@@ -368,8 +368,8 @@ protocol P30b where A == Never {
associatedtype A
}
protocol P30c where A == B {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol Q30: P30c, P30a, P30b {}
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
@@ -387,8 +387,8 @@ protocol P31b where B == Never {
associatedtype B
}
protocol P31c where B == A {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol Q31: P31c, P31a, P31b {}
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
@@ -412,8 +412,8 @@ protocol P32d where B == Never {
associatedtype B
}
protocol P32e where A == B {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol Q32: P32e, P32a, P32b, P32c, P32d {}
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == ()'}}
@@ -451,7 +451,7 @@ protocol P34b {
protocol Q34a: P34a, P34b {}
protocol Q34b: P34b, P34a {}
protocol Q34c: P34a, P34b {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
do {
struct Conformer1: Q34a {}
@@ -489,7 +489,7 @@ protocol P37a {
}
protocol P37b {
associatedtype B : P37a
associatedtype C where C == B.A // expected-note {{protocol requires nested type 'C'; do you want to add it?}}
associatedtype C where C == B.A // expected-note {{protocol requires nested type 'C'; add nested type 'C' for conformance}}
}
do {
struct Conformer1<C>: P37b {
@@ -545,8 +545,8 @@ do {
}
protocol P41 {
associatedtype A where A == B.A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B: P41 = Self // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A where A == B.A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B: P41 = Self // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
do {
struct Conformer: P41 {} // expected-error{{type 'Conformer' does not conform to protocol 'P41'}}
@@ -567,7 +567,7 @@ protocol P43a {
associatedtype B
}
protocol P43b: P43a {
associatedtype C where C == A.B // expected-note {{protocol requires nested type 'C'; do you want to add it?}}
associatedtype C where C == A.B // expected-note {{protocol requires nested type 'C'; add nested type 'C' for conformance}}
}
do {
struct Conformer<B: P43a>: P43b { // expected-error {{type 'Conformer<B>' does not conform to protocol 'P43b'}}
@@ -577,8 +577,8 @@ do {
protocol P44 {
associatedtype A: P44
associatedtype B // expected-note 2{{protocol requires nested type 'B'; do you want to add it?}}
associatedtype C where C == A.B // expected-note 3{{protocol requires nested type 'C'; do you want to add it?}}
associatedtype B // expected-note 2{{protocol requires nested type 'B'; add nested type 'B' for conformance}}
associatedtype C where C == A.B // expected-note 3{{protocol requires nested type 'C'; add nested type 'C' for conformance}}
}
do {
struct Conformer1<T: P44>: P44 { // expected-error {{type 'Conformer1<T>' does not conform to protocol 'P44'}}
@@ -596,17 +596,17 @@ do {
}
protocol P45 {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B: P45 = Conformer45<D> // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype C where C == B.A // expected-note {{protocol requires nested type 'C'; do you want to add it?}}
associatedtype D = Never // expected-note {{protocol requires nested type 'D'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B: P45 = Conformer45<D> // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
associatedtype C where C == B.A // expected-note {{protocol requires nested type 'C'; add nested type 'C' for conformance}}
associatedtype D = Never // expected-note {{protocol requires nested type 'D'; add nested type 'D' for conformance}}
}
struct Conformer45<A>: P45 {} // expected-error {{type 'Conformer45<A>' does not conform to protocol 'P45'}}
protocol P46 {
associatedtype A: P46
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype C where C == A.B // expected-note {{protocol requires nested type 'C'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
associatedtype C where C == A.B // expected-note {{protocol requires nested type 'C'; add nested type 'C' for conformance}}
func method(_: B)
}

View File

@@ -80,7 +80,7 @@ protocol P7b: P7a where A == Bool {}
struct S7: P7b {}
protocol P8a where A == Never {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
protocol P8b where A == Bool {
associatedtype A
@@ -208,12 +208,12 @@ do {
}
protocol P17a where A == Never {
associatedtype A = B // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A = B // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol P17b {
associatedtype A = B // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A = B // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol P17c where A == Never {
associatedtype A
@@ -320,8 +320,8 @@ do {
}
protocol P23 {
associatedtype A: P23 = B.A // expected-note 2 {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B: P23 = A.B // expected-note 2 {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A: P23 = B.A // expected-note 2 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B: P23 = A.B // expected-note 2 {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
do {
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P23: {
@@ -337,8 +337,8 @@ do {
}
protocol P24 where A == B.A {
associatedtype A: P24 // expected-note 2 {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B: P24 = A.B // expected-note 2 {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A: P24 // expected-note 2 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B: P24 = A.B // expected-note 2 {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
do {
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P24: {
@@ -433,7 +433,7 @@ do {
}
protocol P28a where A == Int {
associatedtype A // expected-note 2 {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note 2 {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
protocol P28b where A == Bool {
associatedtype A
@@ -465,15 +465,15 @@ do {
}
protocol P29a where A == Int {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol P29b where B == Never {
associatedtype B
}
protocol P29c where A == B {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol Q29a: P29a, P29b, P29c {}
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
@@ -506,8 +506,8 @@ protocol P30b where A == Never {
associatedtype A
}
protocol P30c where A == B {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol Q30: P30c, P30a, P30b {}
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
@@ -529,8 +529,8 @@ protocol P31b where B == Never {
associatedtype B
}
protocol P31c where B == A {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol Q31: P31c, P31a, P31b {}
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == Int'}}
@@ -558,8 +558,8 @@ protocol P32d where B == Never {
associatedtype B
}
protocol P32e where A == B {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
protocol Q32: P32e, P32a, P32b, P32c, P32d {}
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Never' and 'Self.A == ()'}}
@@ -604,7 +604,7 @@ protocol P34b {
protocol Q34a: P34a, P34b {}
protocol Q34b: P34b, P34a {}
protocol Q34c: P34a, P34b {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
do {
// FIXME: should really be ambiguous (source-breaking)?
@@ -743,8 +743,8 @@ do {
}
protocol P41 {
associatedtype A where A == B.A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype B: P41 = Self // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
associatedtype A where A == B.A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
associatedtype B: P41 = Self // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
}
do {
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P41: {
@@ -867,8 +867,8 @@ do {
}
}
protocol P48a { associatedtype A = Int } // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
protocol P48b { associatedtype B } // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
protocol P48a { associatedtype A = Int } // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
protocol P48b { associatedtype B } // expected-note {{protocol requires nested type 'B'; add nested type 'B' for conformance}}
protocol P48c: P48a, P48b where A == B {}
do {
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P48a: {

View File

@@ -4,7 +4,7 @@ protocol P { }
protocol Q {
associatedtype T
associatedtype U // expected-note 2{{protocol requires nested type 'U'; do you want to add it?}}
associatedtype U // expected-note 2{{protocol requires nested type 'U'; add nested type 'U' for conformance}}
}
protocol R: Q {

View File

@@ -4,8 +4,8 @@
// in various ways.
protocol LikeSetAlgebra {
func onion(_ other: Self) -> Self // expected-note {{protocol requires function 'onion' with type '(X) -> X'; do you want to add a stub?}}
func indifference(_ other: Self) -> Self // expected-note {{protocol requires function 'indifference' with type '(X) -> X'; do you want to add a stub?}}
func onion(_ other: Self) -> Self // expected-note {{protocol requires function 'onion' with type '(X) -> X'; add a stub for conformance}}
func indifference(_ other: Self) -> Self // expected-note {{protocol requires function 'indifference' with type '(X) -> X'; add a stub for conformance}}
}
protocol LikeOptionSet : LikeSetAlgebra, RawRepresentable {}
@@ -31,8 +31,8 @@ struct Y : LikeSequence {} // expected-error {{type 'Y' does not conform to prot
protocol P1 {
associatedtype Result
func get() -> Result // expected-note {{protocol requires function 'get()' with type '() -> Result'; do you want to add a stub?}}
func got() // expected-note {{protocol requires function 'got()' with type '() -> ()'; do you want to add a stub?}}
func get() -> Result // expected-note {{protocol requires function 'get()' with type '() -> Result'; add a stub for conformance}}
func got() // expected-note {{protocol requires function 'got()' with type '() -> ()'; add a stub for conformance}}
}
protocol P2 {
static var singularThing: Self { get }
@@ -48,7 +48,7 @@ extension P1 where Self : P3 {
struct Z<T1, T2, T3, Result, T4> : P1 {} // expected-error {{type 'Z<T1, T2, T3, Result, T4>' does not conform to protocol 'P1'}}
protocol P4 {
func this() // expected-note 2 {{protocol requires function 'this()' with type '() -> ()'; do you want to add a stub?}}
func this() // expected-note 2 {{protocol requires function 'this()' with type '() -> ()'; add a stub for conformance}}
}
protocol P5 {}
extension P4 where Self : P5 {
@@ -82,7 +82,7 @@ struct B : P8 { // expected-error {{type 'B' does not conform to protocol 'P8'}}
}
protocol P9 {
func foo() // expected-note {{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}}
func foo() // expected-note {{protocol requires function 'foo()' with type '() -> ()'; add a stub for conformance}}
}
class C2 {}
extension P9 where Self : C2 {
@@ -92,7 +92,7 @@ class C3 : P9 {} // expected-error {{type 'C3' does not conform to protocol 'P9'
protocol P10 {
associatedtype A
func bar() // expected-note {{protocol requires function 'bar()' with type '() -> ()'; do you want to add a stub?}}
func bar() // expected-note {{protocol requires function 'bar()' with type '() -> ()'; add a stub for conformance}}
}
extension P10 where A == Int {
func bar() {} // expected-note {{candidate would match if 'A' was the same type as 'Int'}}

View File

@@ -22,21 +22,21 @@ class X<T> where T == X {
protocol CircularAssocTypeDefault {
associatedtype Z = Z // expected-error{{associated type 'Z' references itself}}
// expected-note@-1{{type declared here}}
// expected-note@-2{{protocol requires nested type 'Z'; do you want to add it?}}
// expected-note@-2{{protocol requires nested type 'Z'; add nested type 'Z' for conformance}}
associatedtype Z2 = Z3
// expected-note@-1{{protocol requires nested type 'Z2'; do you want to add it?}}
// expected-note@-1{{protocol requires nested type 'Z2'; add nested type 'Z2' for conformance}}
associatedtype Z3 = Z2
// expected-note@-1{{protocol requires nested type 'Z3'; do you want to add it?}}
// expected-note@-1{{protocol requires nested type 'Z3'; add nested type 'Z3' for conformance}}
associatedtype Z4 = Self.Z4 // expected-error{{associated type 'Z4' references itself}}
// expected-note@-1{{type declared here}}
// expected-note@-2{{protocol requires nested type 'Z4'; do you want to add it?}}
// expected-note@-2{{protocol requires nested type 'Z4'; add nested type 'Z4' for conformance}}
associatedtype Z5 = Self.Z6
// expected-note@-1{{protocol requires nested type 'Z5'; do you want to add it?}}
// expected-note@-1{{protocol requires nested type 'Z5'; add nested type 'Z5' for conformance}}
associatedtype Z6 = Self.Z5
// expected-note@-1{{protocol requires nested type 'Z6'; do you want to add it?}}
// expected-note@-1{{protocol requires nested type 'Z6'; add nested type 'Z6' for conformance}}
}
struct ConformsToCircularAssocTypeDefault : CircularAssocTypeDefault { }

View File

@@ -38,7 +38,7 @@ struct S1Error : P1 { // expected-error{{type 'S1Error' does not conform to prot
protocol SubscriptGet {
subscript(a : Int) -> Int { get } // expected-note {{protocol requires subscript with type '(Int) -> Int'; do you want to add a stub?}}
subscript(a : Int) -> Int { get } // expected-note {{protocol requires subscript with type '(Int) -> Int'; add a stub for conformance}}
}
class SubscriptGet_Get : SubscriptGet {
@@ -78,7 +78,7 @@ protocol Initable {
protocol GenericSubscriptProtocol {
subscript<T : Initable>(t: T.Type) -> T { get set }
// expected-note@-1 {{protocol requires subscript with type '<T> (T.Type) -> T'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires subscript with type '<T> (T.Type) -> T'; add a stub for conformance}}
}
struct GenericSubscriptWitness : GenericSubscriptProtocol {
@@ -99,7 +99,7 @@ struct GenericSubscriptNoWitness : GenericSubscriptProtocol {}
//===----------------------------------------------------------------------===//
protocol StaticSubscriptGet {
static subscript(a : Int) -> Int { get } // expected-note {{protocol requires subscript with type '(Int) -> Int'; do you want to add a stub?}}
static subscript(a : Int) -> Int { get } // expected-note {{protocol requires subscript with type '(Int) -> Int'; add a stub for conformance}}
}
class StaticSubscriptGet_Get : StaticSubscriptGet {

View File

@@ -5,7 +5,7 @@ protocol P {
associatedtype B
func f<T: P>(_: T) where T.A == Self.A, T.A == Self.B // expected-error{{instance method requirement 'f' cannot add constraint 'Self.A == Self.B' on 'Self'}}
// expected-note@-1 {{protocol requires function 'f' with type '<T> (T) -> ()'; do you want to add a stub?}}
// expected-note@-1 {{protocol requires function 'f' with type '<T> (T) -> ()'; add a stub for conformance}}
}
extension P {
@@ -65,7 +65,7 @@ protocol P6 {
func foo() where T == U
// expected-error@-1 {{instance method requirement 'foo()' cannot add constraint 'Self.T == Self.U' on 'Self'}}
// expected-note@-2 {{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}}
// expected-note@-2 {{protocol requires function 'foo()' with type '() -> ()'; add a stub for conformance}}
}
struct S2 : P6 {

View File

@@ -8,14 +8,14 @@ postfix operator ^^^^
import OtherOS
protocol Foo {
var bar1: Int { get set } // expected-note {{protocol requires property 'bar1' with type 'Int'; do you want to add a stub?}}
static var bar2: Int { get set } // expected-note {{protocol requires property 'bar2' with type 'Int'; do you want to add a stub?}}
var bar3: Int { get set } // expected-note {{protocol requires property 'bar3' with type 'Int'; do you want to add a stub?}}
static prefix func ^^^(value: Self) -> Int // expected-note {{protocol requires function '^^^' with type '(ConformsToFoo) -> Int'; do you want to add a stub?}}
static postfix func ^^^^(value: Self) -> Int // expected-note {{protocol requires function '^^^^' with type '(ConformsToFoo) -> Int'; do you want to add a stub?}}
func bar4(closure: () throws -> Int) rethrows // expected-note {{protocol requires function 'bar4(closure:)' with type '(() throws -> Int) throws -> ()'; do you want to add a stub?}}
var bar5: Int { get set } // expected-note {{protocol requires property 'bar5' with type 'Int'; do you want to add a stub?}}
static subscript(_ pos: Int) -> Int { get } // expected-note {{protocol requires subscript with type '(Int) -> Int'; do you want to add a stub?}}
var bar1: Int { get set } // expected-note {{protocol requires property 'bar1' with type 'Int'; add a stub for conformance}}
static var bar2: Int { get set } // expected-note {{protocol requires property 'bar2' with type 'Int'; add a stub for conformance}}
var bar3: Int { get set } // expected-note {{protocol requires property 'bar3' with type 'Int'; add a stub for conformance}}
static prefix func ^^^(value: Self) -> Int // expected-note {{protocol requires function '^^^' with type '(ConformsToFoo) -> Int'; add a stub for conformance}}
static postfix func ^^^^(value: Self) -> Int // expected-note {{protocol requires function '^^^^' with type '(ConformsToFoo) -> Int'; add a stub for conformance}}
func bar4(closure: () throws -> Int) rethrows // expected-note {{protocol requires function 'bar4(closure:)' with type '(() throws -> Int) throws -> ()'; add a stub for conformance}}
var bar5: Int { get set } // expected-note {{protocol requires property 'bar5' with type 'Int'; add a stub for conformance}}
static subscript(_ pos: Int) -> Int { get } // expected-note {{protocol requires subscript with type '(Int) -> Int'; add a stub for conformance}}
}
struct ConformsToFoo: Foo { // expected-error {{type 'ConformsToFoo' does not conform to protocol 'Foo'}}
@@ -32,7 +32,7 @@ struct ConformsToFoo: Foo { // expected-error {{type 'ConformsToFoo' does not co
}
protocol Foo1 {
subscript(value: Bool) -> Bool { get set } // expected-note {{protocol requires subscript with type '(Bool) -> Bool'; do you want to add a stub?}}
subscript(value: Bool) -> Bool { get set } // expected-note {{protocol requires subscript with type '(Bool) -> Bool'; add a stub for conformance}}
}
struct ConformsToFoo1: Foo1 { // expected-error {{type 'ConformsToFoo1' does not conform to protocol 'Foo1'}}
@@ -43,7 +43,7 @@ struct ConformsToFoo1: Foo1 { // expected-error {{type 'ConformsToFoo1' does not
// This protocol requirement must conflict with the one in
// witness_fix_its_other_module.swift.
protocol RenameableProtocol {
var name: String { get set } // expected-note {{protocol requires property 'name' with type 'String'; do you want to add a stub?}}
var name: String { get set } // expected-note {{protocol requires property 'name' with type 'String'; add a stub for conformance}}
}
extension Linux: RenameableProtocol {} // expected-error {{type 'Linux' does not conform to protocol 'RenameableProtocol'}}

View File

@@ -333,7 +333,7 @@ protocol ErrorQ {
associatedtype Y
}
protocol ErrorP {
associatedtype X: ErrorQ // expected-note {{protocol requires nested type 'X'; do you want to add it?}}
associatedtype X: ErrorQ // expected-note {{protocol requires nested type 'X'; add nested type 'X' for conformance}}
}
typealias ErrorA<T: ErrorP> = T.X.Y

View File

@@ -2,7 +2,7 @@
// rdar://problem/29689007
protocol P {
associatedtype AT // expected-note{{protocol requires nested type 'AT'; do you want to add it?}}
associatedtype AT // expected-note{{protocol requires nested type 'AT'; add nested type 'AT' for conformance}}
func f() -> AT
}

View File

@@ -9,7 +9,7 @@ public enum NonExhaustive {
@inlinable
public func testNonExhaustive(_ value: NonExhaustive) {
switch value { // expected-error {{switch must be exhaustive}}
// expected-note@-1 {{do you want to add missing cases?}}
// expected-note@-1 {{add missing cases}}
case .a: break
}
@@ -21,7 +21,7 @@ public func testNonExhaustive(_ value: NonExhaustive) {
}
// expected-error@+2 {{switch must be exhaustive}}
// expected-note@+1 {{do you want to add missing cases?}} {{+1:3-3=case .a:\n<#code#>\ncase .b:\n<#code#>\n@unknown default:\n<#code#>\n}}
// expected-note@+1 {{add missing cases}} {{+1:3-3=case .a:\n<#code#>\ncase .b:\n<#code#>\n@unknown default:\n<#code#>\n}}
switch value {
}

View File

@@ -302,7 +302,7 @@ func breakContinue(_ x : Int) -> Int {
Outer:
for _ in 0...1000 {
Switch: // expected-error {{switch must be exhaustive}} expected-note{{do you want to add a default clause?}}
Switch: // expected-error {{switch must be exhaustive}} expected-note{{add a default clause}}
switch x {
case 42: break Outer
case 97: continue Outer

View File

@@ -9,5 +9,5 @@ func foo1(e : E, i : Int) {
switch e {} // expected-error{{switch must be exhaustive}}
// expected-note@-1 {{missing case: '.e1'}}
// expected-note@-2 {{missing case: '.e2'}}
switch i {} // expected-error{{'switch' statement body must have at least one 'case' or 'default' block; do you want to add a default case?}}{{13-13=default:\n<#code#>\n}}
switch i {} // expected-error{{'switch' statement body must have at least one 'case' or 'default' block; add a default case}}{{13-13=default:\n<#code#>\n}}
}

View File

@@ -13,7 +13,7 @@ func foo1(e : E) {
}
func foo2(i : Int) {
// expected-note@+1{{do you want to add a default clause?}}{{+2:3-3=default:\n<#code#>\n}}
// expected-note@+1{{add a default clause}}{{+2:3-3=default:\n<#code#>\n}}
switch i { // expected-error{{switch must be exhaustive}}
case 1: return
}
@@ -128,7 +128,7 @@ func testSwitchEnumBoolTuple(_ b1: Bool, b2: Bool, xi: Int) -> Int {
func non_fully_covered_switch(x: Int) -> Int {
var x = x
switch x { // expected-error{{switch must be exhaustive}}
// expected-note@-1{{do you want to add a default clause?}}
// expected-note@-1{{add a default clause}}
case 0:
x += 1
case 3:

View File

@@ -7,6 +7,6 @@ enum E {
func foo1(e : E, i : Int) {
switch e {} // expected-error{{switch must be exhaustive}}
// expected-note@-1{{do you want to add missing cases?}}{{13-13=case .e1:\n<#code#>\ncase .e2:\n<#code#>\n}}
switch i {} // expected-error{{'switch' statement body must have at least one 'case' or 'default' block; do you want to add a default case?}}{{13-13=default:\n<#code#>\n}}
// expected-note@-1{{add missing cases}}{{13-13=case .e1:\n<#code#>\ncase .e2:\n<#code#>\n}}
switch i {} // expected-error{{'switch' statement body must have at least one 'case' or 'default' block; add a default case}}{{13-13=default:\n<#code#>\n}}
}

View File

@@ -6,14 +6,14 @@ enum E {
}
func foo1(e : E) {
// expected-note@+1{{do you want to add missing cases?}}{{+2:3-3=case .e2:\n<#code#>\n}}
// expected-note@+1{{add missing cases}}{{+2:3-3=case .e2:\n<#code#>\n}}
switch e { // expected-error{{switch must be exhaustive}}
case .e1: return
}
}
func foo2(i : Int) {
// expected-note@+1{{do you want to add a default clause?}}{{+2:3-3=default:\n<#code#>\n}}
// expected-note@+1{{add a default clause}}{{+2:3-3=default:\n<#code#>\n}}
switch i { // expected-error{{switch must be exhaustive}}
case 1: return
}

View File

@@ -5,7 +5,7 @@ protocol Foo { }
var x: any Foo
protocol SelfAsType {
var x: Self { get } // expected-note{{protocol requires property 'x' with type 'U'; do you want to add a stub?}}
var x: Self { get } // expected-note{{protocol requires property 'x' with type 'U'; add a stub for conformance}}
}
struct U : SelfAsType { // expected-error{{type 'U' does not conform to protocol 'SelfAsType'}}

View File

@@ -31,7 +31,7 @@ protocol Invalid5<Element, Element> {
protocol Sequence<Element> {
associatedtype Element
// expected-note@-1 2{{protocol requires nested type 'Element'; do you want to add it?}}
// expected-note@-1 2{{protocol requires nested type 'Element'; add nested type 'Element' for conformance}}
}
extension Sequence {

View File

@@ -30,7 +30,7 @@ public struct BrokenOptions : Swift.OptionSet {
// CHECK: error: type 'BrokenOptions' does not conform to protocol 'SetAlgebra'
// CHECK: note: candidate would match if 'BrokenOptions.Element' was the same type as 'τ_0_0.Element'
// CHECK: error: type 'BrokenOptions' does not conform to protocol 'ExpressibleByArrayLiteral'
// CHECK: note: protocol requires nested type 'Element'; do you want to add it?
// CHECK: note: protocol requires nested type 'Element'; add nested type 'Element' for conformance
// CHECK: note: protocol requires initializer 'init(_:)' with type 'S'
// CHECK: note: protocol requires nested type 'ArrayLiteralElement'; do you want to add it?
// CHECK: note: protocol requires nested type 'ArrayLiteralElement'; add nested type 'ArrayLiteralElement' for conformance
// CHECK: error: failed to verify module interface of 'Broken' due to the errors above; the textual interface may be broken by project issues, differences between compilers

View File

@@ -8,7 +8,7 @@ case message
struct NewItemResponse {}
protocol Publisher {
associatedtype Output // expected-note {{protocol requires nested type 'Output'; do you want to add it?}}
associatedtype Output // expected-note {{protocol requires nested type 'Output'; add nested type 'Output' for conformance}}
}
extension Publisher {

View File

@@ -4,7 +4,7 @@
import Foundation
@objc protocol P {
func foo(a arg: Int) // expected-note {{protocol requires function 'foo(a:)' with type '(Int) -> ()'; do you want to add a stub?}}
func foo(a arg: Int) // expected-note {{protocol requires function 'foo(a:)' with type '(Int) -> ()'; add a stub for conformance}}
}
class C : P {

View File

@@ -3,7 +3,7 @@
// https://github.com/apple/swift/issues/49119
protocol P {
associatedtype A: P // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A: P // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
struct Type<Param> {}

View File

@@ -5,7 +5,7 @@
struct Foo<T> {}
protocol P1 {
associatedtype A // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
associatedtype A // expected-note {{protocol requires nested type 'A'; add nested type 'A' for conformance}}
}
extension Foo: P1 where A : P1 {}
// expected-error@-1 {{extension of generic struct 'Foo' has self-referential generic requirements}}

View File

@@ -7,7 +7,7 @@
protocol P1 {
associatedtype X
// expected-note@-1 {{protocol requires nested type 'X'; do you want to add it?}}
// expected-note@-1 {{protocol requires nested type 'X'; add nested type 'X' for conformance}}
associatedtype A: P2 where A.X == X
}