Skip to content

Commit ddfd583

Browse files
authored
Merge pull request #78872 from tshortli/unavailable-witness-in-extension-diag-regression-test
Tests: Test conformance checker with witnesses in unavailable extensions
2 parents d2936a1 + fdcf53c commit ddfd583

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/decl/protocol/req/unavailable.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Bar : NonObjCProto { // expected-error {{type 'Bar' does not conform to pr
2626

2727
// Complain about unavailable witnesses (error in Swift 4, warning in Swift 3)
2828
protocol P {
29-
func foo(bar: Foo) // expected-note 2 {{requirement 'foo(bar:)' declared here}}
29+
func foo(bar: Foo) // expected-note 3 {{requirement 'foo(bar:)' declared here}}
3030
}
3131

3232
struct ConformsToP : P { // expected-error{{type 'ConformsToP' does not conform to protocol 'P'}}
@@ -64,6 +64,14 @@ extension ConformsToP5: P {
6464
func foo(bar: Foo) { }
6565
}
6666

67+
struct ConformsToP6: P {} // expected-error{{type 'ConformsToP6' does not conform to protocol 'P'}}
68+
// expected-error@-1 {{unavailable instance method 'foo(bar:)' was used to satisfy a requirement of protocol 'P'}}
69+
70+
@available(*, unavailable)
71+
extension ConformsToP6 {
72+
func foo(bar: Foo) { } // expected-note {{'foo(bar:)' declared here}}
73+
}
74+
6775
@available(*, unavailable)
6876
enum UnavailableEnum {
6977
struct ConformsToP6: P {

0 commit comments

Comments
 (0)