|
| 1 | +//// [tests/cases/compiler/duplicateObjectLiteralProperty_computedNameNegative1.ts] //// |
| 2 | + |
| 3 | +=== duplicateObjectLiteralProperty_computedNameNegative1.ts === |
| 4 | +// repro from https://github.com/microsoft/TypeScript/issues/56341 |
| 5 | + |
| 6 | +function bar(props: { x?: string; y?: string }) { |
| 7 | +>bar : Symbol(bar, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 0, 0)) |
| 8 | +>props : Symbol(props, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 2, 13)) |
| 9 | +>x : Symbol(x, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 2, 21)) |
| 10 | +>y : Symbol(y, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 2, 33)) |
| 11 | + |
| 12 | + const { x = "", y = "" } = props; |
| 13 | +>x : Symbol(x, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 3, 9)) |
| 14 | +>y : Symbol(y, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 3, 17)) |
| 15 | +>props : Symbol(props, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 2, 13)) |
| 16 | + |
| 17 | + return { |
| 18 | + [x]: 1, |
| 19 | +>[x] : Symbol([x], Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 4, 10)) |
| 20 | +>x : Symbol(x, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 3, 9)) |
| 21 | + |
| 22 | + [y]: 2, |
| 23 | +>[y] : Symbol([y], Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 5, 11)) |
| 24 | +>y : Symbol(y, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 3, 17)) |
| 25 | + |
| 26 | + }; |
| 27 | +} |
| 28 | + |
| 29 | +function foo({ x = "", y = "" }: { x?: string; y?: string }) { |
| 30 | +>foo : Symbol(foo, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 8, 1)) |
| 31 | +>x : Symbol(x, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 10, 14)) |
| 32 | +>y : Symbol(y, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 10, 22)) |
| 33 | +>x : Symbol(x, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 10, 34)) |
| 34 | +>y : Symbol(y, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 10, 46)) |
| 35 | + |
| 36 | + return { |
| 37 | + [x]: 1, |
| 38 | +>[x] : Symbol([x], Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 11, 10)) |
| 39 | +>x : Symbol(x, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 10, 14)) |
| 40 | + |
| 41 | + [y]: 2, |
| 42 | +>[y] : Symbol([y], Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 12, 11)) |
| 43 | +>y : Symbol(y, Decl(duplicateObjectLiteralProperty_computedNameNegative1.ts, 10, 22)) |
| 44 | + |
| 45 | + }; |
| 46 | +} |
| 47 | + |
0 commit comments