support named tuples where not all tuple elements are named

This commit is contained in:
Erik Krogh Kristensen
2020-08-17 16:20:26 +02:00
parent 83ed41b247
commit 73d1fac88e
3 changed files with 21 additions and 7 deletions

View File

@@ -116,6 +116,7 @@ test_VariableTypes
| tst.ts:184:7:184:8 | a1 | a1 | tst.ts:184:12:184:17 | number |
| tst.ts:185:7:185:8 | a2 | a2 | tst.ts:185:12:185:17 | number |
| tst.ts:186:7:186:8 | a3 | a3 | tst.ts:186:12:186:17 | number |
| tst.ts:192:18:192:18 | x | x | tst.ts:192:21:192:43 | [first: ... number] |
test_QualifiedTypeAccess
| tst.ts:63:19:63:21 | N.I | tst.ts:63:19:63:19 | N | tst.ts:63:21:63:21 | I |
| tst.ts:64:20:64:24 | N.M.I | tst.ts:64:20:64:22 | N.M | tst.ts:64:24:64:24 | I |
@@ -218,9 +219,15 @@ test_TupleTypeExpr
| tst.ts:176:16:176:31 | [number, number] | 1 | 2 | tst.ts:176:25:176:30 | number |
| tst.ts:179:21:179:44 | [...Str ... umbers] | 0 | 2 | tst.ts:179:22:179:31 | ...Strings |
| tst.ts:179:21:179:44 | [...Str ... umbers] | 1 | 2 | tst.ts:179:34:179:43 | ...Numbers |
| tst.ts:192:21:192:43 | [first: ... number] | 0 | 2 | tst.ts:192:29:192:34 | number |
| tst.ts:192:21:192:43 | [first: ... number] | 1 | 2 | tst.ts:192:37:192:42 | number |
| tst.ts:192:47:192:70 | [number ... number] | 0 | 2 | tst.ts:192:48:192:53 | number |
| tst.ts:192:47:192:70 | [number ... number] | 1 | 2 | tst.ts:192:64:192:69 | number |
test_TupleTypeElementName
| tst.ts:169:34:169:64 | [first: ... number] | 0 | tst.ts:169:35:169:39 | first |
| tst.ts:169:34:169:64 | [first: ... number] | 1 | tst.ts:169:50:169:55 | second |
| tst.ts:192:21:192:43 | [first: ... number] | 0 | tst.ts:192:22:192:26 | first |
| tst.ts:192:47:192:70 | [number ... number] | 1 | tst.ts:192:56:192:61 | second |
test_FieldTypes
| tst.ts:15:3:15:22 | numberField: number; | tst.ts:15:16:15:21 | number |
| tst.ts:16:3:16:22 | stringField: string; | tst.ts:16:16:16:21 | string |
@@ -297,6 +304,7 @@ test_ReturnTypes
| tst.ts:148:1:152:1 | functio ... ;\\n }\\n} | function assertIsString | tst.ts:148:36:148:56 | asserts ... string |
| tst.ts:164:1:166:1 | functio ... rr2];\\n} | function concat | tst.ts:164:66:164:77 | [...T, ...U] |
| tst.ts:169:1:172:1 | functio ... + b;\\n} | function labelOnTupleElements | tst.ts:169:68:169:73 | number |
| tst.ts:192:1:194:1 | functio ... rn x;\\n} | function weirdId | tst.ts:192:47:192:70 | [number ... number] |
test_KeyofTypeExpr
| tst.ts:49:16:49:30 | keyof Interface | tst.ts:49:22:49:30 | Interface |
| tst.ts:113:26:113:35 | keyof Node | tst.ts:113:32:113:35 | Node |

View File

@@ -186,4 +186,9 @@ function shortAssignment() {
let a3 : number = a1 ||= a2;
let a4 = a2 &&= a3;
let a5 = a3 ??= a4;
}
// only label on some tuple elements (is a type-error)
function weirdId(x: [first: number, number]): [number, second: number] {
return x;
}