Skip to content

Commit 1a8b66e

Browse files
authored
Merge pull request #17062 from slavapestov/fix-type-alias-validation-forum-bug-4.2
Sema: Fix validateDeclForNameLookup() to use the right flags when resolving type alias underlying type [4.2]
2 parents d6b432a + 9e34516 commit 1a8b66e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7924,8 +7924,10 @@ void TypeChecker::validateDeclForNameLookup(ValueDecl *D) {
79247924
validateAccessControl(typealias);
79257925

79267926
ProtocolRequirementTypeResolver resolver;
7927+
TypeResolutionOptions options =
7928+
TypeResolutionFlags::TypeAliasUnderlyingType;
79277929
if (validateType(typealias->getUnderlyingTypeLoc(),
7928-
typealias, TypeResolutionOptions(), &resolver)) {
7930+
typealias, options, &resolver)) {
79297931
typealias->setInvalid();
79307932
typealias->getUnderlyingTypeLoc().setInvalidType(Context);
79317933
}

test/decl/typealias/protocol.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,12 @@ struct Y11: P11 { }
290290
extension P11 {
291291
func foo(_: X11<Self.A>) { }
292292
}
293+
294+
// Ordering issue
295+
struct SomeConformingType : UnboundGenericAliasProto {
296+
func f(_: G<Int>) {}
297+
}
298+
299+
protocol UnboundGenericAliasProto {
300+
typealias G = X
301+
}

0 commit comments

Comments
 (0)