Skip to content

Commit 4548b2a

Browse files
authored
Merge pull request swiftlang#71817 from xedin/rdar-122598934
[ConstraintSystem] Account for situations when witness for associated…
2 parents a2a2083 + 239bfac commit 4548b2a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4219,7 +4219,7 @@ struct TypeSimplifier {
42194219

42204220
auto result = conformance.getAssociatedType(
42214221
lookupBaseType, assocType->getDeclaredInterfaceType());
4222-
if (!result->hasError())
4222+
if (result && !result->hasError())
42234223
return result;
42244224
}
42254225

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: not %target-swift-frontend %s -typecheck
2+
3+
public protocol P1 {
4+
associatedtype A
5+
6+
init(a: A)
7+
}
8+
9+
public protocol P2: P1 {
10+
associatedtype B
11+
12+
init()
13+
}
14+
15+
extension P2 where A == B {
16+
public init() { fatalError() }
17+
public init(a: B) { fatalError() }
18+
}
19+
20+
public protocol P3: P2 {
21+
associatedtype B = Self
22+
23+
static var y: B { get }
24+
}
25+
26+
public struct S: P3 {
27+
public static let x = S(c: 1)
28+
public static let y = S(c: 2)
29+
30+
public init(c: Int) {}
31+
}

0 commit comments

Comments
 (0)