@@ -5271,14 +5271,10 @@ bool MissingGenericArgumentsFailure::diagnoseAsError() {
52715271 scopedParameters[base].push_back (GP);
52725272 });
52735273
5274- // FIXME: this code should be generalized now that we can anchor the
5275- // fixes on the TypeRepr with the missing generic arg.
52765274 if (!isScoped) {
5277- assert (getAnchor ().is <Expr *>() || getAnchor ().is <TypeRepr *>());
5278- if (auto *expr = getAsExpr (getAnchor ()))
5279- return diagnoseForAnchor (expr, Parameters);
5280-
5281- return diagnoseForAnchor (getAnchor ().get <TypeRepr *>(), Parameters);
5275+ auto anchor = getAnchor ();
5276+ assert (anchor.is <Expr *>() || anchor.is <TypeRepr *>());
5277+ return diagnoseForAnchor (anchor, Parameters);
52825278 }
52835279
52845280 bool diagnosed = false ;
@@ -5288,7 +5284,7 @@ bool MissingGenericArgumentsFailure::diagnoseAsError() {
52885284}
52895285
52905286bool MissingGenericArgumentsFailure::diagnoseForAnchor (
5291- Anchor anchor, ArrayRef<GenericTypeParamType *> params) const {
5287+ ASTNode anchor, ArrayRef<GenericTypeParamType *> params) const {
52925288 bool diagnosed = false ;
52935289 for (auto *GP : params)
52945290 diagnosed |= diagnoseParameter (anchor, GP);
@@ -5322,11 +5318,9 @@ bool MissingGenericArgumentsFailure::diagnoseForAnchor(
53225318}
53235319
53245320bool MissingGenericArgumentsFailure::diagnoseParameter (
5325- Anchor anchor, GenericTypeParamType *GP) const {
5321+ ASTNode anchor, GenericTypeParamType *GP) const {
53265322 auto &solution = getSolution ();
5327-
5328- auto loc = anchor.is <Expr *>() ? anchor.get <Expr *>()->getLoc ()
5329- : anchor.get <TypeRepr *>()->getLoc ();
5323+ auto loc = ::getLoc (anchor);
53305324
53315325 auto *locator = getLocator ();
53325326 // Type variables associated with missing generic parameters are
@@ -5372,7 +5366,7 @@ bool MissingGenericArgumentsFailure::diagnoseParameter(
53725366}
53735367
53745368void MissingGenericArgumentsFailure::emitGenericSignatureNote (
5375- Anchor anchor) const {
5369+ ASTNode anchor) const {
53765370 auto &solution = getSolution ();
53775371 auto *paramDC = getDeclContext ();
53785372
0 commit comments