Better JS container binding (#24367)

* Static assignments to class expressions work

* Bind static properties of functions too

Also update SymbolLinks in getTypeOfFuncClassEnumModule so that the
type gets cached correctly.

* Remove initializer handling:obj literals+type lookup

Also include a couple of improved baselines

* Fix 1-nested js containers:binding+cross-file merge

* Consolidate check into one utility

The utility is horrible and needs to change, but at least it's in one
place.

Next step is to make the utility like getDeclarationOfAlias, except
getDeclarationOfJSAlias.

* Defaulted assignments now (mostly) work

* Default assignment definitely work, and IIFEs kind of do

* n-nested undeclared containers now seem to work

Merging even seems to work ok.

* Handle prototype+prototype property assignments

Perhaps in the wrong way. I have an idea how to simplify them.

* Remove prototype special-case

1. It's not completely removed; the checker code in
getJavascriptClassType needs to be fixed, among other places.
2. I didn't actually remove the code so that it will be easier to see
what used to be there on Monday.

Regardless, the code will be much simpler and seems to be mostly
improved with very little work so far.

* Allow more merges+accept baselines

* Update more baselines

* Fix js initializer check in bindPropertyAssignment

* Fix codefixes

* Rest of strictNullChecks cleanup + other cleanup

1. Remove a few TODOs
2. Remove extraneous SymbolFlag
3. Simplify isSameDefaultedName

* Binder cleanup

* Checker cleanup

* Almost done with utilities cleanup

* Utilities cleanup

* Require js initializer to be (1) JS (2) initializer

Change getDeclarationOfJSInitializer to require that the provided js
initializer be in a javascript file, and that it is the initializer of
the retrieved declaration.

* Use getSymbolOfNode instead of accessing symbol directly

* Ugh. Start over with just test cases

* Handle additional cases in getTypeOfVariableOrParameterOrProperty

These are cases in a really embarrassing check, in which we admit that
the symbol flags steered us wrong and switch to
getTypeOfFuncClassEnumModule instead (which never asserts).

* Add test case for #24111

* Address PR comments
This commit is contained in:
Nathan Shively-Sanders 2018-05-31 11:41:26 -07:00 committed by GitHub
parent 70ad5a39c3
commit d187de2076
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 653 additions and 479 deletions

View file

@ -1698,6 +1698,7 @@ namespace ts {
symbol.parent = container.symbol;
}
addDeclarationToSymbol(symbol, node, symbolFlags);
return symbol;
}
function bindBlockScopedDeclaration(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
@ -2317,13 +2318,11 @@ namespace ts {
// expression is the declaration
setCommonJsModuleIndicator(node);
const lhs = node.left as PropertyAccessEntityNameExpression;
const symbol = forEachIdentifierInEntityName(lhs.expression, (id, original) => {
if (!original) {
return undefined;
const symbol = forEachIdentifierInEntityName(lhs.expression, /*parent*/ undefined, (id, symbol) => {
if (symbol) {
addDeclarationToSymbol(symbol, id, SymbolFlags.Module | SymbolFlags.JSContainer);
}
const s = getJSInitializerSymbol(original)!;
addDeclarationToSymbol(s, id, SymbolFlags.Module | SymbolFlags.JSContainer);
return s;
return symbol;
});
if (symbol) {
const flags = isClassExpression(node.right) ?
@ -2359,12 +2358,12 @@ namespace ts {
switch (thisContainer.kind) {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
let constructorSymbol = thisContainer.symbol;
let constructorSymbol: Symbol | undefined = thisContainer.symbol;
// For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression.
if (isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === SyntaxKind.EqualsToken) {
const l = thisContainer.parent.left;
if (isPropertyAccessEntityNameExpression(l) && isPrototypeAccess(l.expression)) {
constructorSymbol = getJSInitializerSymbolFromName(l.expression.expression, thisParentContainer)!;
constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer);
}
}
@ -2463,46 +2462,67 @@ namespace ts {
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false);
}
function getJSInitializerSymbolFromName(name: EntityNameExpression, lookupContainer?: Node): Symbol | undefined {
return getJSInitializerSymbol(lookupSymbolForPropertyAccess(name, lookupContainer));
}
function bindPropertyAssignment(name: EntityNameExpression, propertyAccess: PropertyAccessEntityNameExpression, isPrototypeProperty: boolean) {
let symbol = getJSInitializerSymbolFromName(name);
let namespaceSymbol = lookupSymbolForPropertyAccess(name);
const isToplevelNamespaceableInitializer = isBinaryExpression(propertyAccess.parent)
? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === SyntaxKind.SourceFile &&
!!getJavascriptInitializer(getInitializerOfBinaryExpression(propertyAccess.parent), isPrototypeAccess(propertyAccess.parent.left))
: propertyAccess.parent.parent.kind === SyntaxKind.SourceFile;
if (!isPrototypeProperty && (!symbol || !(symbol.flags & SymbolFlags.Namespace)) && isToplevelNamespaceableInitializer) {
if (!isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & SymbolFlags.Namespace)) && isToplevelNamespaceableInitializer) {
// make symbols or add declarations for intermediate containers
const flags = SymbolFlags.Module | SymbolFlags.JSContainer;
const excludeFlags = SymbolFlags.ValueModuleExcludes & ~SymbolFlags.JSContainer;
forEachIdentifierInEntityName(propertyAccess.expression, (id, original) => {
if (original) {
// Note: add declaration to original symbol, not the special-syntax's symbol, so that namespaces work for type lookup
addDeclarationToSymbol(original, id, flags);
return original;
namespaceSymbol = forEachIdentifierInEntityName(propertyAccess.expression, namespaceSymbol, (id, symbol, parent) => {
if (symbol) {
addDeclarationToSymbol(symbol, id, flags);
return symbol;
}
else {
return symbol = declareSymbol(symbol ? symbol.exports! : container.locals!, symbol, id, flags, excludeFlags);
return declareSymbol(parent ? parent.exports! : container.locals!, parent, id, flags, excludeFlags);
}
});
}
if (!symbol || !(symbol.flags & (SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.NamespaceModule | SymbolFlags.ObjectLiteral))) {
if (!namespaceSymbol || !isJavascriptContainer(namespaceSymbol)) {
return;
}
// Set up the members collection if it doesn't exist already
const symbolTable = isPrototypeProperty ?
(symbol.members || (symbol.members = createSymbolTable())) :
(symbol.exports || (symbol.exports = createSymbolTable()));
(namespaceSymbol.members || (namespaceSymbol.members = createSymbolTable())) :
(namespaceSymbol.exports || (namespaceSymbol.exports = createSymbolTable()));
// Declare the method/property
const jsContainerFlag = isToplevelNamespaceableInitializer ? SymbolFlags.JSContainer : 0;
const isMethod = isFunctionLikeDeclaration(getAssignedJavascriptInitializer(propertyAccess)!); // TODO: GH#18217
const isMethod = isFunctionLikeDeclaration(getAssignedJavascriptInitializer(propertyAccess)!);
const symbolFlags = (isMethod ? SymbolFlags.Method : SymbolFlags.Property) | jsContainerFlag;
const symbolExcludes = (isMethod ? SymbolFlags.MethodExcludes : SymbolFlags.PropertyExcludes) & ~jsContainerFlag;
declareSymbol(symbolTable, symbol, propertyAccess, symbolFlags, symbolExcludes);
declareSymbol(symbolTable, namespaceSymbol, propertyAccess, symbolFlags, symbolExcludes);
}
/**
* Javascript containers are:
* - Functions
* - classes
* - namespaces
* - variables initialized with function expressions
* - with class expressions
* - with empty object literals
* - with non-empty object literals if assigned to the prototype property
*/
function isJavascriptContainer(symbol: Symbol): boolean {
const node = symbol.valueDeclaration;
if (symbol.flags & (SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.NamespaceModule)) {
return true;
}
const init = isVariableDeclaration(node) ? node.initializer :
isBinaryExpression(node) ? node.right :
isPropertyAccessExpression(node) && isBinaryExpression(node.parent) ? node.parent.right :
undefined;
if (init) {
const isPrototypeAssignment = isPrototypeAccess(isVariableDeclaration(node) ? node.name : isBinaryExpression(node) ? node.left : node);
return !!getJavascriptInitializer(isBinaryExpression(init) && init.operatorToken.kind === SyntaxKind.BarBarToken ? init.right : init, isPrototypeAssignment);
}
return false;
}
function getParentOfBinaryExpression(expr: BinaryExpression) {
@ -2517,22 +2537,22 @@ namespace ts {
return lookupSymbolForNameWorker(lookupContainer, node.escapedText);
}
else {
const symbol = getJSInitializerSymbol(lookupSymbolForPropertyAccess(node.expression));
const symbol = lookupSymbolForPropertyAccess(node.expression);
return symbol && symbol.exports && symbol.exports.get(node.name.escapedText);
}
}
function forEachIdentifierInEntityName(e: EntityNameExpression, action: (e: Identifier, symbol: Symbol | undefined) => Symbol | undefined): Symbol | undefined {
function forEachIdentifierInEntityName(e: EntityNameExpression, parent: Symbol | undefined, action: (e: Identifier, symbol: Symbol | undefined, parent: Symbol | undefined) => Symbol | undefined): Symbol | undefined {
if (isExportsOrModuleExportsOrAlias(file, e)) {
return file.symbol;
}
else if (isIdentifier(e)) {
return action(e, lookupSymbolForPropertyAccess(e));
return action(e, lookupSymbolForPropertyAccess(e), parent);
}
else {
const s = getJSInitializerSymbol(forEachIdentifierInEntityName(e.expression, action));
const s = forEachIdentifierInEntityName(e.expression, parent, action);
if (!s || !s.exports) return Debug.fail();
return action(e.name, s.exports.get(e.name.escapedText));
return action(e.name, s.exports.get(e.name.escapedText), s);
}
}
@ -2596,7 +2616,7 @@ namespace ts {
bindBlockScopedVariableDeclaration(node);
}
else if (isParameterDeclaration(node)) {
// It is safe to walk up parent chain to find whether the node is a destructing parameter declaration
// It is safe to walk up parent chain to find whether the node is a destructuring parameter declaration
// because its parent chain has already been set up, since parents are set before descending into children.
//
// If node is a binding element in parameter declaration, we need to use ParameterExcludes.

View file

@ -889,11 +889,17 @@ namespace ts {
return result;
}
function mergeSymbol(target: Symbol, source: Symbol) {
/**
* Note: if target is transient, then it is mutable, and mergeSymbol with both mutate and return it.
* If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it.
*/
function mergeSymbol(target: Symbol, source: Symbol): Symbol {
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
(source.flags | target.flags) & SymbolFlags.JSContainer) {
const targetValueDeclaration = target.valueDeclaration;
Debug.assert(!!(target.flags & SymbolFlags.Transient));
Debug.assert(source !== target);
if (!(target.flags & SymbolFlags.Transient)) {
target = cloneSymbol(target);
}
// Javascript static-property-assignment declarations always merge, even though they are also values
if (source.flags & SymbolFlags.ValueModule && target.flags & SymbolFlags.ValueModule && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
// reset flag when merging instantiated module into value module that has only const enums
@ -915,18 +921,6 @@ namespace ts {
if (!target.exports) target.exports = createSymbolTable();
mergeSymbolTable(target.exports, source.exports);
}
if ((source.flags | target.flags) & SymbolFlags.JSContainer) {
const sourceInitializer = getJSInitializerSymbol(source)!;
const init = getDeclaredJavascriptInitializer(targetValueDeclaration) || getAssignedJavascriptInitializer(targetValueDeclaration);
let targetInitializer = init && init.symbol ? init.symbol : target;
if (!(targetInitializer.flags & SymbolFlags.Transient)) {
const mergedInitializer = getMergedSymbol(targetInitializer);
targetInitializer = mergedInitializer === targetInitializer ? cloneSymbol(targetInitializer) : mergedInitializer;
}
if (sourceInitializer !== source || targetInitializer !== target) {
mergeSymbol(targetInitializer, sourceInitializer);
}
}
recordMergedSymbol(target, source);
}
else if (target.flags & SymbolFlags.NamespaceModule) {
@ -947,11 +941,12 @@ namespace ts {
error(errorNode, message, symbolToString(source));
});
}
return target;
}
function combineSymbolTables(first: SymbolTable | undefined, second: SymbolTable | undefined): SymbolTable | undefined {
if (!first || first.size === 0) return second;
if (!second || second.size === 0) return first;
if (!hasEntries(first)) return second;
if (!hasEntries(second)) return first;
const combined = createSymbolTable();
mergeSymbolTable(combined, first);
mergeSymbolTable(combined, second);
@ -960,17 +955,7 @@ namespace ts {
function mergeSymbolTable(target: SymbolTable, source: SymbolTable) {
source.forEach((sourceSymbol, id) => {
let targetSymbol = target.get(id);
if (!targetSymbol) {
target.set(id, sourceSymbol);
}
else {
if (!(targetSymbol.flags & SymbolFlags.Transient)) {
targetSymbol = cloneSymbol(targetSymbol);
target.set(id, targetSymbol);
}
mergeSymbol(targetSymbol, sourceSymbol);
}
target.set(id, target.has(id) ? mergeSymbol(target.get(id)!, sourceSymbol) : sourceSymbol);
});
}
@ -1000,10 +985,7 @@ namespace ts {
// obtain item referenced by 'export='
mainModule = resolveExternalModuleSymbol(mainModule);
if (mainModule.flags & SymbolFlags.Namespace) {
// if module symbol has already been merged - it is safe to use it.
// otherwise clone it
mainModule = mainModule.flags & SymbolFlags.Transient ? mainModule : cloneSymbol(mainModule);
mergeSymbol(mainModule, moduleAugmentation.symbol);
mainModule = mergeSymbol(mainModule, moduleAugmentation.symbol);
}
else {
// moduleName will be a StringLiteral since this is not `declare global`.
@ -2124,14 +2106,6 @@ namespace ts {
return namespace;
}
if (isInJavaScriptFile(name)) {
const initializer = getDeclaredJavascriptInitializer(namespace.valueDeclaration) || getAssignedJavascriptInitializer(namespace.valueDeclaration);
if (initializer) {
namespace = getSymbolOfNode(initializer)!;
}
// Currently, IIFEs may not have a symbol and we don't know about their contents. Give up in this case.
if (!namespace) {
return undefined;
}
if (namespace.valueDeclaration &&
isVariableDeclaration(namespace.valueDeclaration) &&
namespace.valueDeclaration.initializer &&
@ -2324,14 +2298,7 @@ namespace ts {
}
moduleSymbol.exports!.forEach((s, name) => {
if (name === InternalSymbolName.ExportEquals) return;
if (!merged.exports!.has(name)) {
merged.exports!.set(name, s);
}
else {
const ms = cloneSymbol(merged.exports!.get(name)!);
mergeSymbol(ms, s);
merged.exports!.set(name, ms);
}
merged.exports!.set(name, merged.exports!.has(name) ? mergeSymbol(merged.exports!.get(name)!, s) : s);
});
return merged;
}
@ -4966,6 +4933,8 @@ namespace ts {
else if (isJSDocPropertyLikeTag(declaration)
|| isPropertyAccessExpression(declaration)
|| isIdentifier(declaration)
|| isClassDeclaration(declaration)
|| isFunctionDeclaration(declaration)
|| (isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration))
|| isMethodSignature(declaration)) {
@ -4995,7 +4964,7 @@ namespace ts {
type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
}
else {
return Debug.fail("Unhandled declaration kind! " + Debug.showSyntaxKind(declaration));
return Debug.fail("Unhandled declaration kind! " + Debug.showSyntaxKind(declaration) + " for " + Debug.showSymbol(symbol));
}
if (!popTypeResolution()) {
@ -5097,8 +5066,25 @@ namespace ts {
}
function getTypeOfFuncClassEnumModule(symbol: Symbol): Type {
const links = getSymbolLinks(symbol);
let links = getSymbolLinks(symbol);
if (!links.type) {
const jsDeclaration = getDeclarationOfJSInitializer(symbol.valueDeclaration);
if (jsDeclaration) {
const jsSymbol = getSymbolOfNode(jsDeclaration);
if (jsSymbol && (hasEntries(jsSymbol.exports) || hasEntries(jsSymbol.members))) {
symbol = cloneSymbol(symbol);
// note:we overwrite links because we just cloned the symbol
links = symbol as TransientSymbol;
if (hasEntries(jsSymbol.exports)) {
symbol.exports = symbol.exports || createSymbolTable();
mergeSymbolTable(symbol.exports, jsSymbol.exports);
}
if (hasEntries(jsSymbol.members)) {
symbol.members = symbol.members || createSymbolTable();
mergeSymbolTable(symbol.members, jsSymbol.members);
}
}
}
if (symbol.flags & SymbolFlags.Module && isShorthandAmbientModuleSymbol(symbol)) {
links.type = anyType;
}
@ -7446,18 +7432,17 @@ namespace ts {
const result: Signature[] = [];
for (let i = 0; i < symbol.declarations.length; i++) {
const decl = symbol.declarations[i];
const node = isPropertyAccessExpression(decl) ? getAssignedJavascriptInitializer(decl)! : decl; // TODO: GH#18217
if (!isFunctionLike(node)) continue;
if (!isFunctionLike(decl)) continue;
// Don't include signature if node is the implementation of an overloaded function. A node is considered
// an implementation node if it has a body and the previous node is of the same kind and immediately
// precedes the implementation node (i.e. has the same parent and ends where the implementation starts).
if (i > 0 && (node as FunctionLikeDeclaration).body) {
if (i > 0 && (decl as FunctionLikeDeclaration).body) {
const previous = symbol.declarations[i - 1];
if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) {
if (decl.parent === previous.parent && decl.kind === previous.kind && decl.pos === previous.end) {
continue;
}
}
result.push(getSignatureFromDeclaration(node));
result.push(getSignatureFromDeclaration(decl));
}
return result;
}
@ -15299,7 +15284,7 @@ namespace ts {
// expression has no contextual type, the right operand is contextually typed by the type of the left operand,
// except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}`
const type = getContextualType(binaryExpression);
return !type && node === right && !getDeclaredJavascriptInitializer(binaryExpression.parent) && !getAssignedJavascriptInitializer(binaryExpression) ?
return !type && node === right && !isDefaultedJavascriptInitializer(binaryExpression) ?
getTypeOfExpression(left) : type;
case SyntaxKind.AmpersandAmpersandToken:
case SyntaxKind.CommaToken:
@ -15308,6 +15293,7 @@ namespace ts {
return undefined;
}
}
// In an assignment expression, the right operand is contextually typed by the type of the left operand.
// Don't do this for special property assignments to avoid circularity.
function isContextSensitiveAssignment(binaryExpression: BinaryExpression): boolean {
@ -15975,13 +15961,16 @@ namespace ts {
let hasComputedStringProperty = false;
let hasComputedNumberProperty = false;
if (isInJSFile && node.properties.length === 0) {
// an empty JS object literal that nonetheless has members is a JS namespace
const symbol = getSymbolOfNode(node);
if (symbol.exports) {
propertiesTable = symbol.exports;
symbol.exports.forEach(symbol => propertiesArray.push(getMergedSymbol(symbol)));
return createObjectLiteralType();
if (isInJSFile) {
const decl = getDeclarationOfJSInitializer(node);
if (decl) {
// a JS object literal whose declaration's symbol has exports is a JS namespace
const symbol = getMergedSymbol(decl.symbol);
if (symbol && hasEntries(symbol.exports)) {
propertiesTable = symbol.exports;
symbol.exports.forEach(symbol => propertiesArray.push(getMergedSymbol(symbol)));
return createObjectLiteralType();
}
}
}
propertiesTable = createSymbolTable();
@ -19083,10 +19072,6 @@ namespace ts {
}
function getJavaScriptClassType(symbol: Symbol): Type | undefined {
const initializer = getDeclaredJavascriptInitializer(symbol.valueDeclaration);
if (initializer) {
symbol = getSymbolOfNode(initializer)!;
}
let inferred: Type | undefined;
if (isJavaScriptConstructor(symbol.valueDeclaration)) {
inferred = getInferredClassType(symbol);
@ -19197,7 +19182,17 @@ namespace ts {
if (returnType.flags & TypeFlags.ESSymbolLike && isSymbolOrSymbolForCall(node)) {
return getESSymbolLikeTypeForNode(walkUpParenthesizedExpressions(node.parent));
}
return returnType;
let jsAssignmentType: Type | undefined;
if (isInJavaScriptFile(node)) {
const decl = getDeclarationOfJSInitializer(node);
if (decl) {
const jsSymbol = getSymbolOfNode(decl);
if (jsSymbol && hasEntries(jsSymbol.exports)) {
jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, jsObjectLiteralIndexInfo, undefined);
}
}
}
return jsAssignmentType ? getIntersectionType([returnType, jsAssignmentType]) : returnType;
}
function isSymbolOrSymbolForCall(node: Node) {
@ -20693,13 +20688,12 @@ namespace ts {
}
function checkDeclarationInitializer(declaration: HasExpressionInitializer) {
const inJs = isInJavaScriptFile(declaration);
const initializer = inJs && getDeclaredJavascriptInitializer(declaration) || declaration.initializer!;
const initializer = getEffectiveInitializer(declaration)!;
const type = getTypeOfExpression(initializer, /*cache*/ true);
const widened = getCombinedNodeFlags(declaration) & NodeFlags.Const ||
(getCombinedModifierFlags(declaration) & ModifierFlags.Readonly && !isParameterPropertyDeclaration(declaration)) ||
isTypeAssertion(initializer) ? type : getWidenedLiteralType(type);
if (inJs) {
if (isInJavaScriptFile(declaration)) {
if (widened.flags & TypeFlags.Nullable) {
if (noImplicitAny) {
reportImplicitAnyError(declaration, anyType);
@ -23325,8 +23319,8 @@ namespace ts {
if (node === symbol.valueDeclaration) {
// Node is the primary declaration of the symbol, just validate the initializer
// Don't validate for-in initializer as it is already an error
if (node.initializer && node.parent.parent.kind !== SyntaxKind.ForInStatement) {
const initializer = isInJavaScriptFile(node) && getDeclaredJavascriptInitializer(node) || node.initializer;
const initializer = getEffectiveInitializer(node);
if (initializer && node.parent.parent.kind !== SyntaxKind.ForInStatement) {
checkTypeAssignableTo(checkExpressionCached(initializer), type, node, /*headMessage*/ undefined);
checkParameterInitializer(node);
}

View file

@ -169,6 +169,10 @@ namespace ts {
return array ? array.length : 0;
}
export function hasEntries(map: ReadonlyUnderscoreEscapedMap<any> | undefined): map is ReadonlyUnderscoreEscapedMap<any> {
return !!map && !!map.size;
}
/**
* Iterates through 'array' by index and performs the callback on each element of array until the callback
* returns a truthy value, then returns that value.

View file

@ -1560,28 +1560,49 @@ namespace ts {
return getSourceTextOfNodeFromSourceFile(sourceFile, str).charCodeAt(0) === CharacterCodes.doubleQuote;
}
/**
* Given the symbol of a declaration, find the symbol of its Javascript container-like initializer,
* if it has one. Otherwise just return the original symbol.
*
* Container-like initializer behave like namespaces, so the binder needs to add contained symbols
* to their exports. An example is a function with assignments to `this` inside.
*/
export function getJSInitializerSymbol(symbol: Symbol | undefined) {
if (!symbol || !symbol.valueDeclaration) {
return symbol;
export function getDeclarationOfJSInitializer(node: Node): Node | undefined {
if (!isInJavaScriptFile(node) || !node.parent) {
return undefined;
}
const declaration = symbol.valueDeclaration;
const e = getDeclaredJavascriptInitializer(declaration) || getAssignedJavascriptInitializer(declaration);
return e && e.symbol ? e.symbol : symbol;
let name: Expression | BindingName | undefined;
let decl: Node | undefined;
if (isVariableDeclaration(node.parent) && node.parent.initializer === node) {
name = node.parent.name;
decl = node.parent;
}
else if (isBinaryExpression(node.parent) && node.parent.operatorToken.kind === SyntaxKind.EqualsToken && node.parent.right === node) {
name = node.parent.left;
decl = name;
}
else if (isBinaryExpression(node.parent) && node.parent.operatorToken.kind === SyntaxKind.BarBarToken) {
if (isVariableDeclaration(node.parent.parent) && node.parent.parent.initializer === node.parent) {
name = node.parent.parent.name;
decl = node.parent.parent;
}
else if (isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === SyntaxKind.EqualsToken && node.parent.parent.right === node.parent) {
name = node.parent.parent.left;
decl = name;
}
if (!name || !isEntityNameExpression(name) || !isSameEntityName(name, node.parent.left)) {
return undefined;
}
}
if (!name || !getJavascriptInitializer(node, isPrototypeAccess(name))) {
return undefined;
}
return decl;
}
/** Get the declaration initializer, when the initializer is container-like (See getJavascriptInitializer) */
export function getDeclaredJavascriptInitializer(node: Node) {
if (node && isVariableDeclaration(node) && node.initializer) {
return getJavascriptInitializer(node.initializer, /*isPrototypeAssignment*/ false) ||
isIdentifier(node.name) && getDefaultedJavascriptInitializer(node.name, node.initializer, /*isPrototypeAssignment*/ false);
/** Get the initializer, taking into account defaulted Javascript initializers */
export function getEffectiveInitializer(node: HasExpressionInitializer) {
if (isInJavaScriptFile(node) && node.initializer &&
isBinaryExpression(node.initializer) && node.initializer.operatorToken.kind === SyntaxKind.BarBarToken &&
node.name && isEntityNameExpression(node.name) && isSameEntityName(node.name, node.initializer.left)) {
return node.initializer.right;
}
return node.initializer;
}
/**
@ -1636,6 +1657,13 @@ namespace ts {
}
}
export function isDefaultedJavascriptInitializer(node: BinaryExpression) {
const name = isVariableDeclaration(node.parent) ? node.parent.name :
isBinaryExpression(node.parent) && node.parent.operatorToken.kind === SyntaxKind.EqualsToken ? node.parent.left :
undefined;
return name && getJavascriptInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
}
/** Given a Javascript initializer, return the outer name. That is, the lhs of the assignment or the declaration name. */
export function getOuterNameOfJsInitializer(node: Declaration): DeclarationName | undefined {
if (isBinaryExpression(node.parent)) {
@ -1658,7 +1686,7 @@ namespace ts {
* var min = window.min || {}
* my.app = self.my.app || class { }
*/
function isSameEntityName(name: EntityNameExpression, initializer: EntityNameExpression): boolean {
function isSameEntityName(name: Expression, initializer: Expression): boolean {
if (isIdentifier(name) && isIdentifier(initializer)) {
return name.escapedText === initializer.escapedText;
}

View file

@ -176,7 +176,7 @@ namespace ts.codefix {
return undefined;
}
const memberElements = createClassElementsFromSymbol(initializer.symbol);
const memberElements = createClassElementsFromSymbol(node.symbol);
if (initializer.body) {
memberElements.unshift(createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, initializer.parameters, initializer.body));
}

View file

@ -14,15 +14,25 @@ namespace ts {
const isJsFile = isSourceFileJavaScript(sourceFile);
function check(node: Node) {
switch (node.kind) {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
if (isJsFile) {
if (node.symbol.members && (node.symbol.members.size > 0)) {
if (isJsFile) {
switch (node.kind) {
case SyntaxKind.FunctionExpression:
const decl = getDeclarationOfJSInitializer(node);
if (decl) {
const symbol = decl.symbol;
if (symbol && (symbol.exports && symbol.exports.size || symbol.members && symbol.members.size)) {
diags.push(createDiagnosticForNode(isVariableDeclaration(node.parent) ? node.parent.name : node, Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
break;
}
}
// falls through if no diagnostic was created
case SyntaxKind.FunctionDeclaration:
const symbol = node.symbol;
if (symbol.members && (symbol.members.size > 0)) {
diags.push(createDiagnosticForNode(isVariableDeclaration(node.parent) ? node.parent.name : node, Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
}
break;
}
break;
}
if (!isJsFile && codefix.parameterShouldGetTypeFromJSDoc(node)) {

View file

@ -62,12 +62,12 @@ exports.B = B
>B : Symbol(B, Decl(mod.js, 4, 3), Decl(mod.js, 9, 13))
A.prototype = B.prototype = {
>A.prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>A.prototype : Symbol(A.prototype, Decl(mod.js, 8, 13))
>A : Symbol(A, Decl(mod.js, 1, 3), Decl(mod.js, 8, 13))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>B.prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>prototype : Symbol(A.prototype, Decl(mod.js, 8, 13))
>B.prototype : Symbol(B.prototype, Decl(mod.js, 9, 13))
>B : Symbol(B, Decl(mod.js, 4, 3), Decl(mod.js, 9, 13))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>prototype : Symbol(B.prototype, Decl(mod.js, 9, 13))
/** @param {number} n */
m(n) {

View file

@ -82,13 +82,13 @@ exports.B = B
A.prototype = B.prototype = {
>A.prototype = B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; }
>A.prototype : any
>A.prototype : { [x: string]: any; m(n: number): number; }
>A : typeof A
>prototype : any
>prototype : { [x: string]: any; m(n: number): number; }
>B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; }
>B.prototype : any
>B.prototype : { [x: string]: any; m(n: number): number; }
>B : typeof B
>prototype : any
>prototype : { [x: string]: any; m(n: number): number; }
>{ /** @param {number} n */ m(n) { return n + 1 }} : { [x: string]: any; m(n: number): number; }
/** @param {number} n */

View file

@ -1,18 +1,18 @@
=== tests/cases/conformance/salsa/mod.js ===
exports.n = {};
>exports.n : Symbol(n, Decl(mod.js, 0, 0))
>exports : Symbol(n, Decl(mod.js, 0, 0))
>n : Symbol(n, Decl(mod.js, 0, 0))
>exports.n : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 8))
>exports : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 8))
>n : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 8))
exports.n.K = function () {
>exports.n.K : Symbol(K, Decl(mod.js, 0, 15))
>exports.n : Symbol(K, Decl(mod.js, 0, 15))
>exports.n.K : Symbol(n.K, Decl(mod.js, 0, 15))
>exports.n : Symbol(n.K, Decl(mod.js, 0, 15))
>exports : Symbol("tests/cases/conformance/salsa/mod", Decl(mod.js, 0, 0))
>n : Symbol(n, Decl(mod.js, 0, 0))
>K : Symbol(K, Decl(mod.js, 0, 15))
>n : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 8))
>K : Symbol(n.K, Decl(mod.js, 0, 15))
this.x = 10;
>this : Symbol(__object, Decl(mod.js, 0, 11), Decl(mod.js, 1, 8))
>this : Symbol(__object, Decl(mod.js, 0, 11))
>x : Symbol(K.x, Decl(mod.js, 1, 27))
}
exports.Classic = class {
@ -34,11 +34,11 @@ import * as s from './mod'
var k = new s.n.K()
>k : Symbol(k, Decl(use.js, 2, 3))
>s.n.K : Symbol(K, Decl(mod.js, 0, 15))
>s.n : Symbol(s.n, Decl(mod.js, 0, 0))
>s.n.K : Symbol(s.n.K, Decl(mod.js, 0, 15))
>s.n : Symbol(s.n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 8))
>s : Symbol(s, Decl(use.js, 0, 6))
>n : Symbol(s.n, Decl(mod.js, 0, 0))
>K : Symbol(K, Decl(mod.js, 0, 15))
>n : Symbol(s.n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 8))
>K : Symbol(s.n.K, Decl(mod.js, 0, 15))
k.x
>k.x : Symbol(K.x, Decl(mod.js, 1, 27))

View file

@ -1,24 +1,24 @@
=== tests/cases/conformance/salsa/mod.js ===
exports.n = {};
>exports.n = {} : typeof __object
>exports.n : typeof __object
>exports.n = {} : { [x: string]: any; K: typeof K; }
>exports.n : { [x: string]: any; K: typeof K; }
>exports : typeof import("tests/cases/conformance/salsa/mod")
>n : typeof __object
>{} : typeof __object
>n : { [x: string]: any; K: typeof K; }
>{} : { [x: string]: any; K: typeof K; }
exports.n.K = function () {
>exports.n.K = function () { this.x = 10;} : typeof K
>exports.n.K : typeof K
>exports.n : typeof __object
>exports.n : { [x: string]: any; K: typeof K; }
>exports : typeof import("tests/cases/conformance/salsa/mod")
>n : typeof __object
>n : { [x: string]: any; K: typeof K; }
>K : typeof K
>function () { this.x = 10;} : typeof K
this.x = 10;
>this.x = 10 : 10
>this.x : any
>this : typeof __object
>this : { [x: string]: any; K: typeof K; }
>x : any
>10 : 10
}
@ -47,9 +47,9 @@ var k = new s.n.K()
>k : K
>new s.n.K() : K
>s.n.K : typeof K
>s.n : typeof __object
>s.n : { [x: string]: any; K: typeof K; }
>s : typeof s
>n : typeof __object
>n : { [x: string]: any; K: typeof K; }
>K : typeof K
k.x

View file

@ -81,11 +81,11 @@ var n = a.C1.staticProp;
var n = a.C2.staticProp;
>n : Symbol(n, Decl(b.ts, 1, 3), Decl(b.ts, 3, 3), Decl(b.ts, 4, 3), Decl(b.ts, 5, 3), Decl(b.ts, 6, 3) ... and 4 more)
>a.C2.staticProp : Symbol(C2.staticProp, Decl(a.js, 6, 26))
>a.C2.staticProp : Symbol(a.C2.staticProp, Decl(a.js, 6, 26))
>a.C2 : Symbol(a.C2, Decl(a.js, 6, 10))
>a : Symbol(a, Decl(b.ts, 0, 6))
>C2 : Symbol(a.C2, Decl(a.js, 6, 10))
>staticProp : Symbol(C2.staticProp, Decl(a.js, 6, 26))
>staticProp : Symbol(a.C2.staticProp, Decl(a.js, 6, 26))
var n = a.F1.staticProp;
>n : Symbol(n, Decl(b.ts, 1, 3), Decl(b.ts, 3, 3), Decl(b.ts, 4, 3), Decl(b.ts, 5, 3), Decl(b.ts, 6, 3) ... and 4 more)
@ -97,11 +97,11 @@ var n = a.F1.staticProp;
var n = a.F2.staticProp;
>n : Symbol(n, Decl(b.ts, 1, 3), Decl(b.ts, 3, 3), Decl(b.ts, 4, 3), Decl(b.ts, 5, 3), Decl(b.ts, 6, 3) ... and 4 more)
>a.F2.staticProp : Symbol(F2.staticProp, Decl(a.js, 9, 32))
>a.F2.staticProp : Symbol(a.F2.staticProp, Decl(a.js, 9, 32))
>a.F2 : Symbol(a.F2, Decl(a.js, 9, 10))
>a : Symbol(a, Decl(b.ts, 0, 6))
>F2 : Symbol(a.F2, Decl(a.js, 9, 10))
>staticProp : Symbol(F2.staticProp, Decl(a.js, 9, 32))
>staticProp : Symbol(a.F2.staticProp, Decl(a.js, 9, 32))
var n = C3.staticProp;

View file

@ -4,15 +4,15 @@ const a = {};
>a : Symbol(a, Decl(a.js, 1, 5), Decl(a.js, 1, 13), Decl(b.js, 0, 0))
a.d = function() {};
>a.d : Symbol(d, Decl(a.js, 1, 13), Decl(b.js, 0, 2))
>a.d : Symbol(a.d, Decl(a.js, 1, 13), Decl(b.js, 0, 2))
>a : Symbol(a, Decl(a.js, 1, 5), Decl(a.js, 1, 13), Decl(b.js, 0, 0))
>d : Symbol(d, Decl(a.js, 1, 13), Decl(b.js, 0, 2))
>d : Symbol(a.d, Decl(a.js, 1, 13), Decl(b.js, 0, 2))
=== tests/cases/conformance/salsa/b.js ===
a.d.prototype = {};
>a.d.prototype : Symbol(d.prototype, Decl(b.js, 0, 0))
>a.d : Symbol(d, Decl(a.js, 1, 13), Decl(b.js, 0, 2))
>a.d.prototype : Symbol(a.d.prototype, Decl(b.js, 0, 0))
>a.d : Symbol(a.d, Decl(a.js, 1, 13), Decl(b.js, 0, 2))
>a : Symbol(a, Decl(a.js, 1, 5), Decl(a.js, 1, 13), Decl(b.js, 0, 0))
>d : Symbol(d, Decl(a.js, 1, 13), Decl(b.js, 0, 2))
>prototype : Symbol(d.prototype, Decl(b.js, 0, 0))
>d : Symbol(a.d, Decl(a.js, 1, 13), Decl(b.js, 0, 2))
>prototype : Symbol(a.d.prototype, Decl(b.js, 0, 0))

View file

@ -1,23 +1,23 @@
=== tests/cases/conformance/salsa/a.js ===
// #24131
const a = {};
>a : { [x: string]: any; d: typeof d; }
>{} : { [x: string]: any; d: typeof d; }
>a : { [x: string]: any; d: { (): void; prototype: { [x: string]: any; }; }; }
>{} : { [x: string]: any; d: { (): void; prototype: { [x: string]: any; }; }; }
a.d = function() {};
>a.d = function() {} : typeof d
>a.d : typeof d
>a : { [x: string]: any; d: typeof d; }
>d : typeof d
>function() {} : typeof d
>a.d = function() {} : { (): void; prototype: { [x: string]: any; }; }
>a.d : { (): void; prototype: { [x: string]: any; }; }
>a : { [x: string]: any; d: { (): void; prototype: { [x: string]: any; }; }; }
>d : { (): void; prototype: { [x: string]: any; }; }
>function() {} : { (): void; prototype: { [x: string]: any; }; }
=== tests/cases/conformance/salsa/b.js ===
a.d.prototype = {};
>a.d.prototype = {} : { [x: string]: any; }
>a.d.prototype : { [x: string]: any; }
>a.d : typeof d
>a : { [x: string]: any; d: typeof d; }
>d : typeof d
>a.d : { (): void; prototype: { [x: string]: any; }; }
>a : { [x: string]: any; d: { (): void; prototype: { [x: string]: any; }; }; }
>d : { (): void; prototype: { [x: string]: any; }; }
>prototype : { [x: string]: any; }
>{} : { [x: string]: any; }

View file

@ -1,22 +0,0 @@
error TS5055: Cannot write file 'tests/cases/conformance/salsa/a.js' because it would overwrite input file.
Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.
tests/cases/conformance/salsa/a.js(1,10): error TS2300: Duplicate identifier 'x'.
tests/cases/conformance/salsa/b.ts(1,5): error TS2300: Duplicate identifier 'x'.
!!! error TS5055: Cannot write file 'tests/cases/conformance/salsa/a.js' because it would overwrite input file.
!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.
==== tests/cases/conformance/salsa/a.js (1 errors) ====
var /*1*/x = function foo() {
~
!!! error TS2300: Duplicate identifier 'x'.
}
x.a = function bar() {
}
==== tests/cases/conformance/salsa/b.ts (1 errors) ====
var x = function () {
~
!!! error TS2300: Duplicate identifier 'x'.
return 1;
}();

View file

@ -1,17 +0,0 @@
//// [tests/cases/conformance/salsa/jsContainerMergeTsDeclaration.ts] ////
//// [a.js]
var /*1*/x = function foo() {
}
x.a = function bar() {
}
//// [b.ts]
var x = function () {
return 1;
}();
//// [b.js]
var x = function () {
return 1;
}();

View file

@ -4,9 +4,9 @@ var /*1*/x = function foo() {
>foo : Symbol(foo, Decl(a.js, 0, 12))
}
x.a = function bar() {
>x.a : Symbol(foo.a, Decl(a.js, 1, 1))
>x.a : Symbol(x.a, Decl(a.js, 1, 1))
>x : Symbol(x, Decl(a.js, 0, 3), Decl(a.js, 1, 1), Decl(b.ts, 0, 3))
>a : Symbol(foo.a, Decl(a.js, 1, 1))
>a : Symbol(x.a, Decl(a.js, 1, 1))
>bar : Symbol(bar, Decl(a.js, 2, 5))
}
=== tests/cases/conformance/salsa/b.ts ===

View file

@ -0,0 +1,13 @@
tests/cases/conformance/salsa/b.js(2,1): error TS2322: Type '2' is not assignable to type '() => void'.
==== tests/cases/conformance/salsa/a.d.ts (0 errors) ====
declare namespace C {
function bar(): void
}
==== tests/cases/conformance/salsa/b.js (1 errors) ====
C.prototype = {};
C.bar = 2;
~~~~~
!!! error TS2322: Type '2' is not assignable to type '() => void'.

View file

@ -0,0 +1,18 @@
=== tests/cases/conformance/salsa/a.d.ts ===
declare namespace C {
>C : Symbol(C, Decl(a.d.ts, 0, 0), Decl(b.js, 0, 0))
function bar(): void
>bar : Symbol(bar, Decl(a.d.ts, 0, 21), Decl(b.js, 0, 17))
}
=== tests/cases/conformance/salsa/b.js ===
C.prototype = {};
>C.prototype : Symbol(C.prototype, Decl(b.js, 0, 0))
>C : Symbol(C, Decl(a.d.ts, 0, 0), Decl(b.js, 0, 0))
>prototype : Symbol(C.prototype, Decl(b.js, 0, 0))
C.bar = 2;
>C.bar : Symbol(C.bar, Decl(a.d.ts, 0, 21), Decl(b.js, 0, 17))
>C : Symbol(C, Decl(a.d.ts, 0, 0), Decl(b.js, 0, 0))
>bar : Symbol(C.bar, Decl(a.d.ts, 0, 21), Decl(b.js, 0, 17))

View file

@ -0,0 +1,22 @@
=== tests/cases/conformance/salsa/a.d.ts ===
declare namespace C {
>C : typeof C
function bar(): void
>bar : () => void
}
=== tests/cases/conformance/salsa/b.js ===
C.prototype = {};
>C.prototype = {} : { [x: string]: any; }
>C.prototype : { [x: string]: any; }
>C : typeof C
>prototype : { [x: string]: any; }
>{} : { [x: string]: any; }
C.bar = 2;
>C.bar = 2 : 2
>C.bar : () => void
>C : typeof C
>bar : () => void
>2 : 2

View file

@ -0,0 +1,13 @@
=== tests/cases/conformance/salsa/a.d.ts ===
declare class A {}
>A : Symbol(A, Decl(a.d.ts, 0, 0), Decl(b.js, 0, 5), Decl(b.js, 0, 14))
=== tests/cases/conformance/salsa/b.js ===
const A = { };
>A : Symbol(A, Decl(a.d.ts, 0, 0), Decl(b.js, 0, 5), Decl(b.js, 0, 14))
A.d = { };
>A.d : Symbol(A.d, Decl(b.js, 0, 14))
>A : Symbol(A, Decl(a.d.ts, 0, 0), Decl(b.js, 0, 5), Decl(b.js, 0, 14))
>d : Symbol(A.d, Decl(b.js, 0, 14))

View file

@ -0,0 +1,16 @@
=== tests/cases/conformance/salsa/a.d.ts ===
declare class A {}
>A : A
=== tests/cases/conformance/salsa/b.js ===
const A = { };
>A : typeof A
>{ } : { [x: string]: any; prototype: A; d: { [x: string]: any; }; }
A.d = { };
>A.d = { } : { [x: string]: any; }
>A.d : { [x: string]: any; }
>A : typeof A
>d : { [x: string]: any; }
>{ } : { [x: string]: any; }

View file

@ -3,9 +3,9 @@ var variable = {};
>variable : Symbol(variable, Decl(a.js, 0, 3))
variable.a = 0;
>variable.a : Symbol(a, Decl(a.js, 0, 18))
>variable.a : Symbol(variable.a, Decl(a.js, 0, 18))
>variable : Symbol(variable, Decl(a.js, 0, 3))
>a : Symbol(a, Decl(a.js, 0, 18))
>a : Symbol(variable.a, Decl(a.js, 0, 18))
class C {
>C : Symbol(C, Decl(a.js, 1, 15))
@ -51,9 +51,9 @@ function getObj() {
=== tests/cases/conformance/salsa/b.ts ===
variable.a = 1;
>variable.a : Symbol(a, Decl(a.js, 0, 18))
>variable.a : Symbol(variable.a, Decl(a.js, 0, 18))
>variable : Symbol(variable, Decl(a.js, 0, 3))
>a : Symbol(a, Decl(a.js, 0, 18))
>a : Symbol(variable.a, Decl(a.js, 0, 18))
(new C()).member.a = 1;
>(new C()).member : Symbol(C.member, Decl(a.js, 5, 19))

View file

@ -1,13 +1,13 @@
=== tests/cases/conformance/salsa/mod.js ===
module.exports.n = {};
>module.exports : Symbol(n, Decl(mod.js, 0, 0))
>module.exports : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
>module : Symbol(module)
>n : Symbol(n, Decl(mod.js, 0, 0))
>n : Symbol(n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
module.exports.n.K = function C() {
>module.exports.n : Symbol(K, Decl(mod.js, 0, 22))
>module.exports.n : Symbol(n.K, Decl(mod.js, 0, 22))
>module : Symbol(module)
>K : Symbol(K, Decl(mod.js, 0, 22))
>K : Symbol(n.K, Decl(mod.js, 0, 22))
>C : Symbol(C, Decl(mod.js, 1, 20))
this.x = 10;
@ -32,11 +32,11 @@ import * as s from './mod'
var k = new s.n.K()
>k : Symbol(k, Decl(use.js, 2, 3))
>s.n.K : Symbol(K, Decl(mod.js, 0, 22))
>s.n : Symbol(s.n, Decl(mod.js, 0, 0))
>s.n.K : Symbol(s.n.K, Decl(mod.js, 0, 22))
>s.n : Symbol(s.n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
>s : Symbol(s, Decl(use.js, 0, 6))
>n : Symbol(s.n, Decl(mod.js, 0, 0))
>K : Symbol(K, Decl(mod.js, 0, 22))
>n : Symbol(s.n, Decl(mod.js, 0, 0), Decl(mod.js, 1, 15))
>K : Symbol(s.n.K, Decl(mod.js, 0, 22))
k.x
>k.x : Symbol(C.x, Decl(mod.js, 1, 35))

View file

@ -1,12 +1,12 @@
=== tests/cases/conformance/salsa/mod.js ===
module.exports.n = {};
>module.exports.n = {} : typeof __object
>module.exports.n = {} : { [x: string]: any; K: typeof C; }
>module.exports.n : any
>module.exports : any
>module : any
>exports : any
>n : any
>{} : typeof __object
>{} : { [x: string]: any; K: typeof C; }
module.exports.n.K = function C() {
>module.exports.n.K = function C() { this.x = 10;} : typeof C
@ -54,9 +54,9 @@ var k = new s.n.K()
>k : C
>new s.n.K() : C
>s.n.K : typeof C
>s.n : typeof __object
>s.n : { [x: string]: any; K: typeof C; }
>s : typeof s
>n : typeof __object
>n : { [x: string]: any; K: typeof C; }
>K : typeof C
k.x

View file

@ -0,0 +1,16 @@
=== tests/cases/conformance/salsa/mod.js ===
// #24111 -- shouldn't assert
C.prototype = {}
>C.prototype : Symbol(C.prototype, Decl(mod.js, 0, 0), Decl(mod.js, 2, 2))
>C : Symbol(C, Decl(mod.js, 0, 0), Decl(mod.js, 1, 16))
>prototype : Symbol(C.prototype, Decl(mod.js, 0, 0), Decl(mod.js, 2, 2))
C.prototype.bar.foo = {};
>C.prototype.bar.foo : Symbol(C.prototype.bar.foo, Decl(mod.js, 1, 16))
>C.prototype.bar : Symbol(C.prototype.bar, Decl(mod.js, 2, 12))
>C.prototype : Symbol(C.prototype, Decl(mod.js, 0, 0), Decl(mod.js, 2, 2))
>C : Symbol(C, Decl(mod.js, 0, 0), Decl(mod.js, 1, 16))
>prototype : Symbol(C.prototype, Decl(mod.js, 0, 0), Decl(mod.js, 2, 2))
>bar : Symbol(C.prototype.bar, Decl(mod.js, 2, 12))
>foo : Symbol(C.prototype.bar.foo, Decl(mod.js, 1, 16))

View file

@ -0,0 +1,20 @@
=== tests/cases/conformance/salsa/mod.js ===
// #24111 -- shouldn't assert
C.prototype = {}
>C.prototype = {} : { [x: string]: any; bar: typeof C.prototype.bar; }
>C.prototype : { [x: string]: any; bar: typeof C.prototype.bar; }
>C : typeof C
>prototype : { [x: string]: any; bar: typeof C.prototype.bar; }
>{} : { [x: string]: any; bar: typeof C.prototype.bar; }
C.prototype.bar.foo = {};
>C.prototype.bar.foo = {} : { [x: string]: any; }
>C.prototype.bar.foo : { [x: string]: any; }
>C.prototype.bar : typeof C.prototype.bar
>C.prototype : { [x: string]: any; bar: typeof C.prototype.bar; }
>C : typeof C
>prototype : { [x: string]: any; bar: typeof C.prototype.bar; }
>bar : typeof C.prototype.bar
>foo : { [x: string]: any; }
>{} : { [x: string]: any; }

View file

@ -9,9 +9,9 @@ var Outer = class O {
>y : Symbol(y, Decl(a.js, 1, 8))
}
Outer.Inner = class I {
>Outer.Inner : Symbol(O.Inner, Decl(a.js, 2, 1))
>Outer.Inner : Symbol(Outer.Inner, Decl(a.js, 2, 1))
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 2, 1))
>Inner : Symbol(O.Inner, Decl(a.js, 2, 1))
>Inner : Symbol(Outer.Inner, Decl(a.js, 2, 1))
>I : Symbol(I, Decl(a.js, 3, 13))
n(a, b) { }

View file

@ -4,19 +4,19 @@ var Outer = Outer || {};
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
Outer.app = Outer.app || {};
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
=== tests/cases/conformance/salsa/someview.js ===
Outer.app.SomeView = (function () {
>Outer.app.SomeView : Symbol(Outer.app.SomeView, Decl(someview.js, 0, 0))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>SomeView : Symbol(Outer.app.SomeView, Decl(someview.js, 0, 0))
var SomeView = function() {
@ -31,9 +31,9 @@ Outer.app.SomeView = (function () {
})();
Outer.app.Inner = class {
>Outer.app.Inner : Symbol(Outer.app.Inner, Decl(someview.js, 5, 5))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Inner : Symbol(Outer.app.Inner, Decl(someview.js, 5, 5))
constructor() {
@ -47,9 +47,9 @@ Outer.app.Inner = class {
var example = new Outer.app.Inner();
>example : Symbol(example, Decl(someview.js, 12, 3))
>Outer.app.Inner : Symbol(Outer.app.Inner, Decl(someview.js, 5, 5))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Inner : Symbol(Outer.app.Inner, Decl(someview.js, 5, 5))
example.y;
@ -60,9 +60,9 @@ example.y;
/** @param {number} k */
Outer.app.statische = function (k) {
>Outer.app.statische : Symbol(Outer.app.statische, Decl(someview.js, 13, 10))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>statische : Symbol(Outer.app.statische, Decl(someview.js, 13, 10))
>k : Symbol(k, Decl(someview.js, 15, 32))
@ -72,11 +72,11 @@ Outer.app.statische = function (k) {
}
=== tests/cases/conformance/salsa/application.js ===
Outer.app.Application = (function () {
>Outer.app.Application : Symbol(app.Application, Decl(application.js, 0, 0))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app.Application : Symbol(Outer.app.Application, Decl(application.js, 0, 0))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Application : Symbol(app.Application, Decl(application.js, 0, 0))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Application : Symbol(Outer.app.Application, Decl(application.js, 0, 0))
/**
* Application main class.
@ -91,9 +91,9 @@ Outer.app.Application = (function () {
me.view = new Outer.app.SomeView();
>me : Symbol(me, Decl(application.js, 7, 11))
>Outer.app.SomeView : Symbol(Outer.app.SomeView, Decl(someview.js, 0, 0))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>SomeView : Symbol(Outer.app.SomeView, Decl(someview.js, 0, 0))
};
@ -104,18 +104,18 @@ Outer.app.Application = (function () {
=== tests/cases/conformance/salsa/main.js ===
var app = new Outer.app.Application();
>app : Symbol(app, Decl(main.js, 0, 3))
>Outer.app.Application : Symbol(app.Application, Decl(application.js, 0, 0))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app.Application : Symbol(Outer.app.Application, Decl(application.js, 0, 0))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Application : Symbol(app.Application, Decl(application.js, 0, 0))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Application : Symbol(Outer.app.Application, Decl(application.js, 0, 0))
var inner = new Outer.app.Inner();
>inner : Symbol(inner, Decl(main.js, 1, 3))
>Outer.app.Inner : Symbol(Outer.app.Inner, Decl(someview.js, 5, 5))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Inner : Symbol(Outer.app.Inner, Decl(someview.js, 5, 5))
inner.y;
@ -134,8 +134,8 @@ x.y;
Outer.app.statische(101); // Infinity, duh
>Outer.app.statische : Symbol(Outer.app.statische, Decl(someview.js, 13, 10))
>Outer.app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer.app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 24), Decl(someview.js, 0, 0), Decl(application.js, 0, 0))
>app : Symbol(app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>app : Symbol(Outer.app, Decl(module.js, 0, 24), Decl(someview.js, 0, 6), Decl(application.js, 0, 6))
>statische : Symbol(Outer.app.statische, Decl(someview.js, 13, 10))

View file

@ -3,9 +3,9 @@ var Inner = function() {}
>Inner : Symbol(Inner, Decl(module.js, 0, 3), Decl(module.js, 0, 25))
Inner.prototype = {
>Inner.prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>Inner.prototype : Symbol(Inner.prototype, Decl(module.js, 0, 25))
>Inner : Symbol(Inner, Decl(module.js, 0, 3), Decl(module.js, 0, 25))
>prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>prototype : Symbol(Inner.prototype, Decl(module.js, 0, 25))
m() { },
>m : Symbol(m, Decl(module.js, 1, 19))
@ -17,14 +17,14 @@ Inner.prototype = {
Inner.prototype.j = 2
>Inner.prototype : Symbol(Inner.j, Decl(module.js, 4, 1))
>Inner : Symbol(Inner, Decl(module.js, 0, 3), Decl(module.js, 0, 25))
>prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>prototype : Symbol(Inner.prototype, Decl(module.js, 0, 25))
>j : Symbol(Inner.j, Decl(module.js, 4, 1))
/** @type {string} */
Inner.prototype.k;
>Inner.prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>Inner.prototype : Symbol(Inner.prototype, Decl(module.js, 0, 25))
>Inner : Symbol(Inner, Decl(module.js, 0, 3), Decl(module.js, 0, 25))
>prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>prototype : Symbol(Inner.prototype, Decl(module.js, 0, 25))
var inner = new Inner()
>inner : Symbol(inner, Decl(module.js, 9, 3))

View file

@ -5,9 +5,9 @@ var Inner = function() {}
Inner.prototype = {
>Inner.prototype = { m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
>Inner.prototype : any
>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
>prototype : any
>prototype : { [x: string]: any; m(): void; i: number; }
>{ m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
m() { },
@ -21,18 +21,18 @@ Inner.prototype = {
Inner.prototype.j = 2
>Inner.prototype.j = 2 : 2
>Inner.prototype.j : any
>Inner.prototype : any
>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
>prototype : any
>prototype : { [x: string]: any; m(): void; i: number; }
>j : any
>2 : 2
/** @type {string} */
Inner.prototype.k;
>Inner.prototype.k : any
>Inner.prototype : any
>Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Inner : typeof Inner
>prototype : any
>prototype : { [x: string]: any; m(): void; i: number; }
>k : any
var inner = new Inner()

View file

@ -28,8 +28,8 @@ var pos = new Outer.Pos(1, 'x');
>Pos : Symbol(Outer.Pos, Decl(usage.js, 0, 0))
pos.line;
>pos.line : Symbol(Pos.line, Decl(usage.js, 1, 35))
>pos.line : Symbol(Outer.Pos.line, Decl(usage.js, 1, 35))
>pos : Symbol(pos, Decl(usage.js, 4, 3))
>line : Symbol(Pos.line, Decl(usage.js, 1, 35))
>line : Symbol(Outer.Pos.line, Decl(usage.js, 1, 35))

View file

@ -1,7 +1,7 @@
=== tests/cases/conformance/salsa/module.js ===
var Outer = function(element, config) {};
>Outer : typeof Outer
>function(element, config) {} : typeof Outer
>Outer : { (element: any, config: any): void; Pos(line: any, ch: any): void; }
>function(element, config) {} : { (element: any, config: any): void; Pos(line: any, ch: any): void; }
>element : any
>config : any
@ -10,7 +10,7 @@ var Outer = function(element, config) {};
Outer.Pos = function (line, ch) {};
>Outer.Pos = function (line, ch) {} : typeof Pos
>Outer.Pos : typeof Pos
>Outer : typeof Outer
>Outer : { (element: any, config: any): void; Pos(line: any, ch: any): void; }
>Pos : typeof Pos
>function (line, ch) {} : typeof Pos
>line : any
@ -21,7 +21,7 @@ Outer.Pos.prototype.line;
>Outer.Pos.prototype.line : any
>Outer.Pos.prototype : any
>Outer.Pos : typeof Pos
>Outer : typeof Outer
>Outer : { (element: any, config: any): void; Pos(line: any, ch: any): void; }
>Pos : typeof Pos
>prototype : any
>line : any
@ -30,7 +30,7 @@ var pos = new Outer.Pos(1, 'x');
>pos : Pos
>new Outer.Pos(1, 'x') : Pos
>Outer.Pos : typeof Pos
>Outer : typeof Outer
>Outer : { (element: any, config: any): void; Pos(line: any, ch: any): void; }
>Pos : typeof Pos
>1 : 1
>'x' : "x"

View file

@ -3,16 +3,16 @@ var Outer = {}
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 14), Decl(module.js, 1, 27))
Outer.Inner = function() {}
>Outer.Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer.Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 14), Decl(module.js, 1, 27))
>Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
Outer.Inner.prototype = {
>Outer.Inner.prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>Outer.Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer.Inner.prototype : Symbol(Outer.Inner.prototype, Decl(module.js, 1, 27))
>Outer.Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 14), Decl(module.js, 1, 27))
>Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>prototype : Symbol(Outer.Inner.prototype, Decl(module.js, 1, 27))
m() { },
>m : Symbol(m, Decl(module.js, 2, 25))
@ -22,26 +22,26 @@ Outer.Inner.prototype = {
}
// incremental assignments still work
Outer.Inner.prototype.j = 2
>Outer.Inner.prototype : Symbol(Inner.j, Decl(module.js, 5, 1))
>Outer.Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer.Inner.prototype : Symbol(Outer.Inner.j, Decl(module.js, 5, 1))
>Outer.Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 14), Decl(module.js, 1, 27))
>Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>j : Symbol(Inner.j, Decl(module.js, 5, 1))
>Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>prototype : Symbol(Outer.Inner.prototype, Decl(module.js, 1, 27))
>j : Symbol(Outer.Inner.j, Decl(module.js, 5, 1))
/** @type {string} */
Outer.Inner.prototype.k;
>Outer.Inner.prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>Outer.Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer.Inner.prototype : Symbol(Outer.Inner.prototype, Decl(module.js, 1, 27))
>Outer.Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 14), Decl(module.js, 1, 27))
>Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>prototype : Symbol(Function.prototype, Decl(lib.es6.d.ts, --, --))
>Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>prototype : Symbol(Outer.Inner.prototype, Decl(module.js, 1, 27))
var inner = new Outer.Inner()
>inner : Symbol(inner, Decl(module.js, 10, 3))
>Outer.Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer.Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Outer : Symbol(Outer, Decl(module.js, 0, 3), Decl(module.js, 0, 14), Decl(module.js, 1, 27))
>Inner : Symbol(Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
>Inner : Symbol(Outer.Inner, Decl(module.js, 0, 14), Decl(module.js, 2, 6))
inner.m()
>inner.m : Symbol(m, Decl(module.js, 2, 25))
@ -54,12 +54,12 @@ inner.i
>i : Symbol(i, Decl(module.js, 3, 12))
inner.j
>inner.j : Symbol(Inner.j, Decl(module.js, 5, 1))
>inner.j : Symbol(Outer.Inner.j, Decl(module.js, 5, 1))
>inner : Symbol(inner, Decl(module.js, 10, 3))
>j : Symbol(Inner.j, Decl(module.js, 5, 1))
>j : Symbol(Outer.Inner.j, Decl(module.js, 5, 1))
inner.k
>inner.k : Symbol(Inner.k, Decl(module.js, 7, 27))
>inner.k : Symbol(Outer.Inner.k, Decl(module.js, 7, 27))
>inner : Symbol(inner, Decl(module.js, 10, 3))
>k : Symbol(Inner.k, Decl(module.js, 7, 27))
>k : Symbol(Outer.Inner.k, Decl(module.js, 7, 27))

View file

@ -1,22 +1,22 @@
=== tests/cases/conformance/salsa/module.js ===
var Outer = {}
>Outer : { [x: string]: any; Inner(): void; }
>{} : { [x: string]: any; Inner(): void; }
>Outer : { [x: string]: any; Inner: typeof Inner; }
>{} : { [x: string]: any; Inner: typeof Inner; }
Outer.Inner = function() {}
>Outer.Inner = function() {} : typeof Inner
>Outer.Inner : typeof Inner
>Outer : { [x: string]: any; Inner(): void; }
>Outer : { [x: string]: any; Inner: typeof Inner; }
>Inner : typeof Inner
>function() {} : typeof Inner
Outer.Inner.prototype = {
>Outer.Inner.prototype = { m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
>Outer.Inner.prototype : any
>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : { [x: string]: any; Inner(): void; }
>Outer : { [x: string]: any; Inner: typeof Inner; }
>Inner : typeof Inner
>prototype : any
>prototype : { [x: string]: any; m(): void; i: number; }
>{ m() { }, i: 1} : { [x: string]: any; m(): void; i: number; }
m() { },
@ -30,29 +30,29 @@ Outer.Inner.prototype = {
Outer.Inner.prototype.j = 2
>Outer.Inner.prototype.j = 2 : 2
>Outer.Inner.prototype.j : any
>Outer.Inner.prototype : any
>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : { [x: string]: any; Inner(): void; }
>Outer : { [x: string]: any; Inner: typeof Inner; }
>Inner : typeof Inner
>prototype : any
>prototype : { [x: string]: any; m(): void; i: number; }
>j : any
>2 : 2
/** @type {string} */
Outer.Inner.prototype.k;
>Outer.Inner.prototype.k : any
>Outer.Inner.prototype : any
>Outer.Inner.prototype : { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : { [x: string]: any; Inner(): void; }
>Outer : { [x: string]: any; Inner: typeof Inner; }
>Inner : typeof Inner
>prototype : any
>prototype : { [x: string]: any; m(): void; i: number; }
>k : any
var inner = new Outer.Inner()
>inner : Inner & { [x: string]: any; m(): void; i: number; }
>new Outer.Inner() : Inner & { [x: string]: any; m(): void; i: number; }
>Outer.Inner : typeof Inner
>Outer : { [x: string]: any; Inner(): void; }
>Outer : { [x: string]: any; Inner: typeof Inner; }
>Inner : typeof Inner
inner.m()

View file

@ -9,11 +9,11 @@ Outer.Inner = function () {}
>Inner : Symbol(Outer.Inner, Decl(work.js, 0, 0), Decl(work.js, 1, 6))
Outer.Inner.prototype = {
>Outer.Inner.prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>Outer.Inner.prototype : Symbol(Outer.Inner.prototype, Decl(work.js, 0, 28))
>Outer.Inner : Symbol(Outer.Inner, Decl(work.js, 0, 0), Decl(work.js, 1, 6))
>Outer : Symbol(Outer, Decl(def.js, 0, 3), Decl(work.js, 0, 0), Decl(work.js, 0, 28))
>Inner : Symbol(Outer.Inner, Decl(work.js, 0, 0), Decl(work.js, 1, 6))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>prototype : Symbol(Outer.Inner.prototype, Decl(work.js, 0, 28))
x: 1,
>x : Symbol(x, Decl(work.js, 1, 25))

View file

@ -1,23 +1,23 @@
=== tests/cases/conformance/salsa/def.js ===
var Outer = {};
>Outer : { [x: string]: any; Inner(): void; }
>{} : { [x: string]: any; Inner(): void; }
>Outer : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
>{} : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
=== tests/cases/conformance/salsa/work.js ===
Outer.Inner = function () {}
>Outer.Inner = function () {} : () => void
>Outer.Inner : () => void
>Outer : { [x: string]: any; Inner(): void; }
>Inner : () => void
>function () {} : () => void
>Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
Outer.Inner.prototype = {
>Outer.Inner.prototype = { x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
>Outer.Inner.prototype : any
>Outer.Inner : () => void
>Outer : { [x: string]: any; Inner(): void; }
>Inner : () => void
>prototype : any
>Outer.Inner.prototype : { [x: string]: any; x: number; m(): void; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>prototype : { [x: string]: any; x: number; m(): void; }
>{ x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
x: 1,
@ -47,9 +47,9 @@ inner.m()
var inno = new Outer.Inner()
>inno : { [x: string]: any; x: number; m(): void; }
>new Outer.Inner() : { [x: string]: any; x: number; m(): void; }
>Outer.Inner : () => void
>Outer : { [x: string]: any; Inner(): void; }
>Inner : () => void
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
inno.x
>inno.x : number

View file

@ -3,9 +3,9 @@ var Outer = {};
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 0, 15))
Outer.Inner = class {
>Outer.Inner : Symbol(Inner, Decl(a.js, 0, 15))
>Outer.Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15))
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 0, 15))
>Inner : Symbol(Inner, Decl(a.js, 0, 15))
>Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15))
constructor() {
this.x = 1
@ -33,9 +33,9 @@ inner.m()
var inno = new Outer.Inner()
>inno : Symbol(inno, Decl(a.js, 13, 3))
>Outer.Inner : Symbol(Inner, Decl(a.js, 0, 15))
>Outer.Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15))
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 0, 15))
>Inner : Symbol(Inner, Decl(a.js, 0, 15))
>Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15))
inno.x
>inno.x : Symbol(Inner.x, Decl(a.js, 3, 19))

View file

@ -3,16 +3,16 @@ var Outer = {};
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 0, 15), Decl(a.js, 2, 28))
Outer.Inner = function () {}
>Outer.Inner : Symbol(Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>Outer.Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 0, 15), Decl(a.js, 2, 28))
>Inner : Symbol(Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
Outer.Inner.prototype = {
>Outer.Inner.prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>Outer.Inner : Symbol(Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>Outer.Inner.prototype : Symbol(Outer.Inner.prototype, Decl(a.js, 2, 28))
>Outer.Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 0, 15), Decl(a.js, 2, 28))
>Inner : Symbol(Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>prototype : Symbol(Outer.Inner.prototype, Decl(a.js, 2, 28))
x: 1,
>x : Symbol(x, Decl(a.js, 3, 25))
@ -37,9 +37,9 @@ inner.m()
var inno = new Outer.Inner()
>inno : Symbol(inno, Decl(a.js, 12, 3))
>Outer.Inner : Symbol(Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>Outer.Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 0, 15), Decl(a.js, 2, 28))
>Inner : Symbol(Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
>Inner : Symbol(Outer.Inner, Decl(a.js, 0, 15), Decl(a.js, 3, 6))
inno.x
>inno.x : Symbol(x, Decl(a.js, 3, 25))

View file

@ -1,22 +1,22 @@
=== tests/cases/conformance/salsa/a.js ===
var Outer = {};
>Outer : { [x: string]: any; Inner(): void; }
>{} : { [x: string]: any; Inner(): void; }
>Outer : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
>{} : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
Outer.Inner = function () {}
>Outer.Inner = function () {} : () => void
>Outer.Inner : () => void
>Outer : { [x: string]: any; Inner(): void; }
>Inner : () => void
>function () {} : () => void
>Outer.Inner = function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>function () {} : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
Outer.Inner.prototype = {
>Outer.Inner.prototype = { x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
>Outer.Inner.prototype : any
>Outer.Inner : () => void
>Outer : { [x: string]: any; Inner(): void; }
>Inner : () => void
>prototype : any
>Outer.Inner.prototype : { [x: string]: any; x: number; m(): void; }
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>prototype : { [x: string]: any; x: number; m(): void; }
>{ x: 1, m() { }} : { [x: string]: any; x: number; m(): void; }
x: 1,
@ -45,9 +45,9 @@ inner.m()
var inno = new Outer.Inner()
>inno : { [x: string]: any; x: number; m(): void; }
>new Outer.Inner() : { [x: string]: any; x: number; m(): void; }
>Outer.Inner : () => void
>Outer : { [x: string]: any; Inner(): void; }
>Inner : () => void
>Outer.Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
>Outer : { [x: string]: any; Inner: { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }; }
>Inner : { (): void; prototype: { [x: string]: any; x: number; m(): void; }; }
inno.x
>inno.x : number

View file

@ -12,16 +12,16 @@ GLOBSTAR.p = 1
>GLOBSTAR : Symbol(GLOBSTAR, Decl(a.js, 0, 3))
m.GLOBSTAR.q = 2
>m.GLOBSTAR.q : Symbol(q, Decl(a.js, 3, 14))
>m.GLOBSTAR.q : Symbol(m.GLOBSTAR.q, Decl(a.js, 3, 14))
>m.GLOBSTAR : Symbol(m.GLOBSTAR, Decl(a.js, 0, 14))
>m : Symbol(m, Decl(a.js, 0, 30))
>GLOBSTAR : Symbol(m.GLOBSTAR, Decl(a.js, 0, 14))
>q : Symbol(q, Decl(a.js, 3, 14))
>q : Symbol(m.GLOBSTAR.q, Decl(a.js, 3, 14))
GLOBSTAR.q
>GLOBSTAR.q : Symbol(q, Decl(a.js, 3, 14))
>GLOBSTAR.q : Symbol(m.GLOBSTAR.q, Decl(a.js, 3, 14))
>GLOBSTAR : Symbol(GLOBSTAR, Decl(a.js, 0, 3))
>q : Symbol(q, Decl(a.js, 3, 14))
>q : Symbol(m.GLOBSTAR.q, Decl(a.js, 3, 14))
m.GLOBSTAR.p
>m.GLOBSTAR : Symbol(m.GLOBSTAR, Decl(a.js, 0, 14))

View file

@ -7,9 +7,9 @@ var Outer = function O() {
>y : Symbol(O.y, Decl(a.js, 0, 26))
}
Outer.Inner = class I {
>Outer.Inner : Symbol(O.Inner, Decl(a.js, 2, 1))
>Outer.Inner : Symbol(Outer.Inner, Decl(a.js, 2, 1))
>Outer : Symbol(Outer, Decl(a.js, 0, 3), Decl(a.js, 2, 1))
>Inner : Symbol(O.Inner, Decl(a.js, 2, 1))
>Inner : Symbol(Outer.Inner, Decl(a.js, 2, 1))
>I : Symbol(I, Decl(a.js, 3, 13))
constructor() {

View file

@ -3,16 +3,16 @@ var obj = {};
>obj : Symbol(obj, Decl(a.js, 0, 3), Decl(a.js, 0, 13))
obj.method = function (hunch) {
>obj.method : Symbol(method, Decl(a.js, 0, 13))
>obj.method : Symbol(obj.method, Decl(a.js, 0, 13))
>obj : Symbol(obj, Decl(a.js, 0, 3), Decl(a.js, 0, 13))
>method : Symbol(method, Decl(a.js, 0, 13))
>method : Symbol(obj.method, Decl(a.js, 0, 13))
>hunch : Symbol(hunch, Decl(a.js, 1, 23))
return true;
}
var b = obj.method();
>b : Symbol(b, Decl(a.js, 4, 3))
>obj.method : Symbol(method, Decl(a.js, 0, 13))
>obj.method : Symbol(obj.method, Decl(a.js, 0, 13))
>obj : Symbol(obj, Decl(a.js, 0, 3), Decl(a.js, 0, 13))
>method : Symbol(method, Decl(a.js, 0, 13))
>method : Symbol(obj.method, Decl(a.js, 0, 13))

View file

@ -4,19 +4,19 @@ var my = my || {};
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 1, 22))
my.app = my.app || {};
>my.app : Symbol(app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my.app : Symbol(my.app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 1, 22))
>app : Symbol(app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my.app : Symbol(app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>app : Symbol(my.app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my.app : Symbol(my.app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 1, 22))
>app : Symbol(app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>app : Symbol(my.app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
my.app.Application = (function () {
>my.app.Application : Symbol(Application, Decl(a.js, 1, 22))
>my.app : Symbol(app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my.app.Application : Symbol(my.app.Application, Decl(a.js, 1, 22))
>my.app : Symbol(my.app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 1, 22))
>app : Symbol(app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>Application : Symbol(Application, Decl(a.js, 1, 22))
>app : Symbol(my.app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>Application : Symbol(my.app.Application, Decl(a.js, 1, 22))
var Application = function () {
>Application : Symbol(Application, Decl(a.js, 4, 3))
@ -28,11 +28,11 @@ return Application;
})();
my.app.Application()
>my.app.Application : Symbol(Application, Decl(a.js, 1, 22))
>my.app : Symbol(app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my.app.Application : Symbol(my.app.Application, Decl(a.js, 1, 22))
>my.app : Symbol(my.app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 1, 22))
>app : Symbol(app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>Application : Symbol(Application, Decl(a.js, 1, 22))
>app : Symbol(my.app, Decl(a.js, 0, 18), Decl(a.js, 3, 3))
>Application : Symbol(my.app.Application, Decl(a.js, 1, 22))
=== tests/cases/conformance/salsa/b.js ===
var min = window.min || {};
@ -40,19 +40,19 @@ var min = window.min || {};
>window : Symbol(window, Decl(lib.dom.d.ts, --, --))
min.app = min.app || {};
>min.app : Symbol(app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min.app : Symbol(min.app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min : Symbol(min, Decl(b.js, 0, 3), Decl(b.js, 0, 27), Decl(b.js, 1, 24))
>app : Symbol(app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min.app : Symbol(app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>app : Symbol(min.app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min.app : Symbol(min.app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min : Symbol(min, Decl(b.js, 0, 3), Decl(b.js, 0, 27), Decl(b.js, 1, 24))
>app : Symbol(app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>app : Symbol(min.app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
min.app.Application = (function () {
>min.app.Application : Symbol(Application, Decl(b.js, 1, 24))
>min.app : Symbol(app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min.app.Application : Symbol(min.app.Application, Decl(b.js, 1, 24))
>min.app : Symbol(min.app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min : Symbol(min, Decl(b.js, 0, 3), Decl(b.js, 0, 27), Decl(b.js, 1, 24))
>app : Symbol(app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>Application : Symbol(Application, Decl(b.js, 1, 24))
>app : Symbol(min.app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>Application : Symbol(min.app.Application, Decl(b.js, 1, 24))
var Application = function () {
>Application : Symbol(Application, Decl(b.js, 4, 3))
@ -64,9 +64,9 @@ return Application;
})();
min.app.Application()
>min.app.Application : Symbol(Application, Decl(b.js, 1, 24))
>min.app : Symbol(app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min.app.Application : Symbol(min.app.Application, Decl(b.js, 1, 24))
>min.app : Symbol(min.app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>min : Symbol(min, Decl(b.js, 0, 3), Decl(b.js, 0, 27), Decl(b.js, 1, 24))
>app : Symbol(app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>Application : Symbol(Application, Decl(b.js, 1, 24))
>app : Symbol(min.app, Decl(b.js, 0, 27), Decl(b.js, 3, 4))
>Application : Symbol(min.app.Application, Decl(b.js, 1, 24))

View file

@ -1,42 +1,42 @@
=== tests/cases/conformance/salsa/a.js ===
var my = my || {};
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
/** @param {number} n */
my.method = function(n) {
>my.method : Symbol(method, Decl(a.js, 0, 18))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>method : Symbol(method, Decl(a.js, 0, 18))
>my.method : Symbol(my.method, Decl(a.js, 0, 18))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>method : Symbol(my.method, Decl(a.js, 0, 18))
>n : Symbol(n, Decl(a.js, 2, 21))
return n + 1;
>n : Symbol(n, Decl(a.js, 2, 21))
}
my.number = 1;
>my.number : Symbol(number, Decl(a.js, 4, 1))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>number : Symbol(number, Decl(a.js, 4, 1))
>my.number : Symbol(my.number, Decl(a.js, 4, 1))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>number : Symbol(my.number, Decl(a.js, 4, 1))
my.object = {};
>my.object : Symbol(object, Decl(a.js, 5, 14))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>object : Symbol(object, Decl(a.js, 5, 14))
>my.object : Symbol(my.object, Decl(a.js, 5, 14))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>object : Symbol(my.object, Decl(a.js, 5, 14))
my.predicate = my.predicate || {};
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
my.predicate.query = function () {
>my.predicate.query : Symbol(query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>query : Symbol(query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate.query : Symbol(my.predicate.query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>query : Symbol(my.predicate.query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
var me = this;
>me : Symbol(me, Decl(a.js, 9, 7))
@ -48,46 +48,46 @@ my.predicate.query = function () {
};
var q = new my.predicate.query();
>q : Symbol(q, Decl(a.js, 12, 3))
>my.predicate.query : Symbol(query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>query : Symbol(query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate.query : Symbol(my.predicate.query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>query : Symbol(my.predicate.query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
my.predicate.query.another = function () {
>my.predicate.query.another : Symbol(query.another, Decl(a.js, 12, 33))
>my.predicate.query : Symbol(query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>query : Symbol(query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>another : Symbol(query.another, Decl(a.js, 12, 33))
>my.predicate.query.another : Symbol(my.predicate.query.another, Decl(a.js, 12, 33))
>my.predicate.query : Symbol(my.predicate.query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>query : Symbol(my.predicate.query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>another : Symbol(my.predicate.query.another, Decl(a.js, 12, 33))
return 1;
}
my.predicate.query.result = 'none'
>my.predicate.query.result : Symbol(query.result, Decl(a.js, 15, 1))
>my.predicate.query : Symbol(query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>query : Symbol(query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>result : Symbol(query.result, Decl(a.js, 15, 1))
>my.predicate.query.result : Symbol(my.predicate.query.result, Decl(a.js, 15, 1))
>my.predicate.query : Symbol(my.predicate.query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>query : Symbol(my.predicate.query, Decl(a.js, 7, 34), Decl(a.js, 13, 13))
>result : Symbol(my.predicate.query.result, Decl(a.js, 15, 1))
/** @param {number} first
* @param {number} second
*/
my.predicate.sort = my.predicate.sort || function (first, second) {
>my.predicate.sort : Symbol(sort, Decl(a.js, 16, 34))
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>sort : Symbol(sort, Decl(a.js, 16, 34))
>my.predicate.sort : Symbol(sort, Decl(a.js, 16, 34))
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>sort : Symbol(sort, Decl(a.js, 16, 34))
>my.predicate.sort : Symbol(my.predicate.sort, Decl(a.js, 16, 34))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>sort : Symbol(my.predicate.sort, Decl(a.js, 16, 34))
>my.predicate.sort : Symbol(my.predicate.sort, Decl(a.js, 16, 34))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>sort : Symbol(my.predicate.sort, Decl(a.js, 16, 34))
>first : Symbol(first, Decl(a.js, 20, 51))
>second : Symbol(second, Decl(a.js, 20, 57))
@ -98,11 +98,11 @@ my.predicate.sort = my.predicate.sort || function (first, second) {
>second : Symbol(second, Decl(a.js, 20, 57))
}
my.predicate.type = class {
>my.predicate.type : Symbol(type, Decl(a.js, 22, 1))
>my.predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 5, 14), Decl(a.js, 6, 15), Decl(a.js, 7, 34) ... and 3 more)
>predicate : Symbol(predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3), Decl(a.js, 20, 3), Decl(a.js, 23, 3))
>type : Symbol(type, Decl(a.js, 22, 1))
>my.predicate.type : Symbol(my.predicate.type, Decl(a.js, 22, 1))
>my.predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>my : Symbol(my, Decl(a.js, 0, 3), Decl(a.js, 0, 18), Decl(a.js, 7, 34), Decl(a.js, 12, 33))
>predicate : Symbol(my.predicate, Decl(a.js, 6, 15), Decl(a.js, 8, 3), Decl(a.js, 13, 3))
>type : Symbol(my.predicate.type, Decl(a.js, 22, 1))
m() { return 101; }
>m : Symbol(type.m, Decl(a.js, 23, 27))
@ -111,24 +111,24 @@ my.predicate.type = class {
// global-ish prefixes
var min = window.min || {};
>min : Symbol(min, Decl(a.js, 29, 3), Decl(a.js, 29, 27), Decl(a.js, 30, 44), Decl(a.js, 31, 50))
>min : Symbol(min, Decl(a.js, 29, 3), Decl(a.js, 29, 27), Decl(a.js, 30, 44))
>window : Symbol(window, Decl(lib.es6.d.ts, --, --))
min.nest = this.min.nest || function () { };
>min.nest : Symbol(nest, Decl(a.js, 29, 27), Decl(a.js, 31, 4))
>min : Symbol(min, Decl(a.js, 29, 3), Decl(a.js, 29, 27), Decl(a.js, 30, 44), Decl(a.js, 31, 50))
>nest : Symbol(nest, Decl(a.js, 29, 27), Decl(a.js, 31, 4))
>min.nest : Symbol(min.nest, Decl(a.js, 29, 27), Decl(a.js, 31, 4))
>min : Symbol(min, Decl(a.js, 29, 3), Decl(a.js, 29, 27), Decl(a.js, 30, 44))
>nest : Symbol(min.nest, Decl(a.js, 29, 27), Decl(a.js, 31, 4))
min.nest.other = self.min.nest.other || class { };
>min.nest.other : Symbol(nest.other, Decl(a.js, 30, 44))
>min.nest : Symbol(nest, Decl(a.js, 29, 27), Decl(a.js, 31, 4))
>min : Symbol(min, Decl(a.js, 29, 3), Decl(a.js, 29, 27), Decl(a.js, 30, 44), Decl(a.js, 31, 50))
>nest : Symbol(nest, Decl(a.js, 29, 27), Decl(a.js, 31, 4))
>other : Symbol(nest.other, Decl(a.js, 30, 44))
>min.nest.other : Symbol(min.nest.other, Decl(a.js, 30, 44))
>min.nest : Symbol(min.nest, Decl(a.js, 29, 27), Decl(a.js, 31, 4))
>min : Symbol(min, Decl(a.js, 29, 3), Decl(a.js, 29, 27), Decl(a.js, 30, 44))
>nest : Symbol(min.nest, Decl(a.js, 29, 27), Decl(a.js, 31, 4))
>other : Symbol(min.nest.other, Decl(a.js, 30, 44))
>self : Symbol(self, Decl(lib.es6.d.ts, --, --))
min.property = global.min.property || {};
>min.property : Symbol(property, Decl(a.js, 31, 50))
>min : Symbol(min, Decl(a.js, 29, 3), Decl(a.js, 29, 27), Decl(a.js, 30, 44), Decl(a.js, 31, 50))
>property : Symbol(property, Decl(a.js, 31, 50))
>min.property : Symbol(min.property, Decl(a.js, 31, 50))
>min : Symbol(min, Decl(a.js, 29, 3), Decl(a.js, 29, 27), Decl(a.js, 30, 44))
>property : Symbol(min.property, Decl(a.js, 31, 50))

View file

@ -1,24 +1,24 @@
=== tests/cases/conformance/salsa/index.js ===
Common.Item = class I {}
>Common.Item : Symbol(Common.Item, Decl(index.js, 0, 0))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3), Decl(roots.js, 0, 12))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
>Item : Symbol(Common.Item, Decl(index.js, 0, 0))
>I : Symbol(I, Decl(index.js, 0, 13))
Common.Object = class extends Common.Item {}
>Common.Object : Symbol(Common.Object, Decl(index.js, 0, 24))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3), Decl(roots.js, 0, 12))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
>Object : Symbol(Common.Object, Decl(index.js, 0, 24))
>Common.Item : Symbol(Common.Item, Decl(index.js, 0, 0))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3), Decl(roots.js, 0, 12))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
>Item : Symbol(Common.Item, Decl(index.js, 0, 0))
Workspace.Object = class extends Common.Object {}
>Workspace.Object : Symbol(Workspace.Object, Decl(index.js, 1, 44))
>Workspace : Symbol(Workspace, Decl(index.js, 1, 44), Decl(roots.js, 1, 3), Decl(roots.js, 1, 15))
>Workspace : Symbol(Workspace, Decl(index.js, 1, 44), Decl(roots.js, 1, 3))
>Object : Symbol(Workspace.Object, Decl(index.js, 1, 44))
>Common.Object : Symbol(Common.Object, Decl(index.js, 0, 24))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3), Decl(roots.js, 0, 12))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
>Object : Symbol(Common.Object, Decl(index.js, 0, 24))
/** @type {Workspace.Object} */
@ -27,8 +27,8 @@ var am;
=== tests/cases/conformance/salsa/roots.js ===
var Common = {};
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3), Decl(roots.js, 0, 12))
>Common : Symbol(Common, Decl(index.js, 0, 0), Decl(roots.js, 0, 3))
var Workspace = {};
>Workspace : Symbol(Workspace, Decl(index.js, 1, 44), Decl(roots.js, 1, 3), Decl(roots.js, 1, 15))
>Workspace : Symbol(Workspace, Decl(index.js, 1, 44), Decl(roots.js, 1, 3))

View file

@ -2,16 +2,16 @@
// this is a javascript file...
export const Adapter = {};
>Adapter : Symbol(Adapter, Decl(a.js, 2, 12), Decl(a.js, 2, 26), Decl(a.js, 4, 18))
>Adapter : Symbol(Adapter, Decl(a.js, 2, 12), Decl(a.js, 2, 26))
Adapter.prop = {};
>Adapter.prop : Symbol(prop, Decl(a.js, 2, 26))
>Adapter : Symbol(Adapter, Decl(a.js, 2, 12), Decl(a.js, 2, 26), Decl(a.js, 4, 18))
>prop : Symbol(prop, Decl(a.js, 2, 26))
>Adapter.prop : Symbol(Adapter.prop, Decl(a.js, 2, 26))
>Adapter : Symbol(Adapter, Decl(a.js, 2, 12), Decl(a.js, 2, 26))
>prop : Symbol(Adapter.prop, Decl(a.js, 2, 26))
// comment this out, and it works
Adapter.asyncMethod = function() {}
>Adapter.asyncMethod : Symbol(asyncMethod, Decl(a.js, 4, 18))
>Adapter : Symbol(Adapter, Decl(a.js, 2, 12), Decl(a.js, 2, 26), Decl(a.js, 4, 18))
>asyncMethod : Symbol(asyncMethod, Decl(a.js, 4, 18))
>Adapter.asyncMethod : Symbol(Adapter.asyncMethod, Decl(a.js, 4, 18))
>Adapter : Symbol(Adapter, Decl(a.js, 2, 12), Decl(a.js, 2, 26))
>asyncMethod : Symbol(Adapter.asyncMethod, Decl(a.js, 4, 18))

View file

@ -0,0 +1,11 @@
tests/cases/conformance/salsa/a.js(3,15): error TS2694: Namespace 'ns' has no exported member 'NotFound'.
==== tests/cases/conformance/salsa/a.js (1 errors) ====
// #22973
var ns = (function() {})();
/** @type {ns.NotFound} */
~~~~~~~~
!!! error TS2694: Namespace 'ns' has no exported member 'NotFound'.
var crash;

View file

@ -4,9 +4,9 @@ const ns = {};
>ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14))
ns.Foo = class {}
>ns.Foo : Symbol(Foo, Decl(mod2.js, 1, 14))
>ns.Foo : Symbol(ns.Foo, Decl(mod2.js, 1, 14))
>ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14))
>Foo : Symbol(Foo, Decl(mod2.js, 1, 14))
>Foo : Symbol(ns.Foo, Decl(mod2.js, 1, 14))
module.exports = ns;
>module : Symbol(export=, Decl(mod2.js, 2, 17))

View file

@ -40,4 +40,4 @@ var n = a.F2.staticProp;
var n = C3.staticProp;
var n = C4.staticProp;
var n = F3.staticProp;
var n = F4.staticProp;
var n = F4.staticProp;

View file

@ -1,5 +1,6 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: a.js
var /*1*/x = function foo() {
}

View file

@ -0,0 +1,10 @@
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: a.d.ts
declare namespace C {
function bar(): void
}
// @Filename: b.js
C.prototype = {};
C.bar = 2;

View file

@ -0,0 +1,8 @@
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: a.d.ts
declare class A {}
// @Filename: b.js
const A = { };
A.d = { };

View file

@ -0,0 +1,9 @@
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @Filename: mod.js
// #24111 -- shouldn't assert
C.prototype = {}
C.prototype.bar.foo = {};