Skip to content

Commit d6fe625

Browse files
committed
[GenericEnvironment] Don't apply outer context substitutions before
type.subst in mapTypeIntoContext. The outer context substitutions are already applied when invoking QueryInterfaceTypeSubstitutions. Applying the context substitutions before subst also causes problems because QueryInterfaceTypeSubstitutions will return a null type if given an archetype, which manifested with opened pack element environments.
1 parent 2cc1204 commit d6fe625

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/AST/GenericEnvironment.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,6 @@ Type GenericEnvironment::mapTypeIntoContext(
635635
assert((!type->hasArchetype() || type->hasLocalArchetype()) &&
636636
"already have a contextual type");
637637

638-
type = maybeApplyOuterContextSubstitutions(type);
639638
Type result = type.subst(QueryInterfaceTypeSubstitutions(this),
640639
lookupConformance,
641640
SubstFlags::AllowLoweredTypes |

test/Constraints/pack-expansion-expressions.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,3 +553,11 @@ do {
553553
_ = (repeat overloaded(1, each a))
554554
}
555555
}
556+
557+
func configure<T, each Element>(
558+
_ item: T,
559+
with configuration: repeat (ReferenceWritableKeyPath<T, each Element>, each Element)
560+
) -> T {
561+
repeat item[keyPath: (each configuration).0] = (each configuration).1
562+
return item
563+
}

0 commit comments

Comments
 (0)