File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -645,10 +645,11 @@ Type TypeChecker::resolveTypeInContext(
645
645
}
646
646
}
647
647
}
648
-
648
+
649
649
// Finally, substitute the base type into the member type.
650
650
return substMemberTypeWithBase (fromDC->getParentModule (), typeDecl,
651
- selfType, resolution.usesArchetypes ());
651
+ selfType, resolution.usesArchetypes (),
652
+ resolution.getStage ());
652
653
}
653
654
654
655
static TypeResolutionOptions
@@ -3362,7 +3363,8 @@ Type TypeResolver::buildProtocolType(
3362
3363
Type TypeChecker::substMemberTypeWithBase (ModuleDecl *module ,
3363
3364
TypeDecl *member,
3364
3365
Type baseTy,
3365
- bool useArchetypes) {
3366
+ bool useArchetypes,
3367
+ TypeResolutionStage stage) {
3366
3368
Type sugaredBaseTy = baseTy;
3367
3369
3368
3370
// For type members of a base class, make sure we use the right
@@ -3422,8 +3424,9 @@ Type TypeChecker::substMemberTypeWithBase(ModuleDecl *module,
3422
3424
}
3423
3425
3424
3426
Type resultType;
3425
- auto memberType = aliasDecl ? aliasDecl->getUnderlyingTypeLoc (). getType ()
3427
+ auto memberType = aliasDecl ? aliasDecl->getStructuralType ()
3426
3428
: member->getDeclaredInterfaceType ();
3429
+
3427
3430
SubstitutionMap subs;
3428
3431
if (baseTy) {
3429
3432
// Cope with the presence of unbound generic types, which are ill-formed
Original file line number Diff line number Diff line change 26
26
#include " swift/AST/LazyResolver.h"
27
27
#include " swift/AST/NameLookup.h"
28
28
#include " swift/AST/TypeRefinementContext.h"
29
+ #include " swift/AST/TypeResolutionStage.h"
29
30
#include " swift/Parse/Lexer.h"
30
31
#include " swift/Basic/OptionSet.h"
31
32
#include " swift/Config.h"
@@ -865,8 +866,11 @@ class TypeChecker final : public LazyResolver {
865
866
// / member.
866
867
// / \param useArchetypes Whether to use context archetypes for outer generic
867
868
// / parameters if the class is nested inside a generic function.
869
+ // / \param stage The type resolution stage for type validation,
870
+ // / defaults to Interface.
868
871
static Type substMemberTypeWithBase (ModuleDecl *module , TypeDecl *member,
869
- Type baseTy, bool useArchetypes = true );
872
+ Type baseTy, bool useArchetypes = true ,
873
+ TypeResolutionStage stage = TypeResolutionStage::Interface);
870
874
871
875
// / Determine whether one type is a subtype of another.
872
876
// /
You can’t perform that action at this time.
0 commit comments