Commit Graph

3 Commits

Author SHA1 Message Date
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
Huon Wilson
ae1b06b041 [Sema] Display simplified conditional conformance fixits on the command line.
Fixes rdar://problem/39170601 and SR-7352.
2018-04-05 11:41:53 +10:00
Huon Wilson
c1044529ff [AST] Don't allow conditional conformances to imply others.
Many uses of conditional conformance to protocols with super-protocols
are for wrappers, where the conformances to those super-protocols
usually ends up using weaker bounds, such as:

  struct MyWrapper<Wrapped: Sequence> {}
  extension Wrapped: Sequence {} // Wrapped: Sequence
  extension Wrapped: Collection where Wrapped: Collection {} // *
  extension Wrapped: BidirectionalCollection where Wrapped: BidirectionalCollection {}

If this code was instead written:

  struct MyWrapper<Wrapped: Sequence> {}
  extension Wrapped: Sequence {} // Wrapped: Sequence
  extension Wrapped: BidirectionalCollection where Wrapped: BidirectionalCollection {}

Inferring a Collection conformance would have to mean

  extension Wrapped: Collection where Wrapped: BidirectionalCollection {}

which is unnecessarily strong.

It is a breaking change to change a protocol bound, and so we're
thinking we'd prefer that the compiler didn't magic up that incorrect
conformance. It also only is a small change (and the compiler even
suggests it, with a fixit) to explicitly get the implying behaviour:
declare the conformance explicitly.

  extension Wrapped: Collection, BidirectionalCollection where Wrapped: BidirectionalCollection {}

Fixes rdar://problem/36499373.
2018-04-04 10:34:33 +10:00