Skip to content

Commit 88d6559

Browse files
committed
[GSB] Map invalid subject types in requirement constraints to ErrorType
Resolves SR-12072 and rdar://58941114
1 parent 824a71d commit 88d6559

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4361,6 +4361,8 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement(
43614361

43624362
if (subjectType->is<DependentMemberType>()) {
43634363
subjectType = resolveDependentMemberTypes(*this, subjectType);
4364+
} else {
4365+
subjectType = ErrorType::get(subjectType);
43644366
}
43654367

43664368
auto invalidConstraint = Constraint<Type>(
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: not %target-swift-frontend %s -typecheck
2+
3+
class C {}
4+
protocol Foo {
5+
associatedtype X where C: X
6+
}

0 commit comments

Comments
 (0)