Commit 38aa1d1
committed
Updates to prevent fourslash tests from failing.
Tests completionListInTypeParameterOfTypeAlias1 and 2 were failing before
this commit. The completions.ts changes are self-explanatory but the
parser.ts change is that I added semicolon as a terminator for type
parameter lists. The reason is the code in the failing test looks like:
```ts
type List1<
type List2<T> = T[];
type List4<T> = T[];
type List3<T1> = ;
```
When type parameters were not allowed to have their own type parameters
that code parsed as type `List1` with type parameters `type` and
`List2`, with a missing comma between `type` and `List2`, and then the
unexpected `<` from `List2<T>` was parsed as the list terminator for the
assumed `List1` type parameter list.
However now that type parameters are allowed to declare their own type
parameter lists, the `<` from `List2<T>` is no longer unexpected so
`List2<T> = T[]` is parsed as a syntactically correct definition of a
type parameter `List2` that has its own type parameter `T` and a default
of `T[]`. Then it ignored the unexpected semicolon and parsed the third
line in exactly the same way as the second line, as additional type
parameters of `List1`, with `List4<T>` defining its own child type
parameter `T`.
So adding semicolon as a type paramater list terminator stops the
assumed `List1` type parameter list at the end of line 2.1 parent ca237fe commit 38aa1d1
2 files changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1609 | 1609 | | |
1610 | 1610 | | |
1611 | 1611 | | |
1612 | | - | |
| 1612 | + | |
| 1613 | + | |
1613 | 1614 | | |
1614 | 1615 | | |
1615 | 1616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1776 | 1776 | | |
1777 | 1777 | | |
1778 | 1778 | | |
| 1779 | + | |
1779 | 1780 | | |
1780 | 1781 | | |
1781 | 1782 | | |
| |||
1803 | 1804 | | |
1804 | 1805 | | |
1805 | 1806 | | |
| 1807 | + | |
1806 | 1808 | | |
1807 | 1809 | | |
1808 | 1810 | | |
| |||
0 commit comments