Files
swift-mirror/test/decl/protocol/conforms/fixit_stub_amiguity.swift
Alex Hoppen 577727ad55 Remove DiagnosticsEditorMode
Migrate the last diagnostic to be independent of `DiagnosticEditorMode` and remove that option.

rdar://133111163
2024-08-14 11:24:31 -07:00

33 lines
1.2 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/Inputs/fixit_stub_ambiguity_module.swift -module-name Ambiguous -emit-module -parse-as-library -o %t
// RUN: %target-swift-frontend -typecheck %s -I %t -verify
import Ambiguous
struct Notification {}
struct MyApp: AmbiguousFuncProtocol {
// expected-error@-1 {{type 'MyApp' does not conform to protocol 'AmbiguousFuncProtocol'}}
// 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 {{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
// in the same module:
/*
struct Outer { struct Inner {} }
struct Inner {}
protocol P { func foo(_ : Inner) }
extension Outer: P {} // fixit `func foo(_ : Inner)` picks up `Outer.Inner` by accident
The ASTPrinter doesn't currently have enough context to declare this situation ambiguous.
*/