Skip to content

Commit 6a1534d

Browse files
Merge pull request #32261 from LucianoPAlmeida/comment-fix
[NFC] Clarify comment on metatype casts on TypeCheckConstraints
2 parents a6cb3ae + d975478 commit 6a1534d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3706,9 +3706,9 @@ CheckedCastKind TypeChecker::typeCheckCheckedCast(Type fromType,
37063706
else
37073707
fromRequiresClass = fromType->mayHaveSuperclass();
37083708

3709-
// Casts between protocol metatypes only succeed if the type is existential
3710-
// or if it involves generic types because they may be protocol conformances
3711-
// we can't know at compile time.
3709+
// Casts between metatypes only succeed if none of the types are existentials
3710+
// or if one is an existential and the other is a generic type because there
3711+
// may be protocol conformances unknown at compile time.
37123712
if (metatypeCast) {
37133713
if ((toExistential || fromExistential) && !(fromArchetype || toArchetype))
37143714
return failed();

0 commit comments

Comments
 (0)