Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0161-issue-49119.swift
Alex Hoppen 66104395d7 [Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.

To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.

rdar://129283608
2024-08-07 14:01:30 -07:00

19 lines
727 B
Swift

// RUN: %target-typecheck-verify-swift
// https://github.com/apple/swift/issues/49119
protocol P {
associatedtype A: P // expected-note {{protocol requires nested type 'A'}}
}
struct Type<Param> {}
extension Type: P where Param: P, Param.A == Type<Param> {
// expected-error@-1 {{extension of generic struct 'Type' has self-referential generic requirements}}
// expected-note@-2 {{through reference here}}
// expected-error@-3 {{type 'Type<Param>' does not conform to protocol 'P'}}
// expected-note@-4 {{add stubs for conformance}}
typealias A = Param
// expected-note@-1 2{{through reference here}}
// expected-note@-2 {{possibly intended match 'Type<Param>.A' (aka 'Param') does not conform to 'P'}}
}