Repository navigation
Commit 9bf09ef
committed
Instantiate an instantiation expression with the type arguments given
An instantiation expression whose type arguments did not satisfy their
constraints kept the generic signature, unlike a type reference, whose
type is that of the type arguments given, with the constraints checked
separately. Checking the constraints while computing the type made both
depend on order: in
declare function b<U extends A = A>(): U;
interface A<T = number> {
value: T;
child: typeof b<A<T>>;
}
checking A<T> against the constraint A needs the variances of A, which
need the type of child. Checking A first measured the variances with
child incomplete, which missed the constraint error, while querying
child first reported it and kept the generic signature, giving child a
different type. The signature is now instantiated with the type
arguments given, as for a type reference, and the constraints are
checked once the types they need are resolved, so child has the same
type and error in every order.
Type argument completions in a decorator read the signatures of its
expression, which now has the type arguments being typed applied, so
they read those of the expression the type arguments apply to.
Fixes 61982
For 528921 parent 804869d commit 9bf09ef
5 files changed
Lines changed: 44 additions & 8 deletions
File tree
- tsc
- internal/checker
- testdata/baselines/reference/compiler
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11117 | 11117 | | |
11118 | 11118 | | |
11119 | 11119 | | |
11120 | | - | |
11121 | | - | |
11122 | | - | |
11123 | | - | |
11124 | | - | |
| 11120 | + | |
| 11121 | + | |
| 11122 | + | |
| 11123 | + | |
| 11124 | + | |
| 11125 | + | |
| 11126 | + | |
| 11127 | + | |
| 11128 | + | |
11125 | 11129 | | |
11126 | 11130 | | |
11127 | 11131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
709 | | - | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
710 | 715 | | |
711 | 716 | | |
712 | 717 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments