TypeScript/tests/baselines/reference/propertyAssignmentOnParenthesizedNumber.symbols
Nathan Shively-Sanders a64166de14 isDynamicName skips parentheses for element access
Neither `x[0]` nor `x[(0)]` should be dynamic names. Previously, the
latter was because `isDynamicName` didn't skip parentheses.

Since the binder treats dynamic names in property assignments as
assignment declarations, this incorrectly tried to create a binding for
expressions like `x[(0)] = 1`.

This caused an assert because `x[(0)]` would not take the dynamic name
code path during binding (`hasDynamicName` returned false), but the
normal code path for static names.
2020-06-11 09:08:51 -07:00

9 lines
235 B
Plaintext

=== tests/cases/conformance/salsa/bug38934.js ===
var x = {};
>x : Symbol(x, Decl(bug38934.js, 0, 3))
// should not crash and also should not result in a property '0' on x.
x[(0)] = 1;
>x : Symbol(x, Decl(bug38934.js, 0, 3))