mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
121 lines
6.1 KiB
Plaintext
121 lines
6.1 KiB
Plaintext
//// [tests/cases/compiler/computedPropertiesInDestructuring1.ts] ////
|
|
|
|
=== computedPropertiesInDestructuring1.ts ===
|
|
// destructuring in variable declarations
|
|
let foo = "bar";
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
|
|
let {[foo]: bar} = {bar: "bar"};
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 2, 5))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 2, 20))
|
|
|
|
let {["bar"]: bar2} = {bar: "bar"};
|
|
>"bar" : Symbol(bar2, Decl(computedPropertiesInDestructuring1.ts, 4, 5))
|
|
>bar2 : Symbol(bar2, Decl(computedPropertiesInDestructuring1.ts, 4, 5))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 4, 23))
|
|
|
|
let foo2 = () => "bar";
|
|
>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring1.ts, 6, 3))
|
|
|
|
let {[foo2()]: bar3} = {bar: "bar"};
|
|
>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring1.ts, 6, 3))
|
|
>bar3 : Symbol(bar3, Decl(computedPropertiesInDestructuring1.ts, 7, 5))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 7, 24))
|
|
|
|
let [{[foo]: bar4}] = [{bar: "bar"}];
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>bar4 : Symbol(bar4, Decl(computedPropertiesInDestructuring1.ts, 9, 6))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 9, 24))
|
|
|
|
let [{[foo2()]: bar5}] = [{bar: "bar"}];
|
|
>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring1.ts, 6, 3))
|
|
>bar5 : Symbol(bar5, Decl(computedPropertiesInDestructuring1.ts, 10, 6))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 10, 27))
|
|
|
|
function f1({["bar"]: x}: { bar: number }) {}
|
|
>f1 : Symbol(f1, Decl(computedPropertiesInDestructuring1.ts, 10, 40))
|
|
>"bar" : Symbol(x, Decl(computedPropertiesInDestructuring1.ts, 12, 13))
|
|
>x : Symbol(x, Decl(computedPropertiesInDestructuring1.ts, 12, 13))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 12, 27))
|
|
|
|
function f2({[foo]: x}: { bar: number }) {}
|
|
>f2 : Symbol(f2, Decl(computedPropertiesInDestructuring1.ts, 12, 45))
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>x : Symbol(x, Decl(computedPropertiesInDestructuring1.ts, 13, 13))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 13, 25))
|
|
|
|
function f3({[foo2()]: x}: { bar: number }) {}
|
|
>f3 : Symbol(f3, Decl(computedPropertiesInDestructuring1.ts, 13, 43))
|
|
>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring1.ts, 6, 3))
|
|
>x : Symbol(x, Decl(computedPropertiesInDestructuring1.ts, 14, 13))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 14, 28))
|
|
|
|
function f4([{[foo]: x}]: [{ bar: number }]) {}
|
|
>f4 : Symbol(f4, Decl(computedPropertiesInDestructuring1.ts, 14, 46))
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>x : Symbol(x, Decl(computedPropertiesInDestructuring1.ts, 15, 14))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 15, 28))
|
|
|
|
function f5([{[foo2()]: x}]: [{ bar: number }]) {}
|
|
>f5 : Symbol(f5, Decl(computedPropertiesInDestructuring1.ts, 15, 47))
|
|
>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring1.ts, 6, 3))
|
|
>x : Symbol(x, Decl(computedPropertiesInDestructuring1.ts, 16, 14))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 16, 31))
|
|
|
|
// report errors on type errors in computed properties used in destructuring
|
|
let [{[foo()]: bar6}] = [{bar: "bar"}];
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>bar6 : Symbol(bar6, Decl(computedPropertiesInDestructuring1.ts, 19, 6))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 19, 26))
|
|
|
|
let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}];
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>bar7 : Symbol(bar7, Decl(computedPropertiesInDestructuring1.ts, 20, 6))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 20, 40))
|
|
|
|
// destructuring assignment
|
|
({[foo]: bar} = {bar: "bar"});
|
|
>[foo] : Symbol([foo], Decl(computedPropertiesInDestructuring1.ts, 23, 2))
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 2, 5))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 23, 17))
|
|
|
|
({["bar"]: bar2} = {bar: "bar"});
|
|
>["bar"] : Symbol(["bar"], Decl(computedPropertiesInDestructuring1.ts, 25, 2))
|
|
>"bar" : Symbol(["bar"], Decl(computedPropertiesInDestructuring1.ts, 25, 2))
|
|
>bar2 : Symbol(bar2, Decl(computedPropertiesInDestructuring1.ts, 4, 5))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 25, 20))
|
|
|
|
({[foo2()]: bar3} = {bar: "bar"});
|
|
>[foo2()] : Symbol([foo2()], Decl(computedPropertiesInDestructuring1.ts, 27, 2))
|
|
>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring1.ts, 6, 3))
|
|
>bar3 : Symbol(bar3, Decl(computedPropertiesInDestructuring1.ts, 7, 5))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 27, 21))
|
|
|
|
[{[foo]: bar4}] = [{bar: "bar"}];
|
|
>[foo] : Symbol([foo], Decl(computedPropertiesInDestructuring1.ts, 29, 2))
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>bar4 : Symbol(bar4, Decl(computedPropertiesInDestructuring1.ts, 9, 6))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 29, 20))
|
|
|
|
[{[foo2()]: bar5}] = [{bar: "bar"}];
|
|
>[foo2()] : Symbol([foo2()], Decl(computedPropertiesInDestructuring1.ts, 30, 2))
|
|
>foo2 : Symbol(foo2, Decl(computedPropertiesInDestructuring1.ts, 6, 3))
|
|
>bar5 : Symbol(bar5, Decl(computedPropertiesInDestructuring1.ts, 10, 6))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 30, 23))
|
|
|
|
[{[foo()]: bar4}] = [{bar: "bar"}];
|
|
>[foo()] : Symbol([foo()], Decl(computedPropertiesInDestructuring1.ts, 32, 2))
|
|
>foo : Symbol(foo, Decl(computedPropertiesInDestructuring1.ts, 1, 3))
|
|
>bar4 : Symbol(bar4, Decl(computedPropertiesInDestructuring1.ts, 9, 6))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 32, 22))
|
|
|
|
[{[(1 + {})]: bar4}] = [{bar: "bar"}];
|
|
>[(1 + {})] : Symbol([(1 + {})], Decl(computedPropertiesInDestructuring1.ts, 33, 2))
|
|
>bar4 : Symbol(bar4, Decl(computedPropertiesInDestructuring1.ts, 9, 6))
|
|
>bar : Symbol(bar, Decl(computedPropertiesInDestructuring1.ts, 33, 25))
|
|
|
|
|
|
|