@@ -1524,21 +1524,6 @@ TypeChecker::lookupPrecedenceGroup(DeclContext *dc, Identifier name,
1524
1524
return PrecedenceGroupLookupResult (dc, name, std::move (groups));
1525
1525
}
1526
1526
1527
- static bool canResolveSingleNominalTypeDecl (
1528
- DeclContext *DC, SourceLoc loc, Identifier ident, ASTContext &Ctx) {
1529
- auto *TyR = new (Ctx) SimpleIdentTypeRepr (DeclNameLoc (loc),
1530
- DeclNameRef (ident));
1531
-
1532
- TypeResolutionOptions options{TypeResolverContext::TypeAliasDecl};
1533
- options |= TypeResolutionFlags::SilenceErrors;
1534
- const auto result =
1535
- TypeResolution::forInterface (DC, options, /* unboundTyOpener*/ nullptr ,
1536
- /* placeholderHandler*/ nullptr )
1537
- .resolveType (TyR);
1538
-
1539
- return !result->hasError ();
1540
- }
1541
-
1542
1527
// / Validate the given operator declaration.
1543
1528
// /
1544
1529
// / This establishes key invariants, such as an InfixOperatorDecl's
@@ -1555,15 +1540,13 @@ OperatorPrecedenceGroupRequest::evaluate(Evaluator &evaluator,
1555
1540
auto loc = IOD->getPrecedenceGroupLoc ();
1556
1541
auto groups = TypeChecker::lookupPrecedenceGroup (dc, name, loc);
1557
1542
1558
- bool wasActuallyADesignatedType = !groups.hasResults () &&
1559
- ctx.TypeCheckerOpts .EnableOperatorDesignatedTypes &&
1560
- canResolveSingleNominalTypeDecl (dc, loc, name, ctx);
1561
-
1562
- if (!wasActuallyADesignatedType)
1543
+ if (groups.hasResults () ||
1544
+ !ctx.TypeCheckerOpts .EnableOperatorDesignatedTypes )
1563
1545
return groups.getSingleOrDiagnose (loc);
1564
1546
1565
- // Warn about the designated type, then fall through to look up
1566
- // DefaultPrecedence as though `PrecedenceGroupName` had never been set.
1547
+ // We didn't find the named precedence group and designated types are
1548
+ // enabled, so we will assume that it was actually a designated type. Warn
1549
+ // and fall through as though `PrecedenceGroupName` had never been set.
1567
1550
ctx.Diags .diagnose (IOD->getColonLoc (),
1568
1551
diag::operator_decl_remove_designated_types)
1569
1552
.fixItRemove ({IOD->getColonLoc (), loc});
0 commit comments