Support some late-bound special property assignments (#33220)

* Support some late-bound special property assignments

* Integrate PR feedback

* PR feedback

* Enable declaration on core tests

* Specialize type of binary expression used for late binding, speculative fix to navigation bar, merge check and type for elem/property accesses

* Add test showing current nav bar behavior (specifically the lack thereof)
This commit is contained in:
Wesley Wigham 2019-09-27 13:54:50 -07:00 committed by GitHub
parent 304fcee09b
commit 293816875c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 1897 additions and 47 deletions

View file

@ -2622,7 +2622,12 @@ namespace ts {
// Declare a 'member' if the container is an ES5 class or ES6 constructor
constructorSymbol.members = constructorSymbol.members || createSymbolTable();
// It's acceptable for multiple 'this' assignments of the same identifier to occur
declareSymbol(constructorSymbol.members, constructorSymbol, node, SymbolFlags.Property | SymbolFlags.Assignment, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
if (hasDynamicName(node)) {
bindDynamicallyNamedThisPropertyAssignment(node, constructorSymbol);
}
else {
declareSymbol(constructorSymbol.members, constructorSymbol, node, SymbolFlags.Property | SymbolFlags.Assignment, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
}
addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, SymbolFlags.Class);
}
break;
@ -2636,7 +2641,12 @@ namespace ts {
// Bind this property to the containing class
const containingClass = thisContainer.parent;
const symbolTable = hasModifier(thisContainer, ModifierFlags.Static) ? containingClass.symbol.exports! : containingClass.symbol.members!;
declareSymbol(symbolTable, containingClass.symbol, node, SymbolFlags.Property | SymbolFlags.Assignment, SymbolFlags.None, /*isReplaceableByMethod*/ true);
if (hasDynamicName(node)) {
bindDynamicallyNamedThisPropertyAssignment(node, containingClass.symbol);
}
else {
declareSymbol(symbolTable, containingClass.symbol, node, SymbolFlags.Property | SymbolFlags.Assignment, SymbolFlags.None, /*isReplaceableByMethod*/ true);
}
break;
case SyntaxKind.SourceFile:
// this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script
@ -2653,6 +2663,18 @@ namespace ts {
}
}
function bindDynamicallyNamedThisPropertyAssignment(node: BinaryExpression | DynamicNamedDeclaration, symbol: Symbol) {
bindAnonymousDeclaration(node, SymbolFlags.Property, InternalSymbolName.Computed);
addLateBoundAssignmentDeclarationToSymbol(node, symbol);
}
function addLateBoundAssignmentDeclarationToSymbol(node: BinaryExpression | DynamicNamedDeclaration, symbol: Symbol | undefined) {
if (symbol) {
const members = symbol.assignmentDeclarationMembers || (symbol.assignmentDeclarationMembers = createMap());
members.set("" + getNodeId(node), node);
}
}
function bindSpecialPropertyDeclaration(node: PropertyAccessExpression) {
if (node.expression.kind === SyntaxKind.ThisKeyword) {
bindThisPropertyAssignment(node);
@ -2722,7 +2744,14 @@ namespace ts {
bindExportsPropertyAssignment(node);
}
else {
bindStaticPropertyAssignment(lhs);
if (hasDynamicName(node)) {
bindAnonymousDeclaration(node, SymbolFlags.Property | SymbolFlags.Assignment, InternalSymbolName.Computed);
const sym = bindPotentiallyMissingNamespaces(parentSymbol, lhs.expression, isTopLevelNamespaceAssignment(lhs), /*isPrototype*/ false, /*containerIsClass*/ false);
addLateBoundAssignmentDeclarationToSymbol(node, sym);
}
else {
bindStaticPropertyAssignment(lhs);
}
}
}

View file

@ -2860,7 +2860,7 @@ namespace ts {
}
function getExportsOfSymbol(symbol: Symbol): SymbolTable {
return symbol.flags & SymbolFlags.Class ? getResolvedMembersOrExportsOfSymbol(symbol, MembersOrExportsResolutionKind.resolvedExports) :
return symbol.flags & SymbolFlags.LateBindingContainer ? getResolvedMembersOrExportsOfSymbol(symbol, MembersOrExportsResolutionKind.resolvedExports) :
symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) :
symbol.exports || emptySymbols;
}
@ -4224,7 +4224,15 @@ namespace ts {
if (context.tracker.trackSymbol && getCheckFlags(propertySymbol) & CheckFlags.Late) {
const decl = first(propertySymbol.declarations);
if (hasLateBindableName(decl)) {
trackComputedName(decl.name, saveEnclosingDeclaration, context);
if (isBinaryExpression(decl)) {
const name = getNameOfDeclaration(decl);
if (name && isElementAccessExpression(name) && isPropertyAccessEntityNameExpression(name.argumentExpression)) {
trackComputedName(name.argumentExpression, saveEnclosingDeclaration, context);
}
}
else {
trackComputedName(decl.name.expression, saveEnclosingDeclaration, context);
}
}
}
const propertyName = symbolToName(propertySymbol, context, SymbolFlags.Value, /*expectsIdentifier*/ true);
@ -4440,7 +4448,7 @@ namespace ts {
return <BindingName>elideInitializerAndSetEmitFlags(node);
function elideInitializerAndSetEmitFlags(node: Node): Node {
if (context.tracker.trackSymbol && isComputedPropertyName(node) && isLateBindableName(node)) {
trackComputedName(node, context.enclosingDeclaration, context);
trackComputedName(node.expression, context.enclosingDeclaration, context);
}
const visited = visitEachChild(node, elideInitializerAndSetEmitFlags, nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags)!;
const clone = nodeIsSynthesized(visited) ? visited : getSynthesizedClone(visited);
@ -4452,10 +4460,10 @@ namespace ts {
}
}
function trackComputedName(node: LateBoundName, enclosingDeclaration: Node | undefined, context: NodeBuilderContext) {
function trackComputedName(accessExpression: EntityNameOrEntityNameExpression, enclosingDeclaration: Node | undefined, context: NodeBuilderContext) {
if (!context.tracker.trackSymbol) return;
// get symbol of the first identifier of the entityName
const firstIdentifier = getFirstIdentifier(node.expression);
const firstIdentifier = getFirstIdentifier(accessExpression);
const name = resolveName(firstIdentifier, firstIdentifier.escapedText, SymbolFlags.Value | SymbolFlags.ExportValue, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
if (name) {
context.tracker.trackSymbol(name, enclosingDeclaration, SymbolFlags.Value);
@ -7182,8 +7190,10 @@ namespace ts {
if (declaration.kind === SyntaxKind.ExportAssignment) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached((<ExportAssignment>declaration).expression), declaration);
}
else if (isInJSFile(declaration) &&
(isCallExpression(declaration) || isBinaryExpression(declaration) || isPropertyAccessExpression(declaration) && isBinaryExpression(declaration.parent))) {
else if (
isBinaryExpression(declaration) ||
(isInJSFile(declaration) &&
(isCallExpression(declaration) || isPropertyAccessExpression(declaration) && isBinaryExpression(declaration.parent)))) {
type = getWidenedTypeForAssignmentDeclaration(symbol);
}
else if (isJSDocPropertyLikeTag(declaration)
@ -8201,9 +8211,12 @@ namespace ts {
* - The type of its expression is a string or numeric literal type, or is a `unique symbol` type.
*/
function isLateBindableName(node: DeclarationName): node is LateBoundName {
return isComputedPropertyName(node)
&& isEntityNameExpression(node.expression)
&& isTypeUsableAsPropertyName(checkComputedPropertyName(node));
if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
return false;
}
const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
return isEntityNameExpression(expr)
&& isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr));
}
function isLateBoundName(name: __String): boolean {
@ -8215,7 +8228,7 @@ namespace ts {
/**
* Indicates whether a declaration has a late-bindable dynamic name.
*/
function hasLateBindableName(node: Declaration): node is LateBoundDeclaration {
function hasLateBindableName(node: Declaration): node is LateBoundDeclaration | LateBoundBinaryExpressionDeclaration {
const name = getNameOfDeclaration(node);
return !!name && isLateBindableName(name);
}
@ -8252,7 +8265,7 @@ namespace ts {
* late-bound members that `addDeclarationToSymbol` in binder.ts performs for early-bound
* members.
*/
function addDeclarationToLateBoundSymbol(symbol: Symbol, member: LateBoundDeclaration, symbolFlags: SymbolFlags) {
function addDeclarationToLateBoundSymbol(symbol: Symbol, member: LateBoundDeclaration | BinaryExpression, symbolFlags: SymbolFlags) {
Debug.assert(!!(getCheckFlags(symbol) & CheckFlags.Late), "Expected a late-bound symbol.");
symbol.flags |= symbolFlags;
getSymbolLinks(member.symbol).lateSymbol = symbol;
@ -8297,14 +8310,15 @@ namespace ts {
* @param lateSymbols The late-bound symbols of the parent.
* @param decl The member to bind.
*/
function lateBindMember(parent: Symbol, earlySymbols: SymbolTable | undefined, lateSymbols: SymbolTable, decl: LateBoundDeclaration) {
function lateBindMember(parent: Symbol, earlySymbols: SymbolTable | undefined, lateSymbols: SymbolTable, decl: LateBoundDeclaration | LateBoundBinaryExpressionDeclaration) {
Debug.assert(!!decl.symbol, "The member is expected to have a symbol.");
const links = getNodeLinks(decl);
if (!links.resolvedSymbol) {
// In the event we attempt to resolve the late-bound name of this member recursively,
// fall back to the early-bound name of this member.
links.resolvedSymbol = decl.symbol;
const type = checkComputedPropertyName(decl.name);
const declName = isBinaryExpression(decl) ? decl.left : decl.name;
const type = isElementAccessExpression(declName) ? checkExpressionCached(declName.argumentExpression) : checkComputedPropertyName(declName);
if (isTypeUsableAsPropertyName(type)) {
const memberName = getPropertyNameFromType(type);
const symbolFlags = decl.symbol.flags;
@ -8321,9 +8335,9 @@ namespace ts {
// If we have an existing early-bound member, combine its declarations so that we can
// report an error at each declaration.
const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
const name = !(type.flags & TypeFlags.UniqueESSymbol) && unescapeLeadingUnderscores(memberName) || declarationNameToString(decl.name);
const name = !(type.flags & TypeFlags.UniqueESSymbol) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
forEach(declarations, declaration => error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
error(decl.name || decl, Diagnostics.Duplicate_property_0, name);
error(declName || decl, Diagnostics.Duplicate_property_0, name);
lateSymbol = createSymbol(SymbolFlags.None, memberName, CheckFlags.Late);
}
lateSymbol.nameType = type;
@ -8365,6 +8379,20 @@ namespace ts {
}
}
}
const assignments = symbol.assignmentDeclarationMembers;
if (assignments) {
const decls = arrayFrom(assignments.values());
for (const member of decls) {
const assignmentKind = getAssignmentDeclarationKind(member as BinaryExpression | CallExpression);
const isInstanceMember = assignmentKind === AssignmentDeclarationKind.PrototypeProperty
|| assignmentKind === AssignmentDeclarationKind.ThisProperty
|| assignmentKind === AssignmentDeclarationKind.ObjectDefinePrototypeProperty
|| assignmentKind === AssignmentDeclarationKind.Prototype; // A straight `Prototype` assignment probably can never have a computed name
if (isStatic === !isInstanceMember && hasLateBindableName(member)) {
lateBindMember(symbol, earlySymbols, lateSymbols, member);
}
}
}
links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols;
}

View file

@ -1130,7 +1130,7 @@ namespace ts {
fakespace.symbol = props[0].parent!;
const declarations = mapDefined(props, p => {
if (!isPropertyAccessExpression(p.valueDeclaration)) {
return undefined;
return undefined; // TODO GH#33569: Handle element access expressions that created late bound names (rather than silently omitting them)
}
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker);

View file

@ -814,7 +814,7 @@ namespace ts {
export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
export type DeclarationName = Identifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | BindingPattern;
export type DeclarationName = Identifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | ElementAccessExpression | BindingPattern;
export interface Declaration extends Node {
_declarationBrand: any;
@ -829,12 +829,27 @@ namespace ts {
name: ComputedPropertyName;
}
/* @internal */
export interface DynamicNamedBinaryExpression extends BinaryExpression {
left: ElementAccessExpression;
}
/* @internal */
// A declaration that supports late-binding (used in checker)
export interface LateBoundDeclaration extends DynamicNamedDeclaration {
name: LateBoundName;
}
/* @internal */
export interface LateBoundBinaryExpressionDeclaration extends DynamicNamedBinaryExpression {
left: LateBoundElementAccessExpression;
}
/* @internal */
export interface LateBoundElementAccessExpression extends ElementAccessExpression {
argumentExpression: EntityNameExpression;
}
export interface DeclarationStatement extends NamedDeclaration, Statement {
name?: Identifier | StringLiteral | NumericLiteral;
}
@ -3828,7 +3843,7 @@ namespace ts {
Classifiable = Class | Enum | TypeAlias | Interface | TypeParameter | Module | Alias,
/* @internal */
LateBindingContainer = Class | Interface | TypeLiteral | ObjectLiteral,
LateBindingContainer = Class | Interface | TypeLiteral | ObjectLiteral | Function,
}
export interface Symbol {
@ -3848,6 +3863,7 @@ namespace ts {
/* @internal */ isReferenced?: SymbolFlags; // True if the symbol is referenced elsewhere. Keeps track of the meaning of a reference in case a symbol is both a type parameter and parameter.
/* @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol?
/* @internal */ isAssigned?: boolean; // True if the symbol is a parameter with assignments
/* @internal */ assignmentDeclarationMembers?: Map<Declaration>; // detected late-bound assignment declarations associated with the symbol
}
/* @internal */

View file

@ -2060,19 +2060,51 @@ namespace ts {
}
return AssignmentDeclarationKind.ObjectDefinePropertyValue;
}
if (expr.operatorToken.kind !== SyntaxKind.EqualsToken ||
!isPropertyAccessExpression(expr.left)) {
if (expr.operatorToken.kind !== SyntaxKind.EqualsToken) {
return AssignmentDeclarationKind.None;
}
const lhs = expr.left;
if (isEntityNameExpression(lhs.expression) && lhs.name.escapedText === "prototype" && isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) {
// F.prototype = { ... }
return AssignmentDeclarationKind.Prototype;
if (isAccessExpression(lhs)) {
if (isEntityNameExpression(lhs.expression) && getElementOrPropertyAccessName(lhs) === "prototype" && isObjectLiteralExpression(getInitializerOfBinaryExpression(expr))) {
// F.prototype = { ... }
return AssignmentDeclarationKind.Prototype;
}
return getAssignmentDeclarationPropertyAccessKind(lhs);
}
return getAssignmentDeclarationPropertyAccessKind(lhs);
return AssignmentDeclarationKind.None;
}
export function getAssignmentDeclarationPropertyAccessKind(lhs: PropertyAccessExpression): AssignmentDeclarationKind {
/**
* Does not handle signed numeric names like `a[+0]` - handling those would require handling prefix unary expressions
* throughout late binding handling as well, which is awkward (but ultimately probably doable if there is demand)
*/
/* @internal */
export function getElementOrPropertyAccessArgumentExpressionOrName(node: AccessExpression): Identifier | StringLiteralLike | NumericLiteral | ElementAccessExpression | undefined {
if (isPropertyAccessExpression(node)) {
return node.name;
}
const arg = skipParentheses(node.argumentExpression);
if (isNumericLiteral(arg) || isStringLiteralLike(arg)) {
return arg;
}
return node;
}
/* @internal */
export function getElementOrPropertyAccessName(node: AccessExpression): string | undefined {
const name = getElementOrPropertyAccessArgumentExpressionOrName(node);
if (name) {
if (isIdentifier(name)) {
return idText(name);
}
if (isStringLiteralLike(name) || isNumericLiteral(name)) {
return name.text;
}
}
return undefined;
}
export function getAssignmentDeclarationPropertyAccessKind(lhs: AccessExpression): AssignmentDeclarationKind {
if (lhs.expression.kind === SyntaxKind.ThisKeyword) {
return AssignmentDeclarationKind.ThisProperty;
}
@ -2087,13 +2119,13 @@ namespace ts {
}
let nextToLast = lhs;
while (isPropertyAccessExpression(nextToLast.expression)) {
while (isAccessExpression(nextToLast.expression)) {
nextToLast = nextToLast.expression;
}
Debug.assert(isIdentifier(nextToLast.expression));
const id = nextToLast.expression as Identifier;
if (id.escapedText === "exports" ||
id.escapedText === "module" && nextToLast.name.escapedText === "exports") {
id.escapedText === "module" && getElementOrPropertyAccessName(nextToLast) === "exports") {
// exports.name = expr OR module.exports.name = expr
return AssignmentDeclarationKind.ExportsProperty;
}
@ -2807,16 +2839,19 @@ namespace ts {
* is a property of the Symbol constructor that denotes a built-in
* Symbol.
*/
export function hasDynamicName(declaration: Declaration): declaration is DynamicNamedDeclaration {
export function hasDynamicName(declaration: Declaration): declaration is DynamicNamedDeclaration | DynamicNamedBinaryExpression {
const name = getNameOfDeclaration(declaration);
return !!name && isDynamicName(name);
}
export function isDynamicName(name: DeclarationName): boolean {
return name.kind === SyntaxKind.ComputedPropertyName &&
!isStringOrNumericLiteralLike(name.expression) &&
!isSignedNumericLiteral(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
if (!(name.kind === SyntaxKind.ComputedPropertyName || name.kind === SyntaxKind.ElementAccessExpression)) {
return false;
}
const expr = isElementAccessExpression(name) ? name.argumentExpression : name.expression;
return !isStringOrNumericLiteralLike(expr) &&
!isSignedNumericLiteral(expr) &&
!isWellKnownSymbolSyntactically(expr);
}
/**
@ -5299,7 +5334,7 @@ namespace ts {
case AssignmentDeclarationKind.ThisProperty:
case AssignmentDeclarationKind.Property:
case AssignmentDeclarationKind.PrototypeProperty:
return ((expr as BinaryExpression).left as PropertyAccessExpression).name;
return getElementOrPropertyAccessArgumentExpressionOrName((expr as BinaryExpression).left as AccessExpression);
case AssignmentDeclarationKind.ObjectDefinePropertyValue:
case AssignmentDeclarationKind.ObjectDefinePropertyExports:
case AssignmentDeclarationKind.ObjectDefinePrototypeProperty:

View file

@ -55,7 +55,7 @@ namespace ts.FindAllReferences {
if (isInJSFile(node)) {
const binaryExpression = isBinaryExpression(node.parent) ?
node.parent :
isPropertyAccessExpression(node.parent) &&
isAccessExpression(node.parent) &&
isBinaryExpression(node.parent.parent) &&
node.parent.parent.left === node.parent ?
node.parent.parent :

View file

@ -665,7 +665,9 @@ namespace ts.NavigationBar {
}
if (name) {
const text = isIdentifier(name) ? name.text : nodeText(name);
const text = isIdentifier(name) ? name.text
: isElementAccessExpression(name) ? `[${nodeText(name.argumentExpression)}]`
: nodeText(name);
if (text.length > 0) {
return cleanText(text);
}

View file

@ -543,7 +543,7 @@ declare namespace ts {
}
export type EntityName = Identifier | QualifiedName;
export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
export type DeclarationName = Identifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | BindingPattern;
export type DeclarationName = Identifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | ElementAccessExpression | BindingPattern;
export interface Declaration extends Node {
_declarationBrand: any;
}
@ -4228,7 +4228,7 @@ declare namespace ts {
/**
* Sets the constant value to emit for an expression.
*/
function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: string | number): PropertyAccessExpression | ElementAccessExpression;
function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: string | number): ElementAccessExpression | PropertyAccessExpression;
/**
* Adds an EmitHelper to a node.
*/

View file

@ -543,7 +543,7 @@ declare namespace ts {
}
export type EntityName = Identifier | QualifiedName;
export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
export type DeclarationName = Identifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | BindingPattern;
export type DeclarationName = Identifier | StringLiteralLike | NumericLiteral | ComputedPropertyName | ElementAccessExpression | BindingPattern;
export interface Declaration extends Node {
_declarationBrand: any;
}
@ -4228,7 +4228,7 @@ declare namespace ts {
/**
* Sets the constant value to emit for an expression.
*/
function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: string | number): PropertyAccessExpression | ElementAccessExpression;
function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: string | number): ElementAccessExpression | PropertyAccessExpression;
/**
* Adds an EmitHelper to a node.
*/

View file

@ -0,0 +1,35 @@
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
tests/cases/conformance/salsa/usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
tests/cases/conformance/salsa/usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
==== tests/cases/conformance/salsa/usage.js (2 errors) ====
const x = require("./lateBoundAssignmentDeclarationSupport1.js");
const y = x["my-fake-sym"];
~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
const z = x[x.S];
~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
==== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1.js (2 errors) ====
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
exports[_sym] = "ok";
~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
exports[_str] = "ok";
~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")'.
exports.S = _sym;

View file

@ -0,0 +1,40 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport1.js");
>x : Symbol(x, Decl(usage.js, 0, 5))
>require : Symbol(require)
>"./lateBoundAssignmentDeclarationSupport1.js" : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0))
const y = x["my-fake-sym"];
>y : Symbol(y, Decl(usage.js, 1, 5))
>x : Symbol(x, Decl(usage.js, 0, 5))
const z = x[x.S];
>z : Symbol(z, Decl(usage.js, 2, 5))
>x : Symbol(x, Decl(usage.js, 0, 5))
>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21))
>x : Symbol(x, Decl(usage.js, 0, 5))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21))
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1.js ===
// currently unsupported
const _sym = Symbol();
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
const _str = "my-fake-sym";
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5))
exports[_sym] = "ok";
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5))
exports[_str] = "ok";
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5))
exports.S = _sym;
>exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21))
>exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5))

View file

@ -0,0 +1,53 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport1.js");
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")
>require("./lateBoundAssignmentDeclarationSupport1.js") : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")
>require : any
>"./lateBoundAssignmentDeclarationSupport1.js" : "./lateBoundAssignmentDeclarationSupport1.js"
const y = x["my-fake-sym"];
>y : any
>x["my-fake-sym"] : any
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")
>"my-fake-sym" : "my-fake-sym"
const z = x[x.S];
>z : any
>x[x.S] : any
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")
>x.S : unique symbol
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")
>S : unique symbol
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1.js ===
// currently unsupported
const _sym = Symbol();
>_sym : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
const _str = "my-fake-sym";
>_str : "my-fake-sym"
>"my-fake-sym" : "my-fake-sym"
exports[_sym] = "ok";
>exports[_sym] = "ok" : "ok"
>exports[_sym] : any
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")
>_sym : unique symbol
>"ok" : "ok"
exports[_str] = "ok";
>exports[_str] = "ok" : "ok"
>exports[_str] : any
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")
>_str : "my-fake-sym"
>"ok" : "ok"
exports.S = _sym;
>exports.S = _sym : unique symbol
>exports.S : unique symbol
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport1")
>S : unique symbol
>_sym : unique symbol

View file

@ -0,0 +1,35 @@
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
tests/cases/conformance/salsa/usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
tests/cases/conformance/salsa/usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
==== tests/cases/conformance/salsa/usage.js (2 errors) ====
const x = require("./lateBoundAssignmentDeclarationSupport2.js");
const y = x["my-fake-sym"];
~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
const z = x[x.S];
~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
==== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js (2 errors) ====
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
module.exports[_sym] = "ok";
~~~~~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
module.exports[_str] = "ok";
~~~~~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
module.exports.S = _sym;

View file

@ -0,0 +1,46 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport2.js");
>x : Symbol(x, Decl(usage.js, 0, 5))
>require : Symbol(require)
>"./lateBoundAssignmentDeclarationSupport2.js" : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0))
const y = x["my-fake-sym"];
>y : Symbol(y, Decl(usage.js, 1, 5))
>x : Symbol(x, Decl(usage.js, 0, 5))
const z = x[x.S];
>z : Symbol(z, Decl(usage.js, 2, 5))
>x : Symbol(x, Decl(usage.js, 0, 5))
>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28))
>x : Symbol(x, Decl(usage.js, 0, 5))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28))
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js ===
// currently unsupported
const _sym = Symbol();
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
const _str = "my-fake-sym";
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5))
module.exports[_sym] = "ok";
>module.exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 27))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5))
module.exports[_str] = "ok";
>module.exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 27))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5))
module.exports.S = _sym;
>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28))
>module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 27))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5))

View file

@ -0,0 +1,59 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport2.js");
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>require("./lateBoundAssignmentDeclarationSupport2.js") : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>require : any
>"./lateBoundAssignmentDeclarationSupport2.js" : "./lateBoundAssignmentDeclarationSupport2.js"
const y = x["my-fake-sym"];
>y : any
>x["my-fake-sym"] : any
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>"my-fake-sym" : "my-fake-sym"
const z = x[x.S];
>z : any
>x[x.S] : any
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>x.S : unique symbol
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>S : unique symbol
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js ===
// currently unsupported
const _sym = Symbol();
>_sym : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
const _str = "my-fake-sym";
>_str : "my-fake-sym"
>"my-fake-sym" : "my-fake-sym"
module.exports[_sym] = "ok";
>module.exports[_sym] = "ok" : "ok"
>module.exports[_sym] : any
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>_sym : unique symbol
>"ok" : "ok"
module.exports[_str] = "ok";
>module.exports[_str] = "ok" : "ok"
>module.exports[_str] : any
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>_str : "my-fake-sym"
>"ok" : "ok"
module.exports.S = _sym;
>module.exports.S = _sym : unique symbol
>module.exports.S : unique symbol
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")
>S : unique symbol
>_sym : unique symbol

View file

@ -0,0 +1,25 @@
tests/cases/conformance/salsa/usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")'.
Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")'.
tests/cases/conformance/salsa/usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")'.
Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")'.
==== tests/cases/conformance/salsa/usage.js (2 errors) ====
const x = require("./lateBoundAssignmentDeclarationSupport3.js");
const y = x["my-fake-sym"];
~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")'.
const z = x[x.S];
~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")'.
!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")'.
==== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3.js (0 errors) ====
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
Object.defineProperty(module.exports, _sym, { value: "ok" });
Object.defineProperty(module.exports, _str, { value: "ok" });
module.exports.S = _sym;

View file

@ -0,0 +1,54 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport3.js");
>x : Symbol(x, Decl(usage.js, 0, 5))
>require : Symbol(require)
>"./lateBoundAssignmentDeclarationSupport3.js" : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0))
const y = x["my-fake-sym"];
>y : Symbol(y, Decl(usage.js, 1, 5))
>x : Symbol(x, Decl(usage.js, 0, 5))
const z = x[x.S];
>z : Symbol(z, Decl(usage.js, 2, 5))
>x : Symbol(x, Decl(usage.js, 0, 5))
>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61))
>x : Symbol(x, Decl(usage.js, 0, 5))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61))
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3.js ===
// currently unsupported
const _sym = Symbol();
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
const _str = "my-fake-sym";
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5))
Object.defineProperty(module.exports, _sym, { value: "ok" });
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>module.exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5))
>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 4, 45))
Object.defineProperty(module.exports, _str, { value: "ok" });
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>module.exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5))
>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 45))
module.exports.S = _sym;
>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61))
>module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5))

View file

@ -0,0 +1,67 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport3.js");
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>require("./lateBoundAssignmentDeclarationSupport3.js") : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>require : any
>"./lateBoundAssignmentDeclarationSupport3.js" : "./lateBoundAssignmentDeclarationSupport3.js"
const y = x["my-fake-sym"];
>y : any
>x["my-fake-sym"] : any
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>"my-fake-sym" : "my-fake-sym"
const z = x[x.S];
>z : any
>x[x.S] : any
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>x.S : unique symbol
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>S : unique symbol
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3.js ===
// currently unsupported
const _sym = Symbol();
>_sym : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
const _str = "my-fake-sym";
>_str : "my-fake-sym"
>"my-fake-sym" : "my-fake-sym"
Object.defineProperty(module.exports, _sym, { value: "ok" });
>Object.defineProperty(module.exports, _sym, { value: "ok" }) : any
>Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any
>Object : ObjectConstructor
>defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>_sym : unique symbol
>{ value: "ok" } : { value: string; }
>value : string
>"ok" : "ok"
Object.defineProperty(module.exports, _str, { value: "ok" });
>Object.defineProperty(module.exports, _str, { value: "ok" }) : any
>Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any
>Object : ObjectConstructor
>defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>_str : "my-fake-sym"
>{ value: "ok" } : { value: string; }
>value : string
>"ok" : "ok"
module.exports.S = _sym;
>module.exports.S = _sym : unique symbol
>module.exports.S : unique symbol
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport3")
>S : unique symbol
>_sym : unique symbol

View file

@ -0,0 +1,42 @@
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4.js(10,12): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
Property 'my-fake-sym' does not exist on type 'F'.
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4.js(11,12): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
Property '[_sym]' does not exist on type 'F'.
tests/cases/conformance/salsa/usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
Property 'my-fake-sym' does not exist on type 'F'.
tests/cases/conformance/salsa/usage.js(4,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
Property '[_sym]' does not exist on type 'F'.
==== tests/cases/conformance/salsa/usage.js (2 errors) ====
const x = require("./lateBoundAssignmentDeclarationSupport4.js");
const inst = new x.F();
const y = inst["my-fake-sym"];
~~~~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'F'.
const z = inst[x.S];
~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
!!! error TS7053: Property '[_sym]' does not exist on type 'F'.
==== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4.js (2 errors) ====
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
function F() {
}
F.prototype[_sym] = "ok";
F.prototype[_str] = "ok";
const inst = new F();
const _y = inst[_str];
~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'F'.
const _z = inst[_sym];
~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
!!! error TS7053: Property '[_sym]' does not exist on type 'F'.
module.exports.F = F;
module.exports.S = _sym;

View file

@ -0,0 +1,77 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport4.js");
>x : Symbol(x, Decl(usage.js, 0, 5))
>require : Symbol(require)
>"./lateBoundAssignmentDeclarationSupport4.js" : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0))
const inst = new x.F();
>inst : Symbol(inst, Decl(usage.js, 1, 5))
>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22))
>x : Symbol(x, Decl(usage.js, 0, 5))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22))
const y = inst["my-fake-sym"];
>y : Symbol(y, Decl(usage.js, 2, 5))
>inst : Symbol(inst, Decl(usage.js, 1, 5))
const z = inst[x.S];
>z : Symbol(z, Decl(usage.js, 3, 5))
>inst : Symbol(inst, Decl(usage.js, 1, 5))
>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21))
>x : Symbol(x, Decl(usage.js, 0, 5))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21))
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4.js ===
// currently unsupported
const _sym = Symbol();
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
const _str = "my-fake-sym";
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5))
function F() {
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27))
}
F.prototype[_sym] = "ok";
>F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27))
>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5))
F.prototype[_str] = "ok";
>F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27))
>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5))
const inst = new F();
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27))
const _y = inst[_str];
>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport4.js, 9, 5))
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5))
const _z = inst[_sym];
>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 5))
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5))
module.exports.F = F;
>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22))
>module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27))
module.exports.S = _sym;
>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21))
>module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5))

View file

@ -0,0 +1,95 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport4.js");
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4")
>require("./lateBoundAssignmentDeclarationSupport4.js") : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4")
>require : any
>"./lateBoundAssignmentDeclarationSupport4.js" : "./lateBoundAssignmentDeclarationSupport4.js"
const inst = new x.F();
>inst : F
>new x.F() : F
>x.F : typeof F
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4")
>F : typeof F
const y = inst["my-fake-sym"];
>y : any
>inst["my-fake-sym"] : any
>inst : F
>"my-fake-sym" : "my-fake-sym"
const z = inst[x.S];
>z : any
>inst[x.S] : any
>inst : F
>x.S : unique symbol
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4")
>S : unique symbol
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4.js ===
// currently unsupported
const _sym = Symbol();
>_sym : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
const _str = "my-fake-sym";
>_str : "my-fake-sym"
>"my-fake-sym" : "my-fake-sym"
function F() {
>F : typeof F
}
F.prototype[_sym] = "ok";
>F.prototype[_sym] = "ok" : "ok"
>F.prototype[_sym] : any
>F.prototype : any
>F : typeof F
>prototype : any
>_sym : unique symbol
>"ok" : "ok"
F.prototype[_str] = "ok";
>F.prototype[_str] = "ok" : "ok"
>F.prototype[_str] : any
>F.prototype : any
>F : typeof F
>prototype : any
>_str : "my-fake-sym"
>"ok" : "ok"
const inst = new F();
>inst : F
>new F() : F
>F : typeof F
const _y = inst[_str];
>_y : any
>inst[_str] : any
>inst : F
>_str : "my-fake-sym"
const _z = inst[_sym];
>_z : any
>inst[_sym] : any
>inst : F
>_sym : unique symbol
module.exports.F = F;
>module.exports.F = F : typeof F
>module.exports.F : typeof F
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4")
>F : typeof F
>F : typeof F
module.exports.S = _sym;
>module.exports.S = _sym : unique symbol
>module.exports.S : unique symbol
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport4")
>S : unique symbol
>_sym : unique symbol

View file

@ -0,0 +1,44 @@
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5.js(12,12): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
Property 'my-fake-sym' does not exist on type 'F'.
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5.js(13,12): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
Property '[_sym]' does not exist on type 'F'.
tests/cases/conformance/salsa/usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
Property 'my-fake-sym' does not exist on type 'F'.
tests/cases/conformance/salsa/usage.js(4,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
Property '[_sym]' does not exist on type 'F'.
==== tests/cases/conformance/salsa/usage.js (2 errors) ====
const x = require("./lateBoundAssignmentDeclarationSupport5.js");
const inst = new x.F();
const y = inst["my-fake-sym"];
~~~~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'F'.
const z = inst[x.S];
~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
!!! error TS7053: Property '[_sym]' does not exist on type 'F'.
==== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5.js (2 errors) ====
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
function F() {
}
F.prototype = {
[_sym]: "ok",
[_str]: "ok"
}
const inst = new F();
const _y = inst[_str];
~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'F'.
const _z = inst[_sym];
~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
!!! error TS7053: Property '[_sym]' does not exist on type 'F'.
module.exports.F = F;
module.exports.S = _sym;

View file

@ -0,0 +1,78 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport5.js");
>x : Symbol(x, Decl(usage.js, 0, 5))
>require : Symbol(require)
>"./lateBoundAssignmentDeclarationSupport5.js" : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0))
const inst = new x.F();
>inst : Symbol(inst, Decl(usage.js, 1, 5))
>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22))
>x : Symbol(x, Decl(usage.js, 0, 5))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22))
const y = inst["my-fake-sym"];
>y : Symbol(y, Decl(usage.js, 2, 5))
>inst : Symbol(inst, Decl(usage.js, 1, 5))
const z = inst[x.S];
>z : Symbol(z, Decl(usage.js, 3, 5))
>inst : Symbol(inst, Decl(usage.js, 1, 5))
>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21))
>x : Symbol(x, Decl(usage.js, 0, 5))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21))
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5.js ===
// currently unsupported
const _sym = Symbol();
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
const _str = "my-fake-sym";
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5))
function F() {
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1))
}
F.prototype = {
>F.prototype : Symbol(F.prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1))
>prototype : Symbol(F.prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1))
[_sym]: "ok",
>[_sym] : Symbol([_sym], Decl(lateBoundAssignmentDeclarationSupport5.js, 6, 15))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5))
[_str]: "ok"
>[_str] : Symbol([_str], Decl(lateBoundAssignmentDeclarationSupport5.js, 7, 17))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5))
}
const inst = new F();
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1))
const _y = inst[_str];
>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport5.js, 11, 5))
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5))
const _z = inst[_sym];
>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 5))
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5))
module.exports.F = F;
>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22))
>module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1))
module.exports.S = _sym;
>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21))
>module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5))

View file

@ -0,0 +1,94 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport5.js");
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5")
>require("./lateBoundAssignmentDeclarationSupport5.js") : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5")
>require : any
>"./lateBoundAssignmentDeclarationSupport5.js" : "./lateBoundAssignmentDeclarationSupport5.js"
const inst = new x.F();
>inst : F
>new x.F() : F
>x.F : typeof F
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5")
>F : typeof F
const y = inst["my-fake-sym"];
>y : any
>inst["my-fake-sym"] : any
>inst : F
>"my-fake-sym" : "my-fake-sym"
const z = inst[x.S];
>z : any
>inst[x.S] : any
>inst : F
>x.S : unique symbol
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5")
>S : unique symbol
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5.js ===
// currently unsupported
const _sym = Symbol();
>_sym : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
const _str = "my-fake-sym";
>_str : "my-fake-sym"
>"my-fake-sym" : "my-fake-sym"
function F() {
>F : typeof F
}
F.prototype = {
>F.prototype = { [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; [_str]: string; }
>F.prototype : { [_sym]: string; [_str]: string; }
>F : typeof F
>prototype : { [_sym]: string; [_str]: string; }
>{ [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; [_str]: string; }
[_sym]: "ok",
>[_sym] : string
>_sym : unique symbol
>"ok" : "ok"
[_str]: "ok"
>[_str] : string
>_str : "my-fake-sym"
>"ok" : "ok"
}
const inst = new F();
>inst : F
>new F() : F
>F : typeof F
const _y = inst[_str];
>_y : any
>inst[_str] : any
>inst : F
>_str : "my-fake-sym"
const _z = inst[_sym];
>_z : any
>inst[_sym] : any
>inst : F
>_sym : unique symbol
module.exports.F = F;
>module.exports.F = F : typeof F
>module.exports.F : typeof F
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5")
>F : typeof F
>F : typeof F
module.exports.S = _sym;
>module.exports.S = _sym : unique symbol
>module.exports.S : unique symbol
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport5")
>S : unique symbol
>_sym : unique symbol

View file

@ -0,0 +1,43 @@
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6.js(11,12): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
Property 'my-fake-sym' does not exist on type 'F'.
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6.js(12,12): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
Property '[_sym]' does not exist on type 'F'.
tests/cases/conformance/salsa/usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
Property 'my-fake-sym' does not exist on type 'F'.
tests/cases/conformance/salsa/usage.js(4,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
Property '[_sym]' does not exist on type 'F'.
==== tests/cases/conformance/salsa/usage.js (2 errors) ====
const x = require("./lateBoundAssignmentDeclarationSupport6.js");
const inst = new x.F();
const y = inst["my-fake-sym"];
~~~~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'F'.
const z = inst[x.S];
~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
!!! error TS7053: Property '[_sym]' does not exist on type 'F'.
==== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6.js (2 errors) ====
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
function F() {
}
F.prototype.defsAClass = true;
Object.defineProperty(F.prototype, _str, {value: "ok"});
Object.defineProperty(F.prototype, _sym, {value: "ok"});
const inst = new F();
const _y = inst[_str];
~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'.
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'F'.
const _z = inst[_sym];
~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'F'.
!!! error TS7053: Property '[_sym]' does not exist on type 'F'.
module.exports.F = F;
module.exports.S = _sym;

View file

@ -0,0 +1,91 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport6.js");
>x : Symbol(x, Decl(usage.js, 0, 5))
>require : Symbol(require)
>"./lateBoundAssignmentDeclarationSupport6.js" : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0))
const inst = new x.F();
>inst : Symbol(inst, Decl(usage.js, 1, 5))
>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22))
>x : Symbol(x, Decl(usage.js, 0, 5))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22))
const y = inst["my-fake-sym"];
>y : Symbol(y, Decl(usage.js, 2, 5))
>inst : Symbol(inst, Decl(usage.js, 1, 5))
const z = inst[x.S];
>z : Symbol(z, Decl(usage.js, 3, 5))
>inst : Symbol(inst, Decl(usage.js, 1, 5))
>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21))
>x : Symbol(x, Decl(usage.js, 0, 5))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21))
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6.js ===
// currently unsupported
const _sym = Symbol();
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
const _str = "my-fake-sym";
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5))
function F() {
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27))
}
F.prototype.defsAClass = true;
>F.prototype : Symbol(F.defsAClass, Decl(lateBoundAssignmentDeclarationSupport6.js, 5, 1))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27))
>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>defsAClass : Symbol(F.defsAClass, Decl(lateBoundAssignmentDeclarationSupport6.js, 5, 1))
Object.defineProperty(F.prototype, _str, {value: "ok"});
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27))
>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5))
>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 7, 42))
Object.defineProperty(F.prototype, _sym, {value: "ok"});
>Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --))
>F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27))
>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5))
>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 8, 42))
const inst = new F();
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27))
const _y = inst[_str];
>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport6.js, 10, 5))
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5))
const _z = inst[_sym];
>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 5))
>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5))
module.exports.F = F;
>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22))
>module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27))
module.exports.S = _sym;
>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21))
>module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5))

View file

@ -0,0 +1,112 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport6.js");
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6")
>require("./lateBoundAssignmentDeclarationSupport6.js") : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6")
>require : any
>"./lateBoundAssignmentDeclarationSupport6.js" : "./lateBoundAssignmentDeclarationSupport6.js"
const inst = new x.F();
>inst : F
>new x.F() : F
>x.F : typeof F
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6")
>F : typeof F
const y = inst["my-fake-sym"];
>y : any
>inst["my-fake-sym"] : any
>inst : F
>"my-fake-sym" : "my-fake-sym"
const z = inst[x.S];
>z : any
>inst[x.S] : any
>inst : F
>x.S : unique symbol
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6")
>S : unique symbol
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6.js ===
// currently unsupported
const _sym = Symbol();
>_sym : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
const _str = "my-fake-sym";
>_str : "my-fake-sym"
>"my-fake-sym" : "my-fake-sym"
function F() {
>F : typeof F
}
F.prototype.defsAClass = true;
>F.prototype.defsAClass = true : true
>F.prototype.defsAClass : any
>F.prototype : any
>F : typeof F
>prototype : any
>defsAClass : any
>true : true
Object.defineProperty(F.prototype, _str, {value: "ok"});
>Object.defineProperty(F.prototype, _str, {value: "ok"}) : any
>Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any
>Object : ObjectConstructor
>defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any
>F.prototype : any
>F : typeof F
>prototype : any
>_str : "my-fake-sym"
>{value: "ok"} : { value: string; }
>value : string
>"ok" : "ok"
Object.defineProperty(F.prototype, _sym, {value: "ok"});
>Object.defineProperty(F.prototype, _sym, {value: "ok"}) : any
>Object.defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any
>Object : ObjectConstructor
>defineProperty : (o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any
>F.prototype : any
>F : typeof F
>prototype : any
>_sym : unique symbol
>{value: "ok"} : { value: string; }
>value : string
>"ok" : "ok"
const inst = new F();
>inst : F
>new F() : F
>F : typeof F
const _y = inst[_str];
>_y : any
>inst[_str] : any
>inst : F
>_str : "my-fake-sym"
const _z = inst[_sym];
>_z : any
>inst[_sym] : any
>inst : F
>_sym : unique symbol
module.exports.F = F;
>module.exports.F = F : typeof F
>module.exports.F : typeof F
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6")
>F : typeof F
>F : typeof F
module.exports.S = _sym;
>module.exports.S = _sym : unique symbol
>module.exports.S : unique symbol
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport6")
>S : unique symbol
>_sym : unique symbol

View file

@ -0,0 +1,57 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport7.js");
>x : Symbol(x, Decl(usage.js, 0, 5))
>require : Symbol(require)
>"./lateBoundAssignmentDeclarationSupport7.js" : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0))
const y = x.F["my-fake-sym"];
>y : Symbol(y, Decl(usage.js, 1, 5))
>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>x : Symbol(x, Decl(usage.js, 0, 5))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>"my-fake-sym" : Symbol(F.F[_str], Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15))
const z = x.F[x.S];
>z : Symbol(z, Decl(usage.js, 2, 5))
>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>x : Symbol(x, Decl(usage.js, 0, 5))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21))
>x : Symbol(x, Decl(usage.js, 0, 5))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21))
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7.js ===
const _sym = Symbol();
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
const _str = "my-fake-sym";
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5))
function F() {
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15))
}
F[_sym] = "ok";
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5))
F[_str] = "ok";
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15))
>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5))
module.exports.F = F;
>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15))
module.exports.S = _sym;
>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21))
>module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21))
>module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15))
>exports : Symbol("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0))
>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21))
>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5))

View file

@ -0,0 +1,70 @@
=== tests/cases/conformance/salsa/usage.js ===
const x = require("./lateBoundAssignmentDeclarationSupport7.js");
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>require("./lateBoundAssignmentDeclarationSupport7.js") : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>require : any
>"./lateBoundAssignmentDeclarationSupport7.js" : "./lateBoundAssignmentDeclarationSupport7.js"
const y = x.F["my-fake-sym"];
>y : string
>x.F["my-fake-sym"] : string
>x.F : typeof F
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>F : typeof F
>"my-fake-sym" : "my-fake-sym"
const z = x.F[x.S];
>z : string
>x.F[x.S] : string
>x.F : typeof F
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>F : typeof F
>x.S : unique symbol
>x : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>S : unique symbol
=== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7.js ===
const _sym = Symbol();
>_sym : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
const _str = "my-fake-sym";
>_str : "my-fake-sym"
>"my-fake-sym" : "my-fake-sym"
function F() {
>F : typeof F
}
F[_sym] = "ok";
>F[_sym] = "ok" : "ok"
>F[_sym] : string
>F : typeof F
>_sym : unique symbol
>"ok" : "ok"
F[_str] = "ok";
>F[_str] = "ok" : "ok"
>F[_str] : string
>F : typeof F
>_str : "my-fake-sym"
>"ok" : "ok"
module.exports.F = F;
>module.exports.F = F : typeof F
>module.exports.F : typeof F
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>F : typeof F
>F : typeof F
module.exports.S = _sym;
>module.exports.S = _sym : unique symbol
>module.exports.S : unique symbol
>module.exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>module : { "tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7": typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7"); }
>exports : typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport7")
>S : unique symbol
>_sym : unique symbol

View file

@ -0,0 +1,22 @@
//// [lateBoundClassMemberAssignmentJS.js]
const _sym = Symbol("_sym");
export class MyClass {
constructor() {
this[_sym] = "ok";
}
method() {
this[_sym] = "yep";
const x = this[_sym];
}
}
//// [lateBoundClassMemberAssignmentJS.d.ts]
export class MyClass {
method(): void;
[_sym]: string;
}
declare const _sym: unique symbol;
export {};

View file

@ -0,0 +1,27 @@
=== tests/cases/conformance/salsa/lateBoundClassMemberAssignmentJS.js ===
const _sym = Symbol("_sym");
>_sym : Symbol(_sym, Decl(lateBoundClassMemberAssignmentJS.js, 0, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
export class MyClass {
>MyClass : Symbol(MyClass, Decl(lateBoundClassMemberAssignmentJS.js, 0, 28))
constructor() {
this[_sym] = "ok";
>this : Symbol(MyClass, Decl(lateBoundClassMemberAssignmentJS.js, 0, 28))
>_sym : Symbol(_sym, Decl(lateBoundClassMemberAssignmentJS.js, 0, 5))
}
method() {
>method : Symbol(MyClass.method, Decl(lateBoundClassMemberAssignmentJS.js, 4, 5))
this[_sym] = "yep";
>this : Symbol(MyClass, Decl(lateBoundClassMemberAssignmentJS.js, 0, 28))
>_sym : Symbol(_sym, Decl(lateBoundClassMemberAssignmentJS.js, 0, 5))
const x = this[_sym];
>x : Symbol(x, Decl(lateBoundClassMemberAssignmentJS.js, 8, 13))
>this : Symbol(MyClass, Decl(lateBoundClassMemberAssignmentJS.js, 0, 28))
>_sym : Symbol(_sym, Decl(lateBoundClassMemberAssignmentJS.js, 0, 5))
}
}

View file

@ -0,0 +1,36 @@
=== tests/cases/conformance/salsa/lateBoundClassMemberAssignmentJS.js ===
const _sym = Symbol("_sym");
>_sym : unique symbol
>Symbol("_sym") : unique symbol
>Symbol : SymbolConstructor
>"_sym" : "_sym"
export class MyClass {
>MyClass : MyClass
constructor() {
this[_sym] = "ok";
>this[_sym] = "ok" : "ok"
>this[_sym] : string
>this : this
>_sym : unique symbol
>"ok" : "ok"
}
method() {
>method : () => void
this[_sym] = "yep";
>this[_sym] = "yep" : "yep"
>this[_sym] : string
>this : this
>_sym : unique symbol
>"yep" : "yep"
const x = this[_sym];
>x : string
>this[_sym] : string
>this : this
>_sym : unique symbol
}
}

View file

@ -0,0 +1,20 @@
//// [lateBoundClassMemberAssignmentJS2.js]
const _sym = "my-fake-sym";
export class MyClass {
constructor() {
this[_sym] = "ok";
}
method() {
this[_sym] = "yep";
const x = this[_sym];
}
}
//// [lateBoundClassMemberAssignmentJS2.d.ts]
export class MyClass {
method(): void;
"my-fake-sym": string;
}

View file

@ -0,0 +1,26 @@
=== tests/cases/conformance/salsa/lateBoundClassMemberAssignmentJS2.js ===
const _sym = "my-fake-sym";
>_sym : Symbol(_sym, Decl(lateBoundClassMemberAssignmentJS2.js, 0, 5))
export class MyClass {
>MyClass : Symbol(MyClass, Decl(lateBoundClassMemberAssignmentJS2.js, 0, 27))
constructor() {
this[_sym] = "ok";
>this : Symbol(MyClass, Decl(lateBoundClassMemberAssignmentJS2.js, 0, 27))
>_sym : Symbol(_sym, Decl(lateBoundClassMemberAssignmentJS2.js, 0, 5))
}
method() {
>method : Symbol(MyClass.method, Decl(lateBoundClassMemberAssignmentJS2.js, 4, 5))
this[_sym] = "yep";
>this : Symbol(MyClass, Decl(lateBoundClassMemberAssignmentJS2.js, 0, 27))
>_sym : Symbol(_sym, Decl(lateBoundClassMemberAssignmentJS2.js, 0, 5))
const x = this[_sym];
>x : Symbol(x, Decl(lateBoundClassMemberAssignmentJS2.js, 8, 13))
>this : Symbol(MyClass, Decl(lateBoundClassMemberAssignmentJS2.js, 0, 27))
>_sym : Symbol(_sym, Decl(lateBoundClassMemberAssignmentJS2.js, 0, 5))
}
}

View file

@ -0,0 +1,34 @@
=== tests/cases/conformance/salsa/lateBoundClassMemberAssignmentJS2.js ===
const _sym = "my-fake-sym";
>_sym : "my-fake-sym"
>"my-fake-sym" : "my-fake-sym"
export class MyClass {
>MyClass : MyClass
constructor() {
this[_sym] = "ok";
>this[_sym] = "ok" : "ok"
>this[_sym] : string
>this : this
>_sym : "my-fake-sym"
>"ok" : "ok"
}
method() {
>method : () => void
this[_sym] = "yep";
>this[_sym] = "yep" : "yep"
>this[_sym] : string
>this : this
>_sym : "my-fake-sym"
>"yep" : "yep"
const x = this[_sym];
>x : string
>this[_sym] : string
>this : this
>_sym : "my-fake-sym"
}
}

View file

@ -0,0 +1,22 @@
//// [index.ts]
export function foo() {}
foo.bar = 12;
const _private = Symbol();
foo[_private] = "ok";
const x: string = foo[_private];
//// [index.js]
export function foo() { }
foo.bar = 12;
const _private = Symbol();
foo[_private] = "ok";
const x = foo[_private];
//// [index.d.ts]
export declare function foo(): void;
export declare namespace foo {
var bar: number;
}

View file

@ -0,0 +1,22 @@
=== tests/cases/compiler/index.ts ===
export function foo() {}
>foo : Symbol(foo, Decl(index.ts, 0, 0), Decl(index.ts, 0, 24), Decl(index.ts, 2, 26))
foo.bar = 12;
>foo.bar : Symbol(foo.bar, Decl(index.ts, 0, 24))
>foo : Symbol(foo, Decl(index.ts, 0, 0), Decl(index.ts, 0, 24), Decl(index.ts, 2, 26))
>bar : Symbol(foo.bar, Decl(index.ts, 0, 24))
const _private = Symbol();
>_private : Symbol(_private, Decl(index.ts, 2, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
foo[_private] = "ok";
>foo : Symbol(foo, Decl(index.ts, 0, 0), Decl(index.ts, 0, 24), Decl(index.ts, 2, 26))
>_private : Symbol(_private, Decl(index.ts, 2, 5))
const x: string = foo[_private];
>x : Symbol(x, Decl(index.ts, 5, 5))
>foo : Symbol(foo, Decl(index.ts, 0, 0), Decl(index.ts, 0, 24), Decl(index.ts, 2, 26))
>_private : Symbol(_private, Decl(index.ts, 2, 5))

View file

@ -0,0 +1,29 @@
=== tests/cases/compiler/index.ts ===
export function foo() {}
>foo : typeof foo
foo.bar = 12;
>foo.bar = 12 : 12
>foo.bar : number
>foo : typeof foo
>bar : number
>12 : 12
const _private = Symbol();
>_private : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
foo[_private] = "ok";
>foo[_private] = "ok" : "ok"
>foo[_private] : string
>foo : typeof foo
>_private : unique symbol
>"ok" : "ok"
const x: string = foo[_private];
>x : string
>foo[_private] : string
>foo : typeof foo
>_private : unique symbol

View file

@ -0,0 +1,10 @@
// @declaration: true
// @target: es6
// @strict: true
// @filename: index.ts
export function foo() {}
foo.bar = 12;
const _private = Symbol();
foo[_private] = "ok";
const x: string = foo[_private];

View file

@ -0,0 +1,17 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @strict: true
// @target: es6
// @filename: lateBoundAssignmentDeclarationSupport1.js
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
exports[_sym] = "ok";
exports[_str] = "ok";
exports.S = _sym;
// @filename: usage.js
const x = require("./lateBoundAssignmentDeclarationSupport1.js");
const y = x["my-fake-sym"];
const z = x[x.S];

View file

@ -0,0 +1,17 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @strict: true
// @target: es6
// @filename: lateBoundAssignmentDeclarationSupport2.js
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
module.exports[_sym] = "ok";
module.exports[_str] = "ok";
module.exports.S = _sym;
// @filename: usage.js
const x = require("./lateBoundAssignmentDeclarationSupport2.js");
const y = x["my-fake-sym"];
const z = x[x.S];

View file

@ -0,0 +1,17 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @strict: true
// @target: es6
// @filename: lateBoundAssignmentDeclarationSupport3.js
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
Object.defineProperty(module.exports, _sym, { value: "ok" });
Object.defineProperty(module.exports, _str, { value: "ok" });
module.exports.S = _sym;
// @filename: usage.js
const x = require("./lateBoundAssignmentDeclarationSupport3.js");
const y = x["my-fake-sym"];
const z = x[x.S];

View file

@ -0,0 +1,24 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @strict: true
// @target: es6
// @filename: lateBoundAssignmentDeclarationSupport4.js
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
function F() {
}
F.prototype[_sym] = "ok";
F.prototype[_str] = "ok";
const inst = new F();
const _y = inst[_str];
const _z = inst[_sym];
module.exports.F = F;
module.exports.S = _sym;
// @filename: usage.js
const x = require("./lateBoundAssignmentDeclarationSupport4.js");
const inst = new x.F();
const y = inst["my-fake-sym"];
const z = inst[x.S];

View file

@ -0,0 +1,26 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @strict: true
// @target: es6
// @filename: lateBoundAssignmentDeclarationSupport5.js
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
function F() {
}
F.prototype = {
[_sym]: "ok",
[_str]: "ok"
}
const inst = new F();
const _y = inst[_str];
const _z = inst[_sym];
module.exports.F = F;
module.exports.S = _sym;
// @filename: usage.js
const x = require("./lateBoundAssignmentDeclarationSupport5.js");
const inst = new x.F();
const y = inst["my-fake-sym"];
const z = inst[x.S];

View file

@ -0,0 +1,25 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @strict: true
// @target: es6
// @filename: lateBoundAssignmentDeclarationSupport6.js
// currently unsupported
const _sym = Symbol();
const _str = "my-fake-sym";
function F() {
}
F.prototype.defsAClass = true;
Object.defineProperty(F.prototype, _str, {value: "ok"});
Object.defineProperty(F.prototype, _sym, {value: "ok"});
const inst = new F();
const _y = inst[_str];
const _z = inst[_sym];
module.exports.F = F;
module.exports.S = _sym;
// @filename: usage.js
const x = require("./lateBoundAssignmentDeclarationSupport6.js");
const inst = new x.F();
const y = inst["my-fake-sym"];
const z = inst[x.S];

View file

@ -0,0 +1,19 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @strict: true
// @target: es6
// @filename: lateBoundAssignmentDeclarationSupport7.js
const _sym = Symbol();
const _str = "my-fake-sym";
function F() {
}
F[_sym] = "ok";
F[_str] = "ok";
module.exports.F = F;
module.exports.S = _sym;
// @filename: usage.js
const x = require("./lateBoundAssignmentDeclarationSupport7.js");
const y = x.F["my-fake-sym"];
const z = x.F[x.S];

View file

@ -0,0 +1,18 @@
// @allowJs: true
// @checkJs: true
// @emitDeclarationOnly: true
// @strict: true
// @target: es6
// @declaration: true
// @filename: lateBoundClassMemberAssignmentJS.js
const _sym = Symbol("_sym");
export class MyClass {
constructor() {
this[_sym] = "ok";
}
method() {
this[_sym] = "yep";
const x = this[_sym];
}
}

View file

@ -0,0 +1,18 @@
// @allowJs: true
// @checkJs: true
// @emitDeclarationOnly: true
// @strict: true
// @target: es6
// @declaration: true
// @filename: lateBoundClassMemberAssignmentJS2.js
const _sym = "my-fake-sym";
export class MyClass {
constructor() {
this[_sym] = "ok";
}
method() {
this[_sym] = "yep";
const x = this[_sym];
}
}

View file

@ -0,0 +1,94 @@
/// <reference path="fourslash.ts"/>
// @checkJs: true
// @allowJs: true
// @target: es6
// @Filename: file.js
////const _sym = Symbol("_sym");
////class MyClass {
//// constructor() {
//// // Dynamic assignment properties can't show up in navigation,
//// // as they're not syntactic members
//// // Additonally, late bound members are always filtered out, besides
//// this[_sym] = "ok";
//// }
////
//// method() {
//// this[_sym] = "yep";
//// const x = this[_sym];
//// }
////}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "_sym",
"kind": "const"
},
{
"text": "MyClass",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "method",
"kind": "method",
"childItems": [
{
"text": "x",
"kind": "const"
}
]
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "_sym",
"kind": "const"
},
{
"text": "MyClass",
"kind": "class"
}
]
},
{
"text": "MyClass",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "method",
"kind": "method",
}
],
"indent": 1
},
{
"text": "method",
"kind": "method",
"childItems": [
{
"text": "x",
"kind": "const"
}
],
"indent": 2
}
]);

View file

@ -2,7 +2,7 @@
////const x = function () { return 111111; }
////x.[|{| "isWriteAccess": true, "isDefinition": true |}someProperty|] = 5;
////x["[|someProperty|]"] = 3;
////x["[|{| "isWriteAccess": true, "isDefinition": true |}someProperty|]"] = 3;
const ranges = test.ranges();
const [r0, r1] = ranges;

View file

@ -5,10 +5,10 @@
// @checkJs: true
////var x = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}someProperty|]": 0|] }
////x["[|someProperty|]"] = 3;
////[|x.[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 3 |}someProperty|] = 5;|]
////[|x["[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}someProperty|]"] = 3;|]
////[|x.[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}someProperty|] = 5;|]
const [r0Def, r0, r1, r2Def, r2] = test.ranges();
const [r0Def, r0, r1Def, r1, r2Def, r2] = test.ranges();
const ranges = [r0, r1, r2];
verify.referenceGroups(r0, [{ definition: '(property) "someProperty": number', ranges }]);
verify.referenceGroups([r1, r2], [