Files
swift-mirror/test/decl/protocol/conforms/Inputs/placement_2.swift
Doug Gregor 8bd093d36b Eliminate the "ambiguous implied conformance" error.
Instead of requiring the user to disambiguate where an implied
protocol conformance goes---which they really, really don't care
about---just pick an arbitrary-but-deterministic location for the
conformance, which corresponds to the file unit in which the witness
table will be emitted. Fixes rdar://problem/21538899.

Swift SVN r30168
2015-07-13 21:56:40 +00:00

45 lines
1.7 KiB
Swift

// ---------------------------------------------------------------------------
// Multiple explicit conformances to the same protocol
// ---------------------------------------------------------------------------
extension MFExplicit1 : P1 { }
struct MFExplicit2 : P1 { } // expected-note{{'MFExplicit2' declares conformance to protocol 'P1' here}}
// ---------------------------------------------------------------------------
// Multiple implicit conformances, with no ambiguities
// ---------------------------------------------------------------------------
struct MFMultipleImplicit1 : P2a { }
struct MFMultipleImplicit3 : P4 { }
struct MFMultipleImplicit4 : P4 { }
struct MFMultipleImplicit5 : P2a { }
// ---------------------------------------------------------------------------
// Explicit conformances conflicting with inherited conformances
// ---------------------------------------------------------------------------
class MFExplicitSub1 : ImplicitSuper1 { } // expected-note{{'MFExplicitSub1' inherits conformance to protocol 'P1' from superclass here}}
// ---------------------------------------------------------------------------
// Suppression of synthesized conformances
// ---------------------------------------------------------------------------
extension MFSynthesizedClass1 : AnyObject { }
class MFSynthesizedClass2 { }
class MFSynthesizedClass3 : AnyObjectRefinement { }
class MFSynthesizedSubClass2 : MFSynthesizedClass2 { } // expected-note{{'MFSynthesizedSubClass2' inherits conformance to protocol 'AnyObject' from superclass here}}
class MFSynthesizedSubClass3 : MFSynthesizedClass1 { }
extension MFSynthesizedSubClass4 : AnyObjectRefinement { }
enum MFSynthesizedEnum1 : Int { case a }
extension MFSynthesizedEnum2 : RawRepresentable { }