mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Look through specialization while simplifying constructor locator
If type is explicitly specialized i.e. `A<Int>` in certain cases its `TypeExpr` or `OverloadedDeclRefExpr` (if type name is ambiguous) would be wrapped in `UnresolvedSpecializeExpr` which has to be looked through when simplifying `constructor member` so the anchor could point to the underlying type reference. Resolves: https://github.com/apple/swift/issues/67799 Resolves: rdar://113577294
This commit is contained in:
@@ -5724,6 +5724,13 @@ void constraints::simplifyLocator(ASTNode &anchor,
|
||||
}
|
||||
|
||||
case ConstraintLocator::ConstructorMember:
|
||||
// Look through specialization first, because it doesn't play a
|
||||
// functional role here.
|
||||
if (auto *USE = getAsExpr<UnresolvedSpecializeExpr>(anchor)) {
|
||||
anchor = USE->getSubExpr();
|
||||
range = anchor.getSourceRange();
|
||||
}
|
||||
|
||||
// - This is really an implicit 'init' MemberRef, so point at the base,
|
||||
// i.e. the TypeExpr.
|
||||
// - For re-declarations we'd get an overloaded reference
|
||||
|
||||
Reference in New Issue
Block a user