You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix conditional type type parameter leak
* Monkey with comment text per code review
* Conditionally clone type param
* Reuse input array and avoid making mapper where possible
// When we're looking at making an inference for an infer type, when we get its constraint, it'll automagically be
15867
+
// instantiated with the context, so it doesn't need the mapper for the inference contex - however the constraint
15868
+
// may refer to another _root_, _uncloned_ `infer` type parameter [1], or to something mapped by `mapper` [2].
15869
+
// [1] Eg, if we have `Foo<T, U extends T>` and `Foo<number, infer B>` - `B` is constrained to `T`, which, in turn, has been instantiated
15870
+
// as `number`
15871
+
// Conversely, if we have `Foo<infer A, infer B>`, `B` is still constrained to `T` and `T` is instantiated as `A`
15872
+
// [2] Eg, if we have `Foo<T, U extends T>` and `Foo<Q, infer B>` where `Q` is mapped by `mapper` into `number` - `B` is constrained to `T`
15873
+
// which is in turn instantiated as `Q`, which is in turn instantiated as `number`.
15874
+
// So we need to:
15875
+
// * Clone the type parameters so their constraints can be instantiated in the context of `mapper` (otherwise theyd only get inference context information)
15876
+
// * Set the clones to both map the conditional's enclosing `mapper` and the original params
15877
+
// * instantiate the extends type with the clones
15878
+
// * incorporate all of the component mappers into the combined mapper for the true and false members
15879
+
// This means we have three mappers that need applying:
15880
+
// * The original `mapper` used to create this conditional
15881
+
// * The mapper that maps the old root type parameter to the clone (`freshMapper`)
15882
+
// * The mapper that maps the clone to its inference result (`context.mapper`)
0 commit comments