@@ -5271,14 +5271,10 @@ bool MissingGenericArgumentsFailure::diagnoseAsError() {
5271
5271
scopedParameters[base].push_back (GP);
5272
5272
});
5273
5273
5274
- // FIXME: this code should be generalized now that we can anchor the
5275
- // fixes on the TypeRepr with the missing generic arg.
5276
5274
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);
5282
5278
}
5283
5279
5284
5280
bool diagnosed = false ;
@@ -5288,7 +5284,7 @@ bool MissingGenericArgumentsFailure::diagnoseAsError() {
5288
5284
}
5289
5285
5290
5286
bool MissingGenericArgumentsFailure::diagnoseForAnchor (
5291
- Anchor anchor, ArrayRef<GenericTypeParamType *> params) const {
5287
+ ASTNode anchor, ArrayRef<GenericTypeParamType *> params) const {
5292
5288
bool diagnosed = false ;
5293
5289
for (auto *GP : params)
5294
5290
diagnosed |= diagnoseParameter (anchor, GP);
@@ -5322,11 +5318,9 @@ bool MissingGenericArgumentsFailure::diagnoseForAnchor(
5322
5318
}
5323
5319
5324
5320
bool MissingGenericArgumentsFailure::diagnoseParameter (
5325
- Anchor anchor, GenericTypeParamType *GP) const {
5321
+ ASTNode anchor, GenericTypeParamType *GP) const {
5326
5322
auto &solution = getSolution ();
5327
-
5328
- auto loc = anchor.is <Expr *>() ? anchor.get <Expr *>()->getLoc ()
5329
- : anchor.get <TypeRepr *>()->getLoc ();
5323
+ auto loc = ::getLoc (anchor);
5330
5324
5331
5325
auto *locator = getLocator ();
5332
5326
// Type variables associated with missing generic parameters are
@@ -5372,7 +5366,7 @@ bool MissingGenericArgumentsFailure::diagnoseParameter(
5372
5366
}
5373
5367
5374
5368
void MissingGenericArgumentsFailure::emitGenericSignatureNote (
5375
- Anchor anchor) const {
5369
+ ASTNode anchor) const {
5376
5370
auto &solution = getSolution ();
5377
5371
auto *paramDC = getDeclContext ();
5378
5372
0 commit comments