@@ -1524,21 +1524,6 @@ TypeChecker::lookupPrecedenceGroup(DeclContext *dc, Identifier name,
15241524 return PrecedenceGroupLookupResult (dc, name, std::move (groups));
15251525}
15261526
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-
15421527// / Validate the given operator declaration.
15431528// /
15441529// / This establishes key invariants, such as an InfixOperatorDecl's
@@ -1555,15 +1540,13 @@ OperatorPrecedenceGroupRequest::evaluate(Evaluator &evaluator,
15551540 auto loc = IOD->getPrecedenceGroupLoc ();
15561541 auto groups = TypeChecker::lookupPrecedenceGroup (dc, name, loc);
15571542
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 )
15631545 return groups.getSingleOrDiagnose (loc);
15641546
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.
15671550 ctx.Diags .diagnose (IOD->getColonLoc (),
15681551 diag::operator_decl_remove_designated_types)
15691552 .fixItRemove ({IOD->getColonLoc (), loc});
0 commit comments