Skip to content

Commit 389a082

Browse files
committed
GSB: Assert that concrete types should not have any other requirements
This sort of thing is not valid and should never happen: <T where T : P, T == Int>
1 parent 7442e3a commit 389a082

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8313,6 +8313,14 @@ static void checkGenericSignature(CanGenericSignature canSig,
83138313
}
83148314
}
83158315

8316+
// If we have a concrete same-type requirement, we shouldn't have any
8317+
// other requirements on the same type.
8318+
if (reqt.getKind() == RequirementKind::SameType &&
8319+
!reqt.getSecondType()->isTypeParameter()) {
8320+
assert(compareLHS < 0 &&
8321+
"Concrete subject type should not have any other requirements");
8322+
}
8323+
83168324
assert(compareRequirements(&prevReqt, &reqt) < 0 &&
83178325
"Out-of-order requirements");
83188326
}

0 commit comments

Comments
 (0)