Skip to content

Commit 0513812

Browse files
committed
RequirementMachine: Don't change concrete type to ErrorType in case of a conflict
This more closely matches the existing behavior of the GSB, where conflicts are diagnosed but we don't drop all concrete type requirements on that type parameter altogether.
1 parent 5dca8c6 commit 0513812

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/AST/RequirementMachine/EquivalenceClassMap.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ remapConcreteSubstitutionSchema(CanType concreteType,
273273
/// Returns the left hand side on success (it could also return the right hand
274274
/// side; since we unified the type constructor arguments, it doesn't matter).
275275
///
276-
/// Returns the ErrorType concrete type atom on failure.
277-
static Atom unifyConcreteTypes(
276+
/// Returns true if a conflict was detected.
277+
static bool unifyConcreteTypes(
278278
Atom lhs, Atom rhs, RewriteContext &ctx,
279279
SmallVectorImpl<std::pair<MutableTerm, MutableTerm>> &inducedRules,
280280
bool debug) {
@@ -383,11 +383,10 @@ static Atom unifyConcreteTypes(
383383
if (debug) {
384384
llvm::dbgs() << "%% Concrete type conflict\n";
385385
}
386-
return Atom::forConcreteType(CanType(ErrorType::get(ctx.getASTContext())),
387-
{}, ctx);
386+
return true;
388387
}
389388

390-
return lhs;
389+
return false;
391390
}
392391

393392
void EquivalenceClass::addProperty(
@@ -428,8 +427,8 @@ void EquivalenceClass::addProperty(
428427

429428
case Atom::Kind::ConcreteType: {
430429
if (ConcreteType) {
431-
ConcreteType = unifyConcreteTypes(*ConcreteType, property,
432-
ctx, inducedRules, debug);
430+
(void) unifyConcreteTypes(*ConcreteType, property,
431+
ctx, inducedRules, debug);
433432
} else {
434433
ConcreteType = property;
435434
}

0 commit comments

Comments
 (0)