Skip to content

Commit

Permalink
Merge pull request #78872 from tshortli/unavailable-witness-in-extens…
Browse files Browse the repository at this point in the history
…ion-diag-regression-test

Tests: Test conformance checker with witnesses in unavailable extensions
  • Loading branch information
tshortli authored Jan 24, 2025
2 parents d2936a1 + fdcf53c commit ddfd583
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/decl/protocol/req/unavailable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Bar : NonObjCProto { // expected-error {{type 'Bar' does not conform to pr

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

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

struct ConformsToP6: P {} // expected-error{{type 'ConformsToP6' does not conform to protocol 'P'}}
// expected-error@-1 {{unavailable instance method 'foo(bar:)' was used to satisfy a requirement of protocol 'P'}}

@available(*, unavailable)
extension ConformsToP6 {
func foo(bar: Foo) { } // expected-note {{'foo(bar:)' declared here}}
}

@available(*, unavailable)
enum UnavailableEnum {
struct ConformsToP6: P {
Expand Down

0 comments on commit ddfd583

Please sign in to comment.