Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0196-sr9954.swift
Doug Gregor 0216e3b9d3 [Type checker] Compute correct contextual substitutions for local generics.
When applying generic arguments to a local generic type within a generic
function, ensure that we correctly produce the contextual substitutions from
the generic function. Fixed with Pavel, who painstakingly tracked down
the bogus substitution.

Fixes SR-9954 / rdar://problem/48223824.
2019-06-12 16:31:32 -07:00

29 lines
595 B
Swift

// RUN: %target-swift-frontend %s -emit-ir
// SR-9954 / rdar://problem/48223824
// Rejects well-formed that triggered a fallback diagnostic due to a bad
// substitution.
struct GenericThing <Param1, Param2> {
init (closure: (String)->()) {
}
}
struct ThingHolder <Param1> {
func acceptThing <Param2> (thingGenerator: ()->GenericThing<Param1, Param2>) {
}
}
struct A { }
func demo <Param1> (thingHolder: ThingHolder<Param1>) {
typealias Thing <Param2> = GenericThing<Param1, Param2>
thingHolder.acceptThing {
Thing<A> { string in
}
}
}