Skip to content

Commit b6676fa

Browse files
committed
Sema: Move ConstructorDecl hack out of getMemberReferenceTypeFromOpenedType()
1 parent 27c52eb commit b6676fa

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/Sema/TypeOfReference.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,12 +1555,6 @@ Type ConstraintSystem::getMemberReferenceTypeFromOpenedType(
15551555
Type &openedType, Type baseObjTy, ValueDecl *value, DeclContext *outerDC,
15561556
ConstraintLocator *locator, bool hasAppliedSelf, bool isDynamicLookup,
15571557
ArrayRef<OpenedType> replacements) {
1558-
if (outerDC->getSelfClassDecl()) {
1559-
if (isa<ConstructorDecl>(value)) {
1560-
openedType = openedType->withCovariantResultType();
1561-
}
1562-
}
1563-
15641558
// Check if we need to apply a layer of optionality to the uncurried type.
15651559
if (!isRequirementOrWitness(locator)) {
15661560
if (isDynamicLookup || value->getAttrs().hasAttribute<OptionalAttr>()) {
@@ -1767,6 +1761,12 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
17671761
if (interfaceType->is<ErrorType>() || isa<MacroDecl>(value))
17681762
return { interfaceType, interfaceType, interfaceType, interfaceType, Type() };
17691763

1764+
if (outerDC->getSelfClassDecl()) {
1765+
if (isa<ConstructorDecl>(value)) {
1766+
interfaceType = interfaceType->withCovariantResultType();
1767+
}
1768+
}
1769+
17701770
// This is the easy case.
17711771
openedType = interfaceType->castTo<AnyFunctionType>();
17721772

0 commit comments

Comments
 (0)