Skip to content

Commit 4f3f589

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents afafae4 + b179a39 commit 4f3f589

File tree

8 files changed

+6
-42
lines changed

8 files changed

+6
-42
lines changed

lib/Sema/CSApply.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3132,9 +3132,6 @@ namespace {
31323132
nameLoc.getBaseNameLoc(), toType));
31333133
}
31343134

3135-
case OverloadChoiceKind::BaseType:
3136-
return base;
3137-
31383135
case OverloadChoiceKind::KeyPathApplication:
31393136
llvm_unreachable("should only happen in a subscript");
31403137

lib/Sema/CSRanking.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ static bool sameOverloadChoice(const OverloadChoice &x,
143143
return false;
144144

145145
switch (x.getKind()) {
146-
case OverloadChoiceKind::BaseType:
147146
case OverloadChoiceKind::KeyPathApplication:
148147
// FIXME: Compare base types after substitution?
149148
return true;
@@ -895,7 +894,6 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
895894
case OverloadChoiceKind::TupleIndex:
896895
continue;
897896

898-
case OverloadChoiceKind::BaseType:
899897
case OverloadChoiceKind::KeyPathApplication:
900898
llvm_unreachable("Never considered different");
901899

lib/Sema/CSSimplify.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ static bool areConservativelyCompatibleArgumentLabels(
135135
decl = choice.getDecl();
136136
break;
137137

138-
case OverloadChoiceKind::BaseType:
139138
// KeyPath application is not filtered in `performMemberLookup`.
140139
case OverloadChoiceKind::KeyPathApplication:
141140
case OverloadChoiceKind::DynamicMemberLookup:
@@ -2395,10 +2394,7 @@ ConstraintSystem::matchTypesBindTypeVar(
23952394
TypeMatchOptions flags, ConstraintLocatorBuilder locator,
23962395
llvm::function_ref<TypeMatchResult()> formUnsolvedResult) {
23972396
assert(typeVar->is<TypeVariableType>() && "Expected a type variable!");
2398-
// FIXME: Due to some SE-0110 related code farther up we can end
2399-
// up with type variables wrapped in parens that will trip this
2400-
// assert. For now, maintain the existing behavior.
2401-
// assert(!type->is<TypeVariableType>() && "Expected a non-type variable!");
2397+
assert(!type->is<TypeVariableType>() && "Expected a non-type variable!");
24022398

24032399
// Simplify the right-hand type and perform the "occurs" check.
24042400
typeVar = getRepresentative(typeVar);
@@ -4105,14 +4101,8 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
41054101
return getTypeMatchSuccess();
41064102
}
41074103

4108-
assert((type1->is<TypeVariableType>() || type2->is<TypeVariableType>()) &&
4109-
"Expected a type variable!");
4110-
// FIXME: Due to some SE-0110 related code farther up we can end
4111-
// up with type variables wrapped in parens that will trip this
4112-
// assert. For now, maintain the existing behavior.
4113-
// assert(
4114-
// (!type1->is<TypeVariableType>() || !type2->is<TypeVariableType>())
4115-
// && "Expected a non-type variable!");
4104+
assert((type1->is<TypeVariableType>() != type2->is<TypeVariableType>()) &&
4105+
"Expected a type variable and a non type variable!");
41164106

41174107
auto *typeVar = typeVar1 ? typeVar1 : typeVar2;
41184108
auto type = typeVar1 ? type2 : type1;

lib/Sema/Constraint.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,6 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm) const {
405405
case OverloadChoiceKind::KeyPathDynamicMemberLookup:
406406
Out << "dynamic member lookup '" << overload.getName() << "'";
407407
break;
408-
case OverloadChoiceKind::BaseType:
409-
Out << "base type";
410-
break;
411408
case OverloadChoiceKind::TupleIndex:
412409
Out << "tuple index " << overload.getTupleIndex();
413410
break;

lib/Sema/ConstraintGraph.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ void ConstraintGraph::mergeNodes(TypeVariableType *typeVar1,
428428
}
429429

430430
void ConstraintGraph::bindTypeVariable(TypeVariableType *typeVar, Type fixed) {
431+
assert(!fixed->is<TypeVariableType>() &&
432+
"Cannot bind to type variable; merge equivalence classes instead");
433+
431434
// If there are no type variables in the fixed type, there's nothing to do.
432435
if (!fixed->hasTypeVariable())
433436
return;

lib/Sema/ConstraintSystem.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,6 @@ Type ConstraintSystem::getEffectiveOverloadType(const OverloadChoice &overload,
15491549
// Declaration choices are handled below.
15501550
break;
15511551

1552-
case OverloadChoiceKind::BaseType:
15531552
case OverloadChoiceKind::DeclViaBridge:
15541553
case OverloadChoiceKind::DeclViaDynamic:
15551554
case OverloadChoiceKind::DeclViaUnwrappedOptional:
@@ -1918,7 +1917,6 @@ std::pair<Type, bool> ConstraintSystem::adjustTypeOfOverloadReference(
19181917
case OverloadChoiceKind::DeclViaBridge:
19191918
case OverloadChoiceKind::DeclViaUnwrappedOptional:
19201919
case OverloadChoiceKind::TupleIndex:
1921-
case OverloadChoiceKind::BaseType:
19221920
case OverloadChoiceKind::KeyPathApplication:
19231921
return {refType, bindConstraintCreated};
19241922
case OverloadChoiceKind::DeclViaDynamic: {
@@ -2020,7 +2018,6 @@ void ConstraintSystem::bindOverloadType(
20202018
case OverloadChoiceKind::DeclViaBridge:
20212019
case OverloadChoiceKind::DeclViaUnwrappedOptional:
20222020
case OverloadChoiceKind::TupleIndex:
2023-
case OverloadChoiceKind::BaseType:
20242021
case OverloadChoiceKind::KeyPathApplication:
20252022
case OverloadChoiceKind::DeclViaDynamic:
20262023
bindTypeOrIUO(openedType);
@@ -2272,10 +2269,6 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
22722269
break;
22732270
}
22742271

2275-
case OverloadChoiceKind::BaseType:
2276-
refType = choice.getBaseType();
2277-
break;
2278-
22792272
case OverloadChoiceKind::TupleIndex:
22802273
if (auto lvalueTy = choice.getBaseType()->getAs<LValueType>()) {
22812274
// When the base of a tuple lvalue, the member is always an lvalue.
@@ -2532,7 +2525,6 @@ DeclName OverloadChoice::getName() const {
25322525
case OverloadChoiceKind::KeyPathDynamicMemberLookup:
25332526
return DeclName(DynamicMember.getPointer());
25342527

2535-
case OverloadChoiceKind::BaseType:
25362528
case OverloadChoiceKind::TupleIndex:
25372529
llvm_unreachable("no name!");
25382530
}
@@ -3246,7 +3238,6 @@ bool ConstraintSystem::diagnoseAmbiguity(ArrayRef<Solution> solutions) {
32463238
// want them to noise up unrelated subscript diagnostics.
32473239
break;
32483240

3249-
case OverloadChoiceKind::BaseType:
32503241
case OverloadChoiceKind::TupleIndex:
32513242
// FIXME: Actually diagnose something here.
32523243
break;

lib/Sema/OverloadChoice.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ enum class OverloadChoiceKind : int {
4040
/// found via dynamic lookup and, therefore, might not actually be
4141
/// available at runtime.
4242
DeclViaDynamic,
43-
/// The overload choice equates the member type with the
44-
/// base type. Used for unresolved member expressions like ".none" that
45-
/// refer to enum members with unit type.
46-
BaseType,
4743
/// The overload choice selects a key path subscripting operation.
4844
KeyPathApplication,
4945
/// The member is looked up using @dynamicMemberLookup.

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,10 +3175,6 @@ void Solution::dump(raw_ostream &out) const {
31753175
<< ovl.second.openedType->getString(PO) << "\n";
31763176
break;
31773177

3178-
case OverloadChoiceKind::BaseType:
3179-
out << "base type " << choice.getBaseType()->getString(PO) << "\n";
3180-
break;
3181-
31823178
case OverloadChoiceKind::KeyPathApplication:
31833179
out << "key path application root "
31843180
<< choice.getBaseType()->getString(PO) << "\n";
@@ -3381,10 +3377,6 @@ void ConstraintSystem::print(raw_ostream &out) const {
33813377
<< resolved.openedType->getString(PO) << "\n";
33823378
break;
33833379

3384-
case OverloadChoiceKind::BaseType:
3385-
out << "base type " << choice.getBaseType()->getString(PO) << "\n";
3386-
break;
3387-
33883380
case OverloadChoiceKind::KeyPathApplication:
33893381
out << "key path application root "
33903382
<< choice.getBaseType()->getString(PO) << "\n";

0 commit comments

Comments
 (0)