forked from microsoft/TypeScript
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Elaborate readonly array/tuple relation errors. Fixes microsoft#35060
- Loading branch information
Quincy Babin
committed
Nov 13, 2019
1 parent
aa39080
commit c948d6f
Showing
7 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/readOnlyArrayAndTuplesAssignmentElaboration.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
tests/cases/compiler/readOnlyArrayAndTuplesAssignmentElaboration.ts(4,7): error TS4111: The type 'readonly [0]' is 'readonly' and is incompatible with type 'readonly []'. | ||
Types of property 'length' are incompatible. | ||
Type '1' is not assignable to type '0'. | ||
tests/cases/compiler/readOnlyArrayAndTuplesAssignmentElaboration.ts(5,7): error TS4111: The type 'readonly [0]' is 'readonly' and is incompatible with type 'readonly [1]'. | ||
Type '0' is not assignable to type '1'. | ||
|
||
|
||
==== tests/cases/compiler/readOnlyArrayAndTuplesAssignmentElaboration.ts (2 errors) ==== | ||
// @strict | ||
// #Repro from #35060 | ||
|
||
const x: readonly [] = null! as readonly [0]; | ||
~ | ||
!!! error TS4111: The type 'readonly [0]' is 'readonly' and is incompatible with type 'readonly []'. | ||
!!! error TS4111: Types of property 'length' are incompatible. | ||
!!! error TS4111: Type '1' is not assignable to type '0'. | ||
const y: readonly [1] = null! as readonly [0]; | ||
~ | ||
!!! error TS4111: The type 'readonly [0]' is 'readonly' and is incompatible with type 'readonly [1]'. | ||
!!! error TS4111: Type '0' is not assignable to type '1'. | ||
|
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/readOnlyArrayAndTuplesAssignmentElaboration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//// [readOnlyArrayAndTuplesAssignmentElaboration.ts] | ||
// @strict | ||
// #Repro from #35060 | ||
|
||
const x: readonly [] = null! as readonly [0]; | ||
const y: readonly [1] = null! as readonly [0]; | ||
|
||
|
||
//// [readOnlyArrayAndTuplesAssignmentElaboration.js] | ||
// @strict | ||
// #Repro from #35060 | ||
var x = null; | ||
var y = null; |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/readOnlyArrayAndTuplesAssignmentElaboration.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
=== tests/cases/compiler/readOnlyArrayAndTuplesAssignmentElaboration.ts === | ||
// @strict | ||
// #Repro from #35060 | ||
|
||
const x: readonly [] = null! as readonly [0]; | ||
>x : Symbol(x, Decl(readOnlyArrayAndTuplesAssignmentElaboration.ts, 3, 5)) | ||
|
||
const y: readonly [1] = null! as readonly [0]; | ||
>y : Symbol(y, Decl(readOnlyArrayAndTuplesAssignmentElaboration.ts, 4, 5)) | ||
|
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/readOnlyArrayAndTuplesAssignmentElaboration.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
=== tests/cases/compiler/readOnlyArrayAndTuplesAssignmentElaboration.ts === | ||
// @strict | ||
// #Repro from #35060 | ||
|
||
const x: readonly [] = null! as readonly [0]; | ||
>x : readonly [] | ||
>null! as readonly [0] : readonly [0] | ||
>null! : null | ||
>null : null | ||
|
||
const y: readonly [1] = null! as readonly [0]; | ||
>y : readonly [1] | ||
>null! as readonly [0] : readonly [0] | ||
>null! : null | ||
>null : null | ||
|
5 changes: 5 additions & 0 deletions
5
tests/cases/compiler/readOnlyArrayAndTuplesAssignmentElaboration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// @strict | ||
// #Repro from #35060 | ||
|
||
const x: readonly [] = null! as readonly [0]; | ||
const y: readonly [1] = null! as readonly [0]; |