mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 03:09:39 -06:00
Add additional destructuring recursion tests
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
This commit is contained in:
parent
2abf5a1a7b
commit
0392f4f55f
@ -2,9 +2,18 @@ destructuringContextualBindingStackOverflow.ts(1,7): error TS2322: Type '{ c: nu
|
||||
destructuringContextualBindingStackOverflow.ts(1,9): error TS2339: Property 'c' does not exist on type 'string | number | symbol'.
|
||||
destructuringContextualBindingStackOverflow.ts(1,12): error TS2339: Property 'f' does not exist on type 'string | number | symbol'.
|
||||
destructuringContextualBindingStackOverflow.ts(1,52): error TS2448: Block-scoped variable 'f' used before its declaration.
|
||||
destructuringContextualBindingStackOverflow.ts(2,7): error TS2322: Type '{ a: number; f: any; }' is not assignable to type 'string | number'.
|
||||
destructuringContextualBindingStackOverflow.ts(2,9): error TS2339: Property 'a' does not exist on type 'string | number'.
|
||||
destructuringContextualBindingStackOverflow.ts(2,12): error TS2339: Property 'f' does not exist on type 'string | number'.
|
||||
destructuringContextualBindingStackOverflow.ts(2,55): error TS2448: Block-scoped variable 'f1' used before its declaration.
|
||||
destructuringContextualBindingStackOverflow.ts(3,7): error TS2322: Type '{ a: any; f: any; }' is not assignable to type 'string | number'.
|
||||
destructuringContextualBindingStackOverflow.ts(3,9): error TS2339: Property 'a' does not exist on type 'string | number'.
|
||||
destructuringContextualBindingStackOverflow.ts(3,16): error TS2339: Property 'f' does not exist on type 'string | number'.
|
||||
destructuringContextualBindingStackOverflow.ts(3,48): error TS2448: Block-scoped variable 'f2' used before its declaration.
|
||||
destructuringContextualBindingStackOverflow.ts(3,55): error TS2448: Block-scoped variable 'a1' used before its declaration.
|
||||
|
||||
|
||||
==== destructuringContextualBindingStackOverflow.ts (4 errors) ====
|
||||
==== destructuringContextualBindingStackOverflow.ts (13 errors) ====
|
||||
const { c, f }: string | number | symbol = { c: 0, f };
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '{ c: number; f: any; }' is not assignable to type 'string | number | symbol'.
|
||||
@ -15,4 +24,27 @@ destructuringContextualBindingStackOverflow.ts(1,52): error TS2448: Block-scoped
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'f' used before its declaration.
|
||||
!!! related TS2728 destructuringContextualBindingStackOverflow.ts:1:12: 'f' is declared here.
|
||||
const { a, f: f1 }: string | number = { a: 0, f: (1 + f1) };
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: number; f: any; }' is not assignable to type 'string | number'.
|
||||
~
|
||||
!!! error TS2339: Property 'a' does not exist on type 'string | number'.
|
||||
~
|
||||
!!! error TS2339: Property 'f' does not exist on type 'string | number'.
|
||||
~~
|
||||
!!! error TS2448: Block-scoped variable 'f1' used before its declaration.
|
||||
!!! related TS2728 destructuringContextualBindingStackOverflow.ts:2:15: 'f1' is declared here.
|
||||
const { a: a1, f: f2 }: string | number = { a: f2, f: a1 };
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: any; f: any; }' is not assignable to type 'string | number'.
|
||||
~
|
||||
!!! error TS2339: Property 'a' does not exist on type 'string | number'.
|
||||
~
|
||||
!!! error TS2339: Property 'f' does not exist on type 'string | number'.
|
||||
~~
|
||||
!!! error TS2448: Block-scoped variable 'f2' used before its declaration.
|
||||
!!! related TS2728 destructuringContextualBindingStackOverflow.ts:3:19: 'f2' is declared here.
|
||||
~~
|
||||
!!! error TS2448: Block-scoped variable 'a1' used before its declaration.
|
||||
!!! related TS2728 destructuringContextualBindingStackOverflow.ts:3:12: 'a1' is declared here.
|
||||
|
||||
@ -2,8 +2,12 @@
|
||||
|
||||
//// [destructuringContextualBindingStackOverflow.ts]
|
||||
const { c, f }: string | number | symbol = { c: 0, f };
|
||||
const { a, f: f1 }: string | number = { a: 0, f: (1 + f1) };
|
||||
const { a: a1, f: f2 }: string | number = { a: f2, f: a1 };
|
||||
|
||||
|
||||
//// [destructuringContextualBindingStackOverflow.js]
|
||||
"use strict";
|
||||
var _a = { c: 0, f: f }, c = _a.c, f = _a.f;
|
||||
var _b = { a: 0, f: (1 + f1) }, a = _b.a, f1 = _b.f;
|
||||
var _c = { a: f2, f: a1 }, a1 = _c.a, f2 = _c.f;
|
||||
|
||||
@ -7,3 +7,18 @@ const { c, f }: string | number | symbol = { c: 0, f };
|
||||
>c : Symbol(c, Decl(destructuringContextualBindingStackOverflow.ts, 0, 44))
|
||||
>f : Symbol(f, Decl(destructuringContextualBindingStackOverflow.ts, 0, 50))
|
||||
|
||||
const { a, f: f1 }: string | number = { a: 0, f: (1 + f1) };
|
||||
>a : Symbol(a, Decl(destructuringContextualBindingStackOverflow.ts, 1, 7))
|
||||
>f1 : Symbol(f1, Decl(destructuringContextualBindingStackOverflow.ts, 1, 10))
|
||||
>a : Symbol(a, Decl(destructuringContextualBindingStackOverflow.ts, 1, 39))
|
||||
>f : Symbol(f, Decl(destructuringContextualBindingStackOverflow.ts, 1, 45))
|
||||
>f1 : Symbol(f1, Decl(destructuringContextualBindingStackOverflow.ts, 1, 10))
|
||||
|
||||
const { a: a1, f: f2 }: string | number = { a: f2, f: a1 };
|
||||
>a1 : Symbol(a1, Decl(destructuringContextualBindingStackOverflow.ts, 2, 7))
|
||||
>f2 : Symbol(f2, Decl(destructuringContextualBindingStackOverflow.ts, 2, 14))
|
||||
>a : Symbol(a, Decl(destructuringContextualBindingStackOverflow.ts, 2, 43))
|
||||
>f2 : Symbol(f2, Decl(destructuringContextualBindingStackOverflow.ts, 2, 14))
|
||||
>f : Symbol(f, Decl(destructuringContextualBindingStackOverflow.ts, 2, 50))
|
||||
>a1 : Symbol(a1, Decl(destructuringContextualBindingStackOverflow.ts, 2, 7))
|
||||
|
||||
|
||||
@ -15,3 +15,47 @@ const { c, f }: string | number | symbol = { c: 0, f };
|
||||
>f : any
|
||||
> : ^^^
|
||||
|
||||
const { a, f: f1 }: string | number = { a: 0, f: (1 + f1) };
|
||||
>a : any
|
||||
> : ^^^
|
||||
>f : any
|
||||
> : ^^^
|
||||
>f1 : any
|
||||
> : ^^^
|
||||
>{ a: 0, f: (1 + f1) } : { a: number; f: any; }
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^
|
||||
>a : number
|
||||
> : ^^^^^^
|
||||
>0 : 0
|
||||
> : ^
|
||||
>f : any
|
||||
> : ^^^
|
||||
>(1 + f1) : any
|
||||
> : ^^^
|
||||
>1 + f1 : any
|
||||
> : ^^^
|
||||
>1 : 1
|
||||
> : ^
|
||||
>f1 : any
|
||||
> : ^^^
|
||||
|
||||
const { a: a1, f: f2 }: string | number = { a: f2, f: a1 };
|
||||
>a : any
|
||||
> : ^^^
|
||||
>a1 : any
|
||||
> : ^^^
|
||||
>f : any
|
||||
> : ^^^
|
||||
>f2 : any
|
||||
> : ^^^
|
||||
>{ a: f2, f: a1 } : { a: any; f: any; }
|
||||
> : ^^^^^^^^^^^^^^^^^^^
|
||||
>a : any
|
||||
> : ^^^
|
||||
>f2 : any
|
||||
> : ^^^
|
||||
>f : any
|
||||
> : ^^^
|
||||
>a1 : any
|
||||
> : ^^^
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
// @strict: true
|
||||
|
||||
const { c, f }: string | number | symbol = { c: 0, f };
|
||||
const { a, f: f1 }: string | number = { a: 0, f: (1 + f1) };
|
||||
const { a: a1, f: f2 }: string | number = { a: f2, f: a1 };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user