File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -826,6 +826,13 @@ Type TypeChecker::applyUnboundGenericArguments(
826
826
827
827
subs = parentType->getContextSubstitutions (decl->getDeclContext ());
828
828
skipRequirementsCheck |= parentType->hasTypeVariable ();
829
+ } else if (auto genericEnv =
830
+ decl->getDeclContext ()->getGenericEnvironmentOfContext ()) {
831
+ auto subMap = genericEnv->getForwardingSubstitutionMap ();
832
+ for (auto gp : subMap.getGenericSignature ()->getGenericParams ()) {
833
+ subs[gp->getCanonicalType ()->castTo <GenericTypeParamType>()] =
834
+ Type (gp).subst (subMap);
835
+ }
829
836
}
830
837
831
838
SourceLoc noteLoc = decl->getLoc ();
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend %s -emit-ir
2
+
3
+ // SR-9954 / rdar://problem/48223824
4
+ // Rejects well-formed that triggered a fallback diagnostic due to a bad
5
+ // substitution.
6
+ struct GenericThing < Param1, Param2> {
7
+ init ( closure: ( String ) -> ( ) ) {
8
+
9
+ }
10
+ }
11
+
12
+ struct ThingHolder < Param1> {
13
+ func acceptThing < Param2> ( thingGenerator: ( ) -> GenericThing < Param1 , Param2 > ) {
14
+
15
+ }
16
+ }
17
+
18
+ struct A { }
19
+
20
+ func demo < Param1> ( thingHolder: ThingHolder < Param1 > ) {
21
+ typealias Thing < Param2> = GenericThing < Param1 , Param2 >
22
+ thingHolder. acceptThing {
23
+ Thing< A> { string in
24
+
25
+ }
26
+ }
27
+ }
28
+
You can’t perform that action at this time.
0 commit comments