File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -13595,15 +13595,36 @@ ConstraintSystem::simplifyExplicitGenericArgumentsConstraint(
13595
13595
}
13596
13596
13597
13597
decl = overloadChoice.getDecl();
13598
+
13598
13599
auto openedOverloadTypes = getOpenedTypes(overloadLocator);
13599
13600
openedTypes.append(openedOverloadTypes.begin(), openedOverloadTypes.end());
13600
13601
}
13601
13602
13602
- auto genericContext = decl->getAsGenericContext();
13603
- if (!genericContext)
13603
+ std::function<GenericParamList *(ValueDecl *)> getGenericParams =
13604
+ [&](ValueDecl *decl) -> GenericParamList * {
13605
+ auto genericContext = decl->getAsGenericContext();
13606
+ if (!genericContext)
13607
+ return nullptr;
13608
+
13609
+ auto genericParams = genericContext->getGenericParams();
13610
+ if (!genericParams || genericParams->size() == 0) {
13611
+ // If declaration is a non-generic typealias, let's point
13612
+ // to the underlying generic declaration.
13613
+ if (auto *TA = dyn_cast<TypeAliasDecl>(decl)) {
13614
+ if (TA->isGeneric())
13615
+ return nullptr;
13616
+ if (auto underlying = TA->getUnderlyingType()->getAnyNominal())
13617
+ return getGenericParams(underlying);
13618
+ }
13619
+ }
13620
+
13621
+ return genericParams;
13622
+ };
13623
+
13624
+ if (!decl->getAsGenericContext())
13604
13625
return SolutionKind::Error;
13605
13626
13606
- auto genericParams = genericContext-> getGenericParams();
13627
+ auto genericParams = getGenericParams(decl );
13607
13628
if (!genericParams || genericParams->size() == 0) {
13608
13629
// FIXME: Record an error here that we're ignoring the parameters.
13609
13630
return SolutionKind::Solved;
You can’t perform that action at this time.
0 commit comments