From 1fc57ad6672140546dc9bc35509fa5f263c1103b Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Wed, 10 Oct 2018 21:53:07 -0700 Subject: [PATCH] [Test] Add test case for now-fixed rdar://problem/39805133 --- ...tocol-conformance-rdar39805133-other.swift | 1 + .../protocol-conformance-rdar39805133.swift | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 test/multifile/Inputs/protocol-conformance-rdar39805133-other.swift create mode 100644 test/multifile/protocol-conformance-rdar39805133.swift diff --git a/test/multifile/Inputs/protocol-conformance-rdar39805133-other.swift b/test/multifile/Inputs/protocol-conformance-rdar39805133-other.swift new file mode 100644 index 0000000000000..d3542f04143f4 --- /dev/null +++ b/test/multifile/Inputs/protocol-conformance-rdar39805133-other.swift @@ -0,0 +1 @@ +protocol DefaultInit { init() } diff --git a/test/multifile/protocol-conformance-rdar39805133.swift b/test/multifile/protocol-conformance-rdar39805133.swift new file mode 100644 index 0000000000000..24fc37114a43f --- /dev/null +++ b/test/multifile/protocol-conformance-rdar39805133.swift @@ -0,0 +1,29 @@ +// RUN: %target-swift-frontend -emit-ir -o - -primary-file %s %S/Inputs/protocol-conformance-rdar39805133-other.swift -module-name foo +// RUN: %target-swift-frontend -emit-ir -o - %s -primary-file %S/Inputs/protocol-conformance-rdar39805133-other.swift -module-name foo + +protocol _Int : DefaultInit { + associatedtype Minus1 : _Int + associatedtype Plus1 : _Int = Inc + static var value: Int { get } +} + +struct Inc : _Int { + typealias Minus1 = T + static var value: Int { return T.value + 1 } +} + +extension _Int { + var plus1: Plus1 { return Plus1() } + var minus1: Minus1 { return Minus1() } +} + +struct _0_ : _Int { + typealias Minus1 = _0_//Underflow + static let value = 0 +} + +let _0 = _0_() +protocol AtLeast0 : _Int {} +extension _0_ : AtLeast0 {} +protocol AtLeast1 : AtLeast0 {} +extension Inc : AtLeast1, AtLeast0 where T == _0_ {}