Skip to content

Commit 9665091

Browse files
committed
[CSBindings] Don't attempt to join types that contain holes
1 parent 8f2e53c commit 9665091

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/AST/TypeJoinMeet.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ struct TypeJoin : CanTypeVisitor<TypeJoin, CanType> {
8787
assert(!first->hasTypeVariable() && !second->hasTypeVariable() &&
8888
"Cannot compute join of types involving type variables");
8989

90+
assert(!first->hasHole() && !second->hasHole() &&
91+
"Cannot compute join of types involving type holes");
92+
9093
assert(first->getWithoutSpecifierType()->isEqual(first) &&
9194
"Expected simple type!");
9295
assert(second->getWithoutSpecifierType()->isEqual(second) &&

lib/Sema/CSBindings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ void ConstraintSystem::PotentialBindings::addPotentialBinding(
481481
if (binding.Kind == AllowedBindingKind::Supertypes &&
482482
!binding.BindingType->hasUnresolvedType() &&
483483
!binding.BindingType->hasTypeVariable() &&
484+
!binding.BindingType->hasHole() &&
484485
!binding.BindingType->hasUnboundGenericType() &&
485486
!binding.hasDefaultedLiteralProtocol() &&
486487
!binding.isDefaultableBinding() && allowJoinMeet) {

0 commit comments

Comments
 (0)