Merge remote-tracking branch 'Microsoft/master'

This commit is contained in:
SaschaNaz committed 2015-09-20 15:06:36 +09:00
commit 602e845809
560 files changed
+6853 -4682

No files matched your search

+12 -3
View File
@@ -394,6 +394,7 @@ var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts");
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
/*prefixes*/ [copyright],
@@ -410,11 +411,19 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
prependFile(copyright, standaloneDefinitionsFile);
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
// Stanalone/web definition file using global 'ts' namespace
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
definitionFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
// Official node package definition file, pointed to by 'typings' in package.json
// Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module
var nodeDefinitionsFileContents = definitionFileContents + "\r\nexport = ts;";
fs.writeFileSync(nodeDefinitionsFile, nodeDefinitionsFileContents);
// Node package definition file to be distributed without the package. Created by replacing
// 'ts' namespace with '"typescript"' as a module.
var nodeStandaloneDefinitionsFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
});
+30 -2
View File
@@ -3928,6 +3928,7 @@ declare module Intl {
timeZoneName?: string;
formatMatcher?: string;
hour12?: boolean;
timeZone?: string;
}
interface ResolvedDateTimeFormatOptions {
@@ -3997,18 +3998,45 @@ interface Number {
interface Date {
/**
* Converts a date to a string by using the current or specified locale.
* Converts a date and time to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date and time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
}
+30 -2
View File
@@ -104,6 +104,7 @@ declare module Intl {
timeZoneName?: string;
formatMatcher?: string;
hour12?: boolean;
timeZone?: string;
}
interface ResolvedDateTimeFormatOptions {
@@ -173,18 +174,45 @@ interface Number {
interface Date {
/**
* Converts a date to a string by using the current or specified locale.
* Converts a date and time to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date and time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
}
+30 -2
View File
@@ -5216,6 +5216,7 @@ declare module Intl {
timeZoneName?: string;
formatMatcher?: string;
hour12?: boolean;
timeZone?: string;
}
interface ResolvedDateTimeFormatOptions {
@@ -5285,18 +5286,45 @@ interface Number {
interface Date {
/**
* Converts a date to a string by using the current or specified locale.
* Converts a date and time to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date and time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
}
+30 -2
View File
@@ -104,6 +104,7 @@ declare module Intl {
timeZoneName?: string;
formatMatcher?: string;
hour12?: boolean;
timeZone?: string;
}
interface ResolvedDateTimeFormatOptions {
@@ -173,18 +174,45 @@ interface Number {
interface Date {
/**
* Converts a date to a string by using the current or specified locale.
* Converts a date and time to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date and time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a time to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
}
+384 -250
View File
File diff suppressed because it is too large. Load diff
+471 -523
View File
File diff suppressed because it is too large. Load diff
+22 -17
View File
@@ -13,7 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
declare module "typescript" {
declare namespace ts {
interface Map<T> {
[index: string]: T;
}
@@ -1208,9 +1208,11 @@ declare module "typescript" {
UnionOrIntersection = 49152,
StructuredType = 130048,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
flags: TypeFlags;
symbol?: Symbol;
pattern?: DestructuringPattern;
}
interface StringLiteralType extends Type {
text: string;
@@ -1237,7 +1239,6 @@ declare module "typescript" {
}
interface TupleType extends ObjectType {
elementTypes: Type[];
baseArrayType: TypeReference;
}
interface UnionOrIntersectionType extends Type {
types: Type[];
@@ -1382,9 +1383,12 @@ declare module "typescript" {
}
interface ResolvedModule {
resolvedFileName: string;
isExternalLibraryImport?: boolean;
}
interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModule;
failedLookupLocations: string[];
}
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
interface CompilerHost extends ModuleResolutionHost {
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
getCancellationToken?(): CancellationToken;
@@ -1394,7 +1398,7 @@ declare module "typescript" {
getCanonicalFileName(fileName: string): string;
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
}
interface TextSpan {
start: number;
@@ -1405,7 +1409,7 @@ declare module "typescript" {
newLength: number;
}
}
declare module "typescript" {
declare namespace ts {
interface System {
args: string[];
newLine: string;
@@ -1429,7 +1433,7 @@ declare module "typescript" {
}
var sys: System;
}
declare module "typescript" {
declare namespace ts {
interface ErrorCallback {
(message: DiagnosticMessage, length: number): void;
}
@@ -1474,7 +1478,7 @@ declare module "typescript" {
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
}
declare module "typescript" {
declare namespace ts {
function getDefaultLibFileName(options: CompilerOptions): string;
function textSpanEnd(span: TextSpan): number;
function textSpanIsEmpty(span: TextSpan): boolean;
@@ -1504,33 +1508,32 @@ declare module "typescript" {
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
}
declare module "typescript" {
declare namespace ts {
function getNodeConstructor(kind: SyntaxKind): new () => Node;
function createNode(kind: SyntaxKind): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
}
declare module "typescript" {
declare namespace ts {
const version: string;
function findConfigFile(searchPath: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule;
function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program;
}
declare module "typescript" {
declare namespace ts {
function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine;
/**
* Read tsconfig.json file
* @param fileName The path to the config file
*/
function readConfigFile(fileName: string): {
function readConfigFile(fileName: string, readFile: (path: string) => string): {
config?: any;
error?: Diagnostic;
};
@@ -1551,7 +1554,7 @@ declare module "typescript" {
*/
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
}
declare module "typescript" {
declare namespace ts {
/** The version of the language service API */
let servicesVersion: string;
interface Node {
@@ -1649,7 +1652,7 @@ declare module "typescript" {
trace?(s: string): void;
error?(s: string): void;
useCaseSensitiveFileNames?(): boolean;
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
}
interface LanguageService {
cleanupSemanticCache(): void;
@@ -2139,3 +2142,5 @@ declare module "typescript" {
*/
function getDefaultLibFilePath(options: CompilerOptions): string;
}
export = ts;
+536 -314
View File
File diff suppressed because it is too large. Load diff
+12 -9
View File
@@ -1208,9 +1208,11 @@ declare namespace ts {
UnionOrIntersection = 49152,
StructuredType = 130048,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
flags: TypeFlags;
symbol?: Symbol;
pattern?: DestructuringPattern;
}
interface StringLiteralType extends Type {
text: string;
@@ -1237,7 +1239,6 @@ declare namespace ts {
}
interface TupleType extends ObjectType {
elementTypes: Type[];
baseArrayType: TypeReference;
}
interface UnionOrIntersectionType extends Type {
types: Type[];
@@ -1382,9 +1383,12 @@ declare namespace ts {
}
interface ResolvedModule {
resolvedFileName: string;
isExternalLibraryImport?: boolean;
}
interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModule;
failedLookupLocations: string[];
}
type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
interface CompilerHost extends ModuleResolutionHost {
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
getCancellationToken?(): CancellationToken;
@@ -1394,7 +1398,7 @@ declare namespace ts {
getCanonicalFileName(fileName: string): string;
useCaseSensitiveFileNames(): boolean;
getNewLine(): string;
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
}
interface TextSpan {
start: number;
@@ -1515,10 +1519,9 @@ declare namespace ts {
const version: string;
function findConfigFile(searchPath: string): string;
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule;
function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
@@ -1530,7 +1533,7 @@ declare namespace ts {
* Read tsconfig.json file
* @param fileName The path to the config file
*/
function readConfigFile(fileName: string): {
function readConfigFile(fileName: string, readFile: (path: string) => string): {
config?: any;
error?: Diagnostic;
};
@@ -1649,7 +1652,7 @@ declare namespace ts {
trace?(s: string): void;
error?(s: string): void;
useCaseSensitiveFileNames?(): boolean;
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
}
interface LanguageService {
cleanupSemanticCache(): void;
+536 -314
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "1.6.0",
"version": "1.7.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+115 -43
View File
@@ -965,7 +965,7 @@ namespace ts {
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
let moduleName = escapeIdentifier(moduleReferenceLiteral.text);
if (!moduleName) {
if (moduleName === undefined) {
return;
}
let isRelative = isExternalModuleNameRelative(moduleName);
@@ -976,8 +976,8 @@ namespace ts {
}
}
let fileName = getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text);
let sourceFile = fileName && host.getSourceFile(fileName);
let resolvedModule = getResolvedModule(getSourceFile(location), moduleReferenceLiteral.text);
let sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
if (sourceFile) {
if (sourceFile.symbol) {
return sourceFile.symbol;
@@ -2318,8 +2318,8 @@ namespace ts {
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
// or otherwise the type of the string index signature.
type = getTypeOfPropertyOfType(parentType, name.text) ||
isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
getIndexTypeOfType(parentType, IndexKind.String);
isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
getIndexTypeOfType(parentType, IndexKind.String);
if (!type) {
error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), declarationNameToString(name));
return unknownType;
@@ -2406,7 +2406,7 @@ namespace ts {
// If the declaration specifies a binding pattern, use the type implied by the binding pattern
if (isBindingPattern(declaration.name)) {
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
return getTypeFromBindingPattern(<BindingPattern>declaration.name, /*includePatternInType*/ false);
}
// No type specified and nothing can be inferred
@@ -2416,48 +2416,47 @@ namespace ts {
// Return the type implied by a binding pattern element. This is the type of the initializer of the element if
// one is present. Otherwise, if the element is itself a binding pattern, it is the type implied by the binding
// pattern. Otherwise, it is the type any.
function getTypeFromBindingElement(element: BindingElement): Type {
function getTypeFromBindingElement(element: BindingElement, includePatternInType?: boolean): Type {
if (element.initializer) {
return getWidenedType(checkExpressionCached(element.initializer));
}
if (isBindingPattern(element.name)) {
return getTypeFromBindingPattern(<BindingPattern>element.name);
return getTypeFromBindingPattern(<BindingPattern>element.name, includePatternInType);
}
return anyType;
}
// Return the type implied by an object binding pattern
function getTypeFromObjectBindingPattern(pattern: BindingPattern): Type {
function getTypeFromObjectBindingPattern(pattern: BindingPattern, includePatternInType: boolean): Type {
let members: SymbolTable = {};
forEach(pattern.elements, e => {
let flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0);
let name = e.propertyName || <Identifier>e.name;
let symbol = <TransientSymbol>createSymbol(flags, name.text);
symbol.type = getTypeFromBindingElement(e);
symbol.type = getTypeFromBindingElement(e, includePatternInType);
symbol.bindingElement = e;
members[symbol.name] = symbol;
});
return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined);
let result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined);
if (includePatternInType) {
result.pattern = pattern;
}
return result;
}
// Return the type implied by an array binding pattern
function getTypeFromArrayBindingPattern(pattern: BindingPattern): Type {
let hasSpreadElement: boolean = false;
let elementTypes: Type[] = [];
forEach(pattern.elements, e => {
elementTypes.push(e.kind === SyntaxKind.OmittedExpression || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e));
if (e.dotDotDotToken) {
hasSpreadElement = true;
}
});
if (!elementTypes.length) {
function getTypeFromArrayBindingPattern(pattern: BindingPattern, includePatternInType: boolean): Type {
let elements = pattern.elements;
if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) {
return languageVersion >= ScriptTarget.ES6 ? createIterableType(anyType) : anyArrayType;
}
else if (hasSpreadElement) {
let unionOfElements = getUnionType(elementTypes);
return languageVersion >= ScriptTarget.ES6 ? createIterableType(unionOfElements) : createArrayType(unionOfElements);
}
// If the pattern has at least one element, and no rest element, then it should imply a tuple type.
let elementTypes = map(elements, e => e.kind === SyntaxKind.OmittedExpression ? anyType : getTypeFromBindingElement(e, includePatternInType));
if (includePatternInType) {
let result = createNewTupleType(elementTypes);
result.pattern = pattern;
return result;
}
return createTupleType(elementTypes);
}
@@ -2468,10 +2467,10 @@ namespace ts {
// used as the contextual type of an initializer associated with the binding pattern. Also, for a destructuring
// parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of
// the parameter.
function getTypeFromBindingPattern(pattern: BindingPattern): Type {
function getTypeFromBindingPattern(pattern: BindingPattern, includePatternInType?: boolean): Type {
return pattern.kind === SyntaxKind.ObjectBindingPattern
? getTypeFromObjectBindingPattern(pattern)
: getTypeFromArrayBindingPattern(pattern);
? getTypeFromObjectBindingPattern(pattern, includePatternInType)
: getTypeFromArrayBindingPattern(pattern, includePatternInType);
}
// Return the type associated with a variable, parameter, or property declaration. In the simple case this is the type
@@ -3126,7 +3125,7 @@ namespace ts {
}
function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreReturnTypes: boolean): Signature {
for (let s of signatureList) {
for (let s of signatureList) {
if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) {
return s;
}
@@ -4047,11 +4046,12 @@ namespace ts {
function createTupleType(elementTypes: Type[]) {
let id = getTypeListId(elementTypes);
let type = tupleTypes[id];
if (!type) {
type = tupleTypes[id] = <TupleType>createObjectType(TypeFlags.Tuple | getPropagatingFlagsOfTypes(elementTypes));
type.elementTypes = elementTypes;
}
return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes));
}
function createNewTupleType(elementTypes: Type[]) {
let type = <TupleType>createObjectType(TypeFlags.Tuple | getPropagatingFlagsOfTypes(elementTypes));
type.elementTypes = elementTypes;
return type;
}
@@ -6616,7 +6616,7 @@ namespace ts {
}
}
if (isBindingPattern(declaration.name)) {
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
return getTypeFromBindingPattern(<BindingPattern>declaration.name, /*includePatternInType*/ true);
}
}
return undefined;
@@ -7012,11 +7012,13 @@ namespace ts {
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false);
}
function hasDefaultValue(node: BindingElement | Expression): boolean {
return (node.kind === SyntaxKind.BindingElement && !!(<BindingElement>node).initializer) ||
(node.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node).operatorToken.kind === SyntaxKind.EqualsToken);
}
function checkArrayLiteral(node: ArrayLiteralExpression, contextualMapper?: TypeMapper): Type {
let elements = node.elements;
if (!elements.length) {
return createArrayType(undefinedType);
}
let hasSpreadElement = false;
let elementTypes: Type[] = [];
let inDestructuringPattern = isAssignmentTarget(node);
@@ -7048,12 +7050,39 @@ namespace ts {
hasSpreadElement = hasSpreadElement || e.kind === SyntaxKind.SpreadElementExpression;
}
if (!hasSpreadElement) {
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
// that we get the same behavior for "var [x, y] = []" and "[x, y] = []".
if (inDestructuringPattern && elementTypes.length) {
let type = createNewTupleType(elementTypes);
type.pattern = node;
return type;
}
let contextualType = getContextualType(node);
if (contextualType && contextualTypeIsTupleLikeType(contextualType) || inDestructuringPattern) {
return createTupleType(elementTypes);
if (contextualType && contextualTypeIsTupleLikeType(contextualType)) {
let pattern = contextualType.pattern;
// If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting
// tuple type with the corresponding binding or assignment element types to make the lengths equal.
if (pattern && (pattern.kind === SyntaxKind.ArrayBindingPattern || pattern.kind === SyntaxKind.ArrayLiteralExpression)) {
let patternElements = (<BindingPattern | ArrayLiteralExpression>pattern).elements;
for (let i = elementTypes.length; i < patternElements.length; i++) {
let patternElement = patternElements[i];
if (hasDefaultValue(patternElement)) {
elementTypes.push((<TupleType>contextualType).elementTypes[i]);
}
else {
if (patternElement.kind !== SyntaxKind.OmittedExpression) {
error(patternElement, Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(unknownType);
}
}
}
if (elementTypes.length) {
return createTupleType(elementTypes);
}
}
}
return createArrayType(getUnionType(elementTypes));
return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType)
}
function isNumericName(name: DeclarationName): boolean {
@@ -7120,6 +7149,9 @@ namespace ts {
let propertiesTable: SymbolTable = {};
let propertiesArray: Symbol[] = [];
let contextualType = getContextualType(node);
let contextualTypeHasPattern = contextualType && contextualType.pattern &&
(contextualType.pattern.kind === SyntaxKind.ObjectBindingPattern || contextualType.pattern.kind === SyntaxKind.ObjectLiteralExpression);
let inDestructuringPattern = isAssignmentTarget(node);
let typeFlags: TypeFlags = 0;
for (let memberDecl of node.properties) {
@@ -7140,6 +7172,25 @@ namespace ts {
}
typeFlags |= type.flags;
let prop = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name);
if (inDestructuringPattern) {
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
// for the property, make the property optional.
if (memberDecl.kind === SyntaxKind.PropertyAssignment && hasDefaultValue((<PropertyAssignment>memberDecl).initializer)) {
prop.flags |= SymbolFlags.Optional;
}
}
else if (contextualTypeHasPattern) {
// If object literal is contextually typed by the implied type of a binding pattern, and if the
// binding pattern specifies a default value for the property, make the property optional.
let impliedProp = getPropertyOfType(contextualType, member.name);
if (impliedProp) {
prop.flags |= impliedProp.flags & SymbolFlags.Optional;
}
else if (!compilerOptions.suppressExcessPropertyErrors) {
error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,
symbolToString(member), typeToString(contextualType));
}
}
prop.declarations = member.declarations;
prop.parent = member.parent;
if (member.valueDeclaration) {
@@ -7166,11 +7217,29 @@ namespace ts {
propertiesArray.push(member);
}
// If object literal is contextually typed by the implied type of a binding pattern, augment the result
// type with those properties for which the binding pattern specifies a default value.
if (contextualTypeHasPattern) {
for (let prop of getPropertiesOfType(contextualType)) {
if (!hasProperty(propertiesTable, prop.name)) {
if (!(prop.flags & SymbolFlags.Optional)) {
error(prop.valueDeclaration || (<TransientSymbol>prop).bindingElement,
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
propertiesTable[prop.name] = prop;
propertiesArray.push(prop);
}
}
}
let stringIndexType = getIndexType(IndexKind.String);
let numberIndexType = getIndexType(IndexKind.Number);
let result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType);
let freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshObjectLiteral;
result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags);
if (inDestructuringPattern) {
result.pattern = node;
}
return result;
function getIndexType(kind: IndexKind) {
@@ -14185,7 +14254,10 @@ namespace ts {
let symbols: Symbol[] = [];
let name = symbol.name;
forEach(getSymbolLinks(symbol).containingType.types, t => {
symbols.push(getPropertyOfType(t, name));
let symbol = getPropertyOfType(t, name);
if (symbol) {
symbols.push(symbol);
}
});
return symbols;
}
+5 -4
View File
@@ -243,8 +243,9 @@ namespace ts {
"node": ModuleResolutionKind.NodeJs,
"classic": ModuleResolutionKind.Classic
},
description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6
}
description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,
error: Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic,
}
];
/* @internal */
@@ -327,7 +328,7 @@ namespace ts {
options[opt.name] = map[key];
}
else {
errors.push(createCompilerDiagnostic(opt.error));
errors.push(createCompilerDiagnostic((<CommandLineOptionOfCustomType>opt).error));
}
}
}
@@ -440,7 +441,7 @@ namespace ts {
value = optType[key];
}
else {
errors.push(createCompilerDiagnostic(opt.error));
errors.push(createCompilerDiagnostic((<CommandLineOptionOfCustomType>opt).error));
value = 0;
}
}
@@ -415,6 +415,7 @@ namespace ts {
The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." },
yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." },
await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." },
Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." },
JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." },
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." },
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." },
@@ -428,6 +429,9 @@ namespace ts {
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." },
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." },
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." },
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -561,13 +565,14 @@ namespace ts {
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: DiagnosticCategory.Error, key: "Argument for '--moduleResolution' option must be 'node' or 'classic'." },
Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" },
Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." },
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." },
Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." },
Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." },
Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." },
Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." },
Successfully_created_a_tsconfig_json_file: { code: 6071, category: DiagnosticCategory.Message, key: "Successfully created a tsconfig.json file." },
Suppress_excess_property_checks_for_object_literals: { code: 6072, category: DiagnosticCategory.Message, key: "Suppress excess property checks for object literals." },
+23 -3
View File
@@ -1649,6 +1649,10 @@
"category": "Error",
"code": 2524
},
"Initializer provides no value for this binding element and the binding element has no default value.": {
"category": "Error",
"code": 2525
},
"JSX element attributes type '{0}' must be an object type.": {
"category": "Error",
"code": 2600
@@ -1696,12 +1700,23 @@
"Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.": {
"category": "Error",
"code": 2652
},
},
"Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.": {
"category": "Error",
"code": 2653
},
"Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": {
"category": "Error",
"code": 2654
},
"Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition.": {
"category": "Error",
"code": 2655
},
"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": {
"category": "Error",
"code": 2656
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 4000
@@ -2235,6 +2250,11 @@
"category": "Error",
"code": 6062
},
"Argument for '--moduleResolution' option must be 'node' or 'classic'.": {
"category": "Error",
"code": 6063
},
"Specify JSX code generation: 'preserve' or 'react'": {
"category": "Message",
"code": 6080
@@ -2259,7 +2279,7 @@
"category": "Message",
"code": 6068
},
"Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) .": {
"Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).": {
"category": "Message",
"code": 6069
},
+42 -23
View File
@@ -3148,6 +3148,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitExportSpecifierInSystemModule(specifier: ExportSpecifier): void {
Debug.assert(compilerOptions.module === ModuleKind.System);
if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier) ) {
return;
}
writeLine();
emitStart(specifier.name);
@@ -3216,22 +3220,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
function ensureIdentifier(expr: Expression): Expression {
if (expr.kind !== SyntaxKind.Identifier) {
let identifier = createTempVariable(TempFlags.Auto);
if (!canDefineTempVariablesInPlace) {
recordTempDeclaration(identifier);
}
emitAssignment(identifier, expr);
expr = identifier;
/**
* Ensures that there exists a declared identifier whose value holds the given expression.
* This function is useful to ensure that the expression's value can be read from in subsequent expressions.
* Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier.
*
* @param expr the expression whose value needs to be bound.
* @param reuseIdentifierExpressions true if identifier expressions can simply be returned;
* false if it is necessary to always emit an identifier.
*/
function ensureIdentifier(expr: Expression, reuseIdentifierExpressions: boolean): Expression {
if (expr.kind === SyntaxKind.Identifier && reuseIdentifierExpressions) {
return expr;
}
return expr;
let identifier = createTempVariable(TempFlags.Auto);
if (!canDefineTempVariablesInPlace) {
recordTempDeclaration(identifier);
}
emitAssignment(identifier, expr);
return identifier;
}
function createDefaultValueCheck(value: Expression, defaultValue: Expression): Expression {
// The value expression will be evaluated twice, so for anything but a simple identifier
// we need to generate a temporary variable
value = ensureIdentifier(value);
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
// Return the expression 'value === void 0 ? defaultValue : value'
let equals = <BinaryExpression>createSynthesizedNode(SyntaxKind.BinaryExpression);
equals.left = value;
@@ -3282,7 +3296,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (properties.length !== 1) {
// For anything but a single element destructuring we need to generate a temporary
// to ensure value is evaluated exactly once.
value = ensureIdentifier(value);
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
}
for (let p of properties) {
if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) {
@@ -3297,7 +3311,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (elements.length !== 1) {
// For anything but a single element destructuring we need to generate a temporary
// to ensure value is evaluated exactly once.
value = ensureIdentifier(value);
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
}
for (let i = 0; i < elements.length; i++) {
let e = elements[i];
@@ -3342,7 +3356,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (root.parent.kind !== SyntaxKind.ParenthesizedExpression) {
write("(");
}
value = ensureIdentifier(value);
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
emitDestructuringAssignment(target, value);
write(", ");
emit(value);
@@ -3352,7 +3366,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
}
function emitBindingElement(target: BindingElement, value: Expression) {
function emitBindingElement(target: BindingElement | VariableDeclaration, value: Expression) {
if (target.initializer) {
// Combine value and initializer
value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer;
@@ -3362,14 +3376,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
value = createVoidZero();
}
if (isBindingPattern(target.name)) {
let pattern = <BindingPattern>target.name;
let elements = pattern.elements;
if (elements.length !== 1) {
// For anything but a single element destructuring we need to generate a temporary
// to ensure value is evaluated exactly once.
value = ensureIdentifier(value);
const pattern = <BindingPattern>target.name;
const elements = pattern.elements;
const numElements = elements.length;
if (numElements !== 1) {
// For anything other than a single-element destructuring we need to generate a temporary
// to ensure value is evaluated exactly once. Additionally, if we have zero elements
// we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
// so in that case, we'll intentionally create that temporary.
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0);
}
for (let i = 0; i < elements.length; i++) {
for (let i = 0; i < numElements; i++) {
let element = elements[i];
if (pattern.kind === SyntaxKind.ObjectBindingPattern) {
// Rewrite element to a declaration with an initializer that fetches property
@@ -3381,7 +3400,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// Rewrite element to a declaration that accesses array element at index i
emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i)));
}
else if (i === elements.length - 1) {
else if (i === numElements - 1) {
emitBindingElement(element, createSliceCall(value, i));
}
}
@@ -6095,7 +6114,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
return;
}
if (isInternalModuleImportEqualsDeclaration(node)) {
if (isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) {
if (!hoistedVars) {
hoistedVars = [];
}
+45 -48
View File
@@ -12,7 +12,7 @@ namespace ts {
let emptyArray: any[] = [];
export const version = "1.6.0";
export const version = "1.7.0";
export function findConfigFile(searchPath: string): string {
let fileName = "tsconfig.json";
@@ -36,7 +36,7 @@ namespace ts {
return normalizePath(referencedFileName);
}
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule {
export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
let moduleResolution = compilerOptions.moduleResolution !== undefined
? compilerOptions.moduleResolution
: compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic;
@@ -47,7 +47,7 @@ namespace ts {
}
}
export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule {
export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
let containingDirectory = getDirectoryPath(containingFile);
if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) {
@@ -56,11 +56,13 @@ namespace ts {
let resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
if (resolvedFileName) {
return { resolvedFileName, failedLookupLocations };
return { resolvedModule: { resolvedFileName }, failedLookupLocations };
}
resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
return { resolvedFileName, failedLookupLocations };
return resolvedFileName
? { resolvedModule: { resolvedFileName }, failedLookupLocations }
: { resolvedModule: undefined, failedLookupLocations };
}
else {
return loadModuleFromNodeModules(moduleName, containingDirectory, host);
@@ -117,7 +119,7 @@ namespace ts {
return loadNodeModuleFromFile(combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host);
}
function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModule {
function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
let failedLookupLocations: string[] = [];
directory = normalizeSlashes(directory);
while (true) {
@@ -127,12 +129,12 @@ namespace ts {
let candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName));
let result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
if (result) {
return { resolvedFileName: result, failedLookupLocations };
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
}
result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
if (result) {
return { resolvedFileName: result, failedLookupLocations };
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
}
}
@@ -144,47 +146,19 @@ namespace ts {
directory = parentPath;
}
return { resolvedFileName: undefined, failedLookupLocations };
}
export function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule {
Debug.assert(baseUrl !== undefined);
let normalizedModuleName = normalizeSlashes(moduleName);
let basePart = useBaseUrl(moduleName) ? baseUrl : getDirectoryPath(containingFile);
let candidate = normalizePath(combinePaths(basePart, moduleName));
let failedLookupLocations: string[] = [];
return forEach(supportedExtensions, ext => tryLoadFile(candidate + ext)) || { resolvedFileName: undefined, failedLookupLocations };
function tryLoadFile(location: string): ResolvedModule {
if (host.fileExists(location)) {
return { resolvedFileName: location, failedLookupLocations };
}
else {
failedLookupLocations.push(location);
return undefined;
}
}
return { resolvedModule: undefined, failedLookupLocations };
}
function nameStartsWithDotSlashOrDotDotSlash(name: string) {
let i = name.lastIndexOf("./", 1);
return i === 0 || (i === 1 && name.charCodeAt(0) === CharacterCodes.dot);
}
function useBaseUrl(moduleName: string): boolean {
// path is not rooted
// module name does not start with './' or '../'
return getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName);
}
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule {
export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
// module names that contain '!' are used to reference resources and are not resolved to actual files on disk
if (moduleName.indexOf('!') != -1) {
return { resolvedFileName: undefined, failedLookupLocations: [] };
return { resolvedModule: undefined, failedLookupLocations: [] };
}
let searchPath = getDirectoryPath(containingFile);
@@ -222,7 +196,9 @@ namespace ts {
searchPath = parentPath;
}
return { resolvedFileName: referencedSourceFile, failedLookupLocations };
return referencedSourceFile
? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations }
: { resolvedModule: undefined, failedLookupLocations };
}
/* @internal */
@@ -372,9 +348,9 @@ namespace ts {
host = host || createCompilerHost(options);
const resolveModuleNamesWorker =
host.resolveModuleNames ||
((moduleNames, containingFile) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedFileName));
const resolveModuleNamesWorker = host.resolveModuleNames
? ((moduleNames: string[], containingFile: string) => host.resolveModuleNames(moduleNames, containingFile))
: ((moduleNames: string[], containingFile: string) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedModule));
let filesByName = createFileMap<SourceFile>(fileName => host.getCanonicalFileName(fileName));
@@ -494,10 +470,17 @@ namespace ts {
let resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName);
// ensure that module resolution results are still correct
for (let i = 0; i < moduleNames.length; ++i) {
let oldResolution = getResolvedModuleFileName(oldSourceFile, moduleNames[i]);
if (oldResolution !== resolutions[i]) {
let newResolution = resolutions[i];
let oldResolution = getResolvedModule(oldSourceFile, moduleNames[i]);
let resolutionChanged = oldResolution
? !newResolution ||
oldResolution.resolvedFileName !== newResolution.resolvedFileName ||
!!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport
: newResolution;
if (resolutionChanged) {
return false;
}
}
}
}
// pass the cache of module resolutions from the old source file
@@ -874,9 +857,23 @@ namespace ts {
let resolutions = resolveModuleNamesWorker(moduleNames, file.fileName);
for (let i = 0; i < file.imports.length; ++i) {
let resolution = resolutions[i];
setResolvedModuleName(file, moduleNames[i], resolution);
setResolvedModule(file, moduleNames[i], resolution);
if (resolution && !options.noResolve) {
findModuleSourceFile(resolution, file.imports[i]);
const importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]);
if (importedFile && resolution.isExternalLibraryImport) {
if (!isExternalModule(importedFile)) {
let start = getTokenPosOfNode(file.imports[i], file)
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
}
else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) {
let start = getTokenPosOfNode(file.imports[i], file)
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
}
else if (importedFile.referencedFiles.length) {
let firstRef = importedFile.referencedFiles[0];
fileProcessingDiagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));
}
}
}
}
}
+36 -11
View File
@@ -1284,7 +1284,7 @@ namespace ts {
// Stores a mapping 'external module reference text' -> 'resolved file name' | undefined
// It is used to resolve module names in the checker.
// Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
/* @internal */ resolvedModules: Map<string>;
/* @internal */ resolvedModules: Map<ResolvedModule>;
/* @internal */ imports: LiteralExpression[];
}
@@ -1715,6 +1715,7 @@ namespace ts {
resolvedExports?: SymbolTable; // Resolved exports of module
exportsChecked?: boolean; // True if exports of external module have been checked
isNestedRedeclaration?: boolean; // True if symbol is block scoped redeclaration
bindingElement?: BindingElement; // Binding element associated with property symbol
}
/* @internal */
@@ -1812,11 +1813,14 @@ namespace ts {
PropagatingFlags = ContainsUndefinedOrNull | ContainsObjectLiteral | ContainsAnyFunctionType
}
export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
// Properties common to all types
export interface Type {
flags: TypeFlags; // Flags
/* @internal */ id: number; // Unique ID
symbol?: Symbol; // Symbol associated with type (if any)
flags: TypeFlags; // Flags
/* @internal */ id: number; // Unique ID
symbol?: Symbol; // Symbol associated with type (if any)
pattern?: DestructuringPattern; // Destructuring pattern represented by type (if any)
}
/* @internal */
@@ -1865,8 +1869,7 @@ namespace ts {
}
export interface TupleType extends ObjectType {
elementTypes: Type[]; // Element types
baseArrayType: TypeReference; // Array<T> where T is best common type of element types
elementTypes: Type[]; // Element types
}
export interface UnionOrIntersectionType extends Type {
@@ -2113,17 +2116,30 @@ namespace ts {
}
/* @internal */
export interface CommandLineOption {
export interface CommandLineOptionBase {
name: string;
type: string | Map<number>; // "string", "number", "boolean", or an object literal mapping named values to actual values
isFilePath?: boolean; // True if option value is a path or fileName
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'
description?: DiagnosticMessage; // The message describing what the command line switch does
paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter
error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'
experimental?: boolean;
}
/* @internal */
export interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase {
type: string; // "string" | "number" | "boolean"
}
/* @internal */
export interface CommandLineOptionOfCustomType extends CommandLineOptionBase {
type: Map<number>; // an object literal mapping named values to actual values
error: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'
}
/* @internal */
export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType;
/* @internal */
export const enum CharacterCodes {
nullCharacter = 0,
@@ -2270,11 +2286,20 @@ namespace ts {
export interface ResolvedModule {
resolvedFileName: string;
/*
* Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be proper external module:
* - be a .d.ts file
* - use top level imports\exports
* - don't use tripleslash references
*/
isExternalLibraryImport?: boolean;
}
export interface ResolvedModuleWithFailedLookupLocations {
resolvedModule: ResolvedModule;
failedLookupLocations: string[];
}
export type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule;
export interface CompilerHost extends ModuleResolutionHost {
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile;
getCancellationToken?(): CancellationToken;
@@ -2292,7 +2317,7 @@ namespace ts {
* If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just
* 'throw new Error("NotImplemented")'
*/
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
}
export interface TextSpan {
+5 -5
View File
@@ -99,20 +99,20 @@ namespace ts {
return true;
}
export function hasResolvedModuleName(sourceFile: SourceFile, moduleNameText: string): boolean {
export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean {
return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText);
}
export function getResolvedModuleFileName(sourceFile: SourceFile, moduleNameText: string): string {
return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
export function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModule {
return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined;
}
export function setResolvedModuleName(sourceFile: SourceFile, moduleNameText: string, resolvedFileName: string): void {
export function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModule): void {
if (!sourceFile.resolvedModules) {
sourceFile.resolvedModules = {};
}
sourceFile.resolvedModules[moduleNameText] = resolvedFileName;
sourceFile.resolvedModules[moduleNameText] = resolvedModule;
}
// Returns true if this node contains a parse error anywhere underneath it.
+2 -30
View File
@@ -44,10 +44,10 @@ class CompilerBaselineRunner extends RunnerBase {
// Everything declared here should be cleared out in the "after" callback.
let justName: string;
let content: string;
let testCaseContent: { settings: Harness.TestCaseParser.CompilerSetting[]; testUnitData: Harness.TestCaseParser.TestUnitData[]; };
let testCaseContent: { settings: Harness.TestCaseParser.CompilerSettings; testUnitData: Harness.TestCaseParser.TestUnitData[]; };
let units: Harness.TestCaseParser.TestUnitData[];
let tcSettings: Harness.TestCaseParser.CompilerSetting[];
let tcSettings: Harness.TestCaseParser.CompilerSettings;
let lastUnit: Harness.TestCaseParser.TestUnitData;
let rootDir: string;
@@ -61,15 +61,12 @@ class CompilerBaselineRunner extends RunnerBase {
let otherFiles: { unitName: string; content: string }[];
let harnessCompiler: Harness.Compiler.HarnessCompiler;
let createNewInstance = false;
before(() => {
justName = fileName.replace(/^.*[\\\/]/, ""); // strips the fileName from the path.
content = Harness.IO.readFile(fileName);
testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName);
units = testCaseContent.testUnitData;
tcSettings = testCaseContent.settings;
createNewInstance = false;
lastUnit = units[units.length - 1];
rootDir = lastUnit.originalFilePath.indexOf("conformance") === -1 ? "tests/cases/compiler/" : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf("/")) + "/";
harnessCompiler = Harness.Compiler.getCompiler();
@@ -100,27 +97,6 @@ class CompilerBaselineRunner extends RunnerBase {
});
});
beforeEach(() => {
/* The compiler doesn't handle certain flags flipping during a single compilation setting. Tests on these flags will need
a fresh compiler instance for themselves and then create a fresh one for the next test. Would be nice to get dev fixes
eventually to remove this limitation. */
for (let i = 0; i < tcSettings.length; ++i) {
// noImplicitAny is passed to getCompiler, but target is just passed in the settings blob to setCompilerSettings
if (!createNewInstance && (tcSettings[i].flag == "noimplicitany" || tcSettings[i].flag === "target")) {
harnessCompiler = Harness.Compiler.getCompiler();
harnessCompiler.setCompilerSettings(tcSettings);
createNewInstance = true;
}
}
});
afterEach(() => {
if (createNewInstance) {
harnessCompiler = Harness.Compiler.getCompiler();
createNewInstance = false;
}
});
after(() => {
// Mocha holds onto the closure environment of the describe callback even after the test is done.
// Therefore we have to clean out large objects after the test is done.
@@ -402,10 +378,6 @@ class CompilerBaselineRunner extends RunnerBase {
else {
this.tests.forEach(test => this.checkTestCodeOutput(test));
}
describe("Cleanup after compiler baselines", () => {
let harnessCompiler = Harness.Compiler.getCompiler();
});
});
}
+13 -87
View File
@@ -29,13 +29,13 @@ module FourSlash {
fileName: string;
version: number;
// File-specific options (name/value pairs)
fileOptions: { [index: string]: string; };
fileOptions: Harness.TestCaseParser.CompilerSettings;
}
// Represents a set of parsed source files and options
export interface FourSlashData {
// Global options (name/value pairs)
globalOptions: { [index: string]: string; };
globalOptions: Harness.TestCaseParser.CompilerSettings;
files: FourSlashFile[];
@@ -117,89 +117,17 @@ module FourSlash {
// Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data
let metadataOptionNames = {
baselineFile: "BaselineFile",
declaration: "declaration",
emitThisFile: "emitThisFile", // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project
fileName: "Filename",
mapRoot: "mapRoot",
module: "module",
out: "out",
outFile: "outFile",
outDir: "outDir",
sourceMap: "sourceMap",
sourceRoot: "sourceRoot",
allowNonTsExtensions: "allowNonTsExtensions",
resolveReference: "ResolveReference", // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file
jsx: "jsx",
};
// List of allowed metadata names
let fileMetadataNames = [metadataOptionNames.fileName, metadataOptionNames.emitThisFile, metadataOptionNames.resolveReference];
let globalMetadataNames = [metadataOptionNames.allowNonTsExtensions, metadataOptionNames.baselineFile, metadataOptionNames.declaration,
metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out,metadataOptionNames.outFile,
metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot, metadataOptionNames.jsx];
function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions {
function convertGlobalOptionsToCompilerOptions(globalOptions: Harness.TestCaseParser.CompilerSettings): ts.CompilerOptions {
let settings: ts.CompilerOptions = { target: ts.ScriptTarget.ES5 };
// Convert all property in globalOptions into ts.CompilationSettings
for (let prop in globalOptions) {
if (globalOptions.hasOwnProperty(prop)) {
switch (prop) {
case metadataOptionNames.allowNonTsExtensions:
settings.allowNonTsExtensions = globalOptions[prop] === "true";
break;
case metadataOptionNames.declaration:
settings.declaration = globalOptions[prop] === "true";
break;
case metadataOptionNames.mapRoot:
settings.mapRoot = globalOptions[prop];
break;
case metadataOptionNames.module:
// create appropriate external module target for CompilationSettings
switch (globalOptions[prop]) {
case "AMD":
settings.module = ts.ModuleKind.AMD;
break;
case "CommonJS":
settings.module = ts.ModuleKind.CommonJS;
break;
default:
ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None");
settings.module = ts.ModuleKind.None;
break;
}
break;
case metadataOptionNames.out:
settings.out = globalOptions[prop];
break;
case metadataOptionNames.outFile:
settings.outFile = globalOptions[prop];
break;
case metadataOptionNames.outDir:
settings.outDir = globalOptions[prop];
break;
case metadataOptionNames.sourceMap:
settings.sourceMap = globalOptions[prop] === "true";
break;
case metadataOptionNames.sourceRoot:
settings.sourceRoot = globalOptions[prop];
break;
case metadataOptionNames.jsx:
switch (globalOptions[prop].toLowerCase()) {
case "react":
settings.jsx = ts.JsxEmit.React;
break;
case "preserve":
settings.jsx = ts.JsxEmit.Preserve;
break;
default:
ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None");
settings.jsx = ts.JsxEmit.None;
break;
}
break;
}
}
}
Harness.Compiler.setCompilerOptionsFromHarnessSetting(globalOptions, settings);
return settings;
}
@@ -2514,12 +2442,16 @@ module FourSlash {
// Comment line, check for global/file @options and record them
let match = optionRegex.exec(line.substr(2));
if (match) {
let globalMetadataNamesIndex = globalMetadataNames.indexOf(match[1]);
let fileMetadataNamesIndex = fileMetadataNames.indexOf(match[1]);
if (globalMetadataNamesIndex === -1) {
if (fileMetadataNamesIndex === -1) {
throw new Error(`Unrecognized metadata name "${match[1]}". Available global metadata names are: ${globalMetadataNames.join(", ")}; file metadata names are: ${fileMetadataNames.join(", ")}`);
} else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(metadataOptionNames.fileName)) {
if (fileMetadataNamesIndex === -1) {
// Check if the match is already existed in the global options
if (globalOptions[match[1]] !== undefined) {
throw new Error("Global Option : '" + match[1] + "' is already existed");
}
globalOptions[match[1]] = match[2];
}
else {
if (fileMetadataNamesIndex === fileMetadataNames.indexOf(metadataOptionNames.fileName)) {
// Found an @FileName directive, if this is not the first then create a new subfile
if (currentFileContent) {
let file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges);
@@ -2540,12 +2472,6 @@ module FourSlash {
// Add other fileMetadata flag
currentFileOptions[match[1]] = match[2];
}
} else {
// Check if the match is already existed in the global options
if (globalOptions[match[1]] !== undefined) {
throw new Error("Global Option : '" + match[1] + "' is already existed");
}
globalOptions[match[1]] = match[2];
}
}
// TODO: should be '==='?
+102 -239
View File
@@ -428,6 +428,7 @@ module Harness {
args(): string[];
getExecutingFilePath(): string;
exit(exitCode?: number): void;
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
}
export var IO: IO;
@@ -464,6 +465,7 @@ module Harness {
export const directoryExists: typeof IO.directoryExists = fso.FolderExists;
export const fileExists: typeof IO.fileExists = fso.FileExists;
export const log: typeof IO.log = global.WScript && global.WScript.StdOut.WriteLine;
export const readDirectory: typeof IO.readDirectory = (path, extension, exclude) => ts.sys.readDirectory(path, extension, exclude);
export function createDirectory(path: string) {
if (directoryExists(path)) {
@@ -532,6 +534,8 @@ module Harness {
export const fileExists: typeof IO.fileExists = fs.existsSync;
export const log: typeof IO.log = s => console.log(s);
export const readDirectory: typeof IO.readDirectory = (path, extension, exclude) => ts.sys.readDirectory(path, extension, exclude);
export function createDirectory(path: string) {
if (!directoryExists(path)) {
fs.mkdirSync(path);
@@ -730,6 +734,10 @@ module Harness {
export function writeFile(path: string, contents: string) {
Http.writeToServerSync(serverRoot + path, "WRITE", contents);
}
export function readDirectory(path: string, extension?: string, exclude?: string[]) {
return listFiles(path).filter(f => !extension || ts.fileExtensionIs(f, extension));
}
}
}
@@ -851,9 +859,9 @@ module Harness {
}
export function createSourceFileAndAssertInvariants(
fileName: string,
sourceText: string,
languageVersion: ts.ScriptTarget) {
fileName: string,
sourceText: string,
languageVersion: ts.ScriptTarget) {
// We'll only assert inletiants outside of light mode.
const shouldAssertInvariants = !Harness.lightMode;
@@ -883,13 +891,13 @@ module Harness {
}
export function createCompilerHost(
inputFiles: { unitName: string; content: string; }[],
writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void,
scriptTarget: ts.ScriptTarget,
useCaseSensitiveFileNames: boolean,
// the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host
currentDirectory?: string,
newLineKind?: ts.NewLineKind): ts.CompilerHost {
inputFiles: { unitName: string; content: string; }[],
writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void,
scriptTarget: ts.ScriptTarget,
useCaseSensitiveFileNames: boolean,
// the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host
currentDirectory?: string,
newLineKind?: ts.NewLineKind): ts.CompilerHost {
// Local get canonical file name function, that depends on passed in parameter for useCaseSensitiveFileNames
function getCanonicalFileName(fileName: string): string {
@@ -907,7 +915,7 @@ module Harness {
}
};
inputFiles.forEach(register);
function getSourceFile(fn: string, languageVersion: ts.ScriptTarget) {
fn = ts.normalizePath(fn);
if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) {
@@ -949,16 +957,79 @@ module Harness {
};
}
interface HarnessOptions {
useCaseSensitiveFileNames?: boolean;
includeBuiltFile?: string;
baselineFile?: string;
}
// Additional options not already in ts.optionDeclarations
const harnessOptionDeclarations: ts.CommandLineOption[] = [
{ name: "allowNonTsExtensions", type: "boolean" },
{ name: "useCaseSensitiveFileNames", type: "boolean" },
{ name: "baselineFile", type: "string" },
{ name: "includeBuiltFile", type: "string" },
{ name: "fileName", type: "string" },
{ name: "noErrorTruncation", type: "boolean" }
];
let optionsIndex: ts.Map<ts.CommandLineOption>;
function getCommandLineOption(name: string): ts.CommandLineOption {
if (!optionsIndex) {
optionsIndex = {};
let optionDeclarations = harnessOptionDeclarations.concat(ts.optionDeclarations);
for (let option of optionDeclarations) {
optionsIndex[option.name.toLowerCase()] = option;
}
}
return ts.lookUp(optionsIndex, name.toLowerCase());
}
export function setCompilerOptionsFromHarnessSetting(settings: Harness.TestCaseParser.CompilerSettings, options: ts.CompilerOptions & HarnessOptions): void {
for (let name in settings) {
if (settings.hasOwnProperty(name)) {
let value = settings[name];
if (value === undefined) {
throw new Error(`Cannot have undefined value for compiler option '${name}'.`);
}
let option = getCommandLineOption(name);
if (option) {
switch (option.type) {
case "boolean":
options[option.name] = value.toLowerCase() === "true";
break;
case "string":
options[option.name] = value;
break;
// If not a primitive, the possible types are specified in what is effectively a map of options.
default:
let map = <ts.Map<number>>option.type;
let key = value.toLowerCase();
if (ts.hasProperty(map, key)) {
options[option.name] = map[key];
}
else {
throw new Error(`Unknown value '${value}' for compiler option '${name}'.`);
}
}
}
else {
throw new Error(`Unknown compiler option '${name}'.`);
}
}
}
}
export class HarnessCompiler {
private inputFiles: { unitName: string; content: string }[] = [];
private compileOptions: ts.CompilerOptions;
private settings: Harness.TestCaseParser.CompilerSetting[] = [];
private settings: Harness.TestCaseParser.CompilerSettings = {};
private lastErrors: ts.Diagnostic[];
public reset() {
this.inputFiles = [];
this.settings = [];
this.settings = {};
this.lastErrors = [];
}
@@ -966,11 +1037,7 @@ module Harness {
return this.lastErrors;
}
public setCompilerSettingsFromOptions(tcSettings: ts.CompilerOptions) {
this.settings = Object.keys(tcSettings).map(k => ({ flag: k, value: (<any>tcSettings)[k] }));
}
public setCompilerSettings(tcSettings: Harness.TestCaseParser.CompilerSetting[]) {
public setCompilerSettings(tcSettings: Harness.TestCaseParser.CompilerSettings) {
this.settings = tcSettings;
}
@@ -1006,7 +1073,7 @@ module Harness {
otherFiles: { unitName: string; content: string }[],
onComplete: (result: CompilerResult, program: ts.Program) => void,
settingsCallback?: (settings: ts.CompilerOptions) => void,
options?: ts.CompilerOptions,
options?: ts.CompilerOptions & HarnessOptions,
// Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file
currentDirectory?: string) {
@@ -1015,21 +1082,27 @@ module Harness {
options.module = options.module || ts.ModuleKind.None;
options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed;
options.noErrorTruncation = true;
options.skipDefaultLibCheck = true;
if (settingsCallback) {
settingsCallback(null);
}
let newLine = "\r\n";
options.skipDefaultLibCheck = true;
// Parse settings
setCompilerOptionsFromHarnessSetting(this.settings, options);
// Files from built\local that are requested by test "@includeBuiltFiles" to be in the context.
// Treat them as library files, so include them in build, but not in baselines.
let includeBuiltFiles: { unitName: string; content: string }[] = [];
if (options.includeBuiltFile) {
let builtFileName = libFolder + options.includeBuiltFile;
includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) });
}
let useCaseSensitiveFileNames = Harness.IO.useCaseSensitiveFileNames();
this.settings.forEach(setCompilerOptionForSetting);
let useCaseSensitiveFileNames = options.useCaseSensitiveFileNames !== undefined ? options.useCaseSensitiveFileNames : Harness.IO.useCaseSensitiveFileNames();
let fileOutputs: GeneratedFile[] = [];
let programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
@@ -1049,204 +1122,6 @@ module Harness {
onComplete(result, program);
return options;
function setCompilerOptionForSetting(setting: Harness.TestCaseParser.CompilerSetting) {
switch (setting.flag.toLowerCase()) {
// "fileName", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve"
case "module":
case "modulegentarget":
if (typeof setting.value === "string") {
if (setting.value.toLowerCase() === "amd") {
options.module = ts.ModuleKind.AMD;
} else if (setting.value.toLowerCase() === "umd") {
options.module = ts.ModuleKind.UMD;
} else if (setting.value.toLowerCase() === "commonjs") {
options.module = ts.ModuleKind.CommonJS;
if (options.moduleResolution === undefined) {
// TODO: currently we have relative module names pretty much in all tests that use CommonJS module target.
// Such names could never be resolved in Node however classic resolution strategy still can handle them.
// Changing all module names to relative will be a major overhaul in code (but we'll do this anyway) so as a temporary measure
// we'll use ts.ModuleResolutionKind.Classic for CommonJS modules.
options.moduleResolution = ts.ModuleResolutionKind.Classic;
}
} else if (setting.value.toLowerCase() === "system") {
options.module = ts.ModuleKind.System;
} else if (setting.value.toLowerCase() === "unspecified") {
options.module = ts.ModuleKind.None;
} else {
throw new Error("Unknown module type " + setting.value);
}
} else {
options.module = <any>setting.value;
}
break;
case "moduleresolution":
switch((setting.value || "").toLowerCase()) {
case "classic":
options.moduleResolution = ts.ModuleResolutionKind.Classic;
break;
case "node":
options.moduleResolution = ts.ModuleResolutionKind.NodeJs;
break;
}
break;
case "target":
case "codegentarget":
if (typeof setting.value === "string") {
if (setting.value.toLowerCase() === "es3") {
options.target = ts.ScriptTarget.ES3;
} else if (setting.value.toLowerCase() === "es5") {
options.target = ts.ScriptTarget.ES5;
} else if (setting.value.toLowerCase() === "es6") {
options.target = ts.ScriptTarget.ES6;
} else {
throw new Error("Unknown compile target " + setting.value);
}
} else {
options.target = <any>setting.value;
}
break;
case "experimentaldecorators":
options.experimentalDecorators = setting.value === "true";
break;
case "emitdecoratormetadata":
options.emitDecoratorMetadata = setting.value === "true";
break;
case "experimentalasyncfunctions":
options.experimentalAsyncFunctions = setting.value === "true";
break;
case "noemithelpers":
options.noEmitHelpers = setting.value === "true";
break;
case "noemitonerror":
options.noEmitOnError = setting.value === "true";
break;
case "noresolve":
options.noResolve = setting.value === "true";
break;
case "noimplicitany":
options.noImplicitAny = setting.value === "true";
break;
case "nolib":
options.noLib = setting.value === "true";
break;
case "out":
case "outfileoption":
options.out = setting.value;
break;
case "outfile":
options.outFile = setting.value;
break;
case "outdiroption":
case "outdir":
options.outDir = setting.value;
break;
case "skipdefaultlibcheck":
options.skipDefaultLibCheck = setting.value === "true";
break;
case "sourceroot":
options.sourceRoot = setting.value;
break;
case "maproot":
options.mapRoot = setting.value;
break;
case "sourcemap":
options.sourceMap = setting.value === "true";
break;
case "declaration":
options.declaration = setting.value === "true";
break;
case "newline":
if (setting.value.toLowerCase() === "crlf") {
options.newLine = ts.NewLineKind.CarriageReturnLineFeed;
}
else if (setting.value.toLowerCase() === "lf") {
options.newLine = ts.NewLineKind.LineFeed;
}
else {
throw new Error("Unknown option for newLine: " + setting.value);
}
break;
case "comments":
options.removeComments = setting.value === "false";
break;
case "stripinternal":
options.stripInternal = setting.value === "true";
case "usecasesensitivefilenames":
useCaseSensitiveFileNames = setting.value === "true";
break;
case "filename":
// Not supported yet
break;
case "emitbom":
options.emitBOM = setting.value === "true";
break;
case "errortruncation":
options.noErrorTruncation = setting.value === "false";
break;
case "preserveconstenums":
options.preserveConstEnums = setting.value === "true";
break;
case "isolatedmodules":
options.isolatedModules = setting.value === "true";
break;
case "suppressexcesspropertyerrors":
options.suppressExcessPropertyErrors = setting.value === "true";
break;
case "suppressimplicitanyindexerrors":
options.suppressImplicitAnyIndexErrors = setting.value === "true";
break;
case "includebuiltfile":
let builtFileName = libFolder + setting.value;
includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) });
break;
case "inlinesourcemap":
options.inlineSourceMap = setting.value === "true";
break;
case "inlinesources":
options.inlineSources = setting.value === "true";
break;
case "jsx":
options.jsx = setting.value.toLowerCase() === "react" ? ts.JsxEmit.React :
setting.value.toLowerCase() === "preserve" ? ts.JsxEmit.Preserve :
ts.JsxEmit.None;
break;
default:
throw new Error("Unsupported compiler setting " + setting.flag);
}
}
}
public compileDeclarationFiles(inputFiles: { unitName: string; content: string; }[],
@@ -1571,9 +1446,8 @@ module Harness {
export module TestCaseParser {
/** all the necessary information to set the right compiler settings */
export interface CompilerSetting {
flag: string;
value: string;
export interface CompilerSettings {
[name: string]: string;
}
/** All the necessary information to turn a multi file test into useful units for later compilation */
@@ -1588,30 +1462,19 @@ module Harness {
// Regex for parsing options in the format "@Alpha: Value of any sort"
let optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
// List of allowed metadata names
let fileMetadataNames = ["filename", "comments", "declaration", "module",
"nolib", "sourcemap", "target", "out", "outdir", "noemithelpers", "noemitonerror",
"noimplicitany", "noresolve", "newline", "normalizenewline", "emitbom",
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
"includebuiltfile", "suppressexcesspropertyerrors", "suppressimplicitanyindexerrors", "stripinternal",
"isolatedmodules", "inlinesourcemap", "maproot", "sourceroot",
"inlinesources", "emitdecoratormetadata", "experimentaldecorators",
"skipdefaultlibcheck", "jsx"];
function extractCompilerSettings(content: string): CompilerSetting[] {
let opts: CompilerSetting[] = [];
function extractCompilerSettings(content: string): CompilerSettings {
let opts: CompilerSettings = {};
let match: RegExpExecArray;
while ((match = optionRegex.exec(content)) != null) {
opts.push({ flag: match[1], value: match[2] });
opts[match[1]] = match[2];
}
return opts;
}
/** Given a test file containing // @FileName directives, return an array of named units of code to be added to an existing compiler instance */
export function makeUnitsFromTest(code: string, fileName: string): { settings: CompilerSetting[]; testUnitData: TestUnitData[]; } {
export function makeUnitsFromTest(code: string, fileName: string): { settings: CompilerSettings; testUnitData: TestUnitData[]; } {
let settings = extractCompilerSettings(code);
// List of all the subfiles we've parsed out
+2 -2
View File
@@ -225,8 +225,8 @@ module Harness.LanguageService {
let imports: ts.Map<string> = {};
for (let module of preprocessInfo.importedFiles) {
let resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost);
if (resolutionInfo.resolvedFileName) {
imports[module.fileName] = resolutionInfo.resolvedFileName;
if (resolutionInfo.resolvedModule) {
imports[module.fileName] = resolutionInfo.resolvedModule.resolvedFileName;
}
}
return JSON.stringify(imports);
+6 -2
View File
@@ -3,11 +3,15 @@ var fs: any = require('fs');
var path: any = require('path');
function instrumentForRecording(fn: string, tscPath: string) {
instrument(tscPath, 'ts.sys = Playback.wrapSystem(ts.sys); ts.sys.startRecord("' + fn + '");', 'ts.sys.endRecord();');
instrument(tscPath, `
ts.sys = Playback.wrapSystem(ts.sys);
ts.sys.startRecord("${ fn }");`, `ts.sys.endRecord();`);
}
function instrumentForReplay(logFilename: string, tscPath: string) {
instrument(tscPath, 'ts.sys = Playback.wrapSystem(ts.sys); ts.sys.startReplay("' + logFilename + '");');
instrument(tscPath, `
ts.sys = Playback.wrapSystem(ts.sys);
ts.sys.startReplay("${ logFilename }");`);
}
function instrument(tscPath: string, prepareCode: string, cleanupCode: string = '') {
+120 -91
View File
@@ -59,6 +59,12 @@ interface IOLog {
path: string;
result?: string;
}[];
directoriesRead: {
path: string,
extension: string,
exclude: string[],
result: string[]
}[];
}
interface PlaybackControl {
@@ -95,12 +101,15 @@ module Playback {
export interface PlaybackIO extends Harness.IO, PlaybackControl { }
export interface PlaybackSystem extends ts.System, PlaybackControl { }
function createEmptyLog(): IOLog {
return {
timestamp: (new Date()).toString(),
arguments: [],
currentDirectory: "",
filesRead: [],
directoriesRead: [],
filesWritten: [],
filesDeleted: [],
filesAppended: [],
@@ -114,8 +123,10 @@ module Playback {
};
}
function initWrapper<T>(wrapper: PlaybackControl, underlying: T) {
Object.keys(underlying).forEach(prop => {
function initWrapper(wrapper: PlaybackSystem, underlying: ts.System): void;
function initWrapper(wrapper: PlaybackIO, underlying: Harness.IO): void;
function initWrapper(wrapper: PlaybackSystem | PlaybackIO, underlying: ts.System | Harness.IO): void {
ts.forEach(Object.keys(underlying), prop => {
(<any>wrapper)[prop] = (<any>underlying)[prop];
});
@@ -135,6 +146,93 @@ module Playback {
wrapper.startRecord = (fileNameBase) => {
recordLogFileNameBase = fileNameBase;
recordLog = createEmptyLog();
if (typeof underlying.args !== "function") {
recordLog.arguments = <string[]>underlying.args;
}
};
wrapper.startReplayFromFile = logFn => {
wrapper.startReplayFromString(underlying.readFile(logFn));
};
wrapper.endRecord = () => {
if (recordLog !== undefined) {
let i = 0;
let fn = () => recordLogFileNameBase + i + ".json";
while (underlying.fileExists(fn())) i++;
underlying.writeFile(fn(), JSON.stringify(recordLog));
recordLog = undefined;
}
};
wrapper.fileExists = recordReplay(wrapper.fileExists, underlying)(
path => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path }),
memoize(path => {
// If we read from the file, it must exist
if (findResultByPath(wrapper, replayLog.filesRead, path, null) !== null) {
return true;
}
else {
return findResultByFields(replayLog.fileExists, { path }, false);
}
})
);
wrapper.getExecutingFilePath = () => {
if (replayLog !== undefined) {
return replayLog.executingPath;
}
else if (recordLog !== undefined) {
return recordLog.executingPath = underlying.getExecutingFilePath();
}
else {
return underlying.getExecutingFilePath();
}
};
wrapper.getCurrentDirectory = () => {
if (replayLog !== undefined) {
return replayLog.currentDirectory || "";
}
else if (recordLog !== undefined) {
return recordLog.currentDirectory = underlying.getCurrentDirectory();
}
else {
return underlying.getCurrentDirectory();
}
};
wrapper.resolvePath = recordReplay(wrapper.resolvePath, underlying)(
path => callAndRecord(underlying.resolvePath(path), recordLog.pathsResolved, { path }),
memoize(path => findResultByFields(replayLog.pathsResolved, { path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path))));
wrapper.readFile = recordReplay(wrapper.readFile, underlying)(
path => {
let result = underlying.readFile(path);
let logEntry = { path, codepage: 0, result: { contents: result, codepage: 0 } };
recordLog.filesRead.push(logEntry);
return result;
},
memoize(path => findResultByPath(wrapper, replayLog.filesRead, path).contents));
wrapper.readDirectory = recordReplay(wrapper.readDirectory, underlying)(
(path, extension, exclude) => {
let result = (<ts.System>underlying).readDirectory(path, extension, exclude);
let logEntry = { path, extension, exclude, result };
recordLog.directoriesRead.push(logEntry);
return result;
},
(path, extension, exclude) => findResultByPath(wrapper, replayLog.directoriesRead.filter(d => d.extension === extension && ts.arrayIsEqualTo(d.exclude, exclude)), path));
wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)(
(path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path, contents, bom: false }),
(path, contents) => noOpReplay("writeFile"));
wrapper.exit = (exitCode) => {
if (recordLog !== undefined) {
wrapper.endRecord();
}
underlying.exit(exitCode);
};
}
@@ -143,9 +241,11 @@ module Playback {
return <any>(function () {
if (replayLog !== undefined) {
return replay.apply(undefined, arguments);
} else if (recordLog !== undefined) {
}
else if (recordLog !== undefined) {
return record.apply(undefined, arguments);
} else {
}
else {
return original.apply(underlying, arguments);
}
});
@@ -169,7 +269,8 @@ module Playback {
if (results.length === 0) {
if (defaultValue !== undefined) {
return defaultValue;
} else {
}
else {
throw new Error("No matching result in log array for: " + JSON.stringify(expectedFields));
}
}
@@ -177,7 +278,7 @@ module Playback {
}
function findResultByPath<T>(wrapper: { resolvePath(s: string): string }, logArray: { path: string; result?: T }[], expectedPath: string, defaultValue?: T): T {
let normalizedName = ts.normalizeSlashes(expectedPath).toLowerCase();
let normalizedName = ts.normalizePath(expectedPath).toLowerCase();
// Try to find the result through normal fileName
for (let i = 0; i < logArray.length; i++) {
if (ts.normalizeSlashes(logArray[i].path).toLowerCase() === normalizedName) {
@@ -193,10 +294,12 @@ module Playback {
}
}
}
// If we got here, we didn't find a match
if (defaultValue === undefined) {
throw new Error("No matching result in log array for path: " + expectedPath);
} else {
}
else {
return defaultValue;
}
}
@@ -214,7 +317,8 @@ module Playback {
}
if (pathEquivCache.hasOwnProperty(key)) {
return pathEquivCache[key];
} else {
}
else {
return pathEquivCache[key] = check();
}
}
@@ -227,93 +331,18 @@ module Playback {
let wrapper: PlaybackIO = <any>{};
initWrapper(wrapper, underlying);
wrapper.startReplayFromFile = logFn => {
wrapper.startReplayFromString(underlying.readFile(logFn));
};
wrapper.endRecord = () => {
if (recordLog !== undefined) {
let i = 0;
let fn = () => recordLogFileNameBase + i + ".json";
while (underlying.fileExists(fn())) i++;
underlying.writeFile(fn(), JSON.stringify(recordLog));
recordLog = undefined;
}
};
wrapper.args = () => {
if (replayLog !== undefined) {
return replayLog.arguments;
} else if (recordLog !== undefined) {
recordLog.arguments = underlying.args();
}
return underlying.args();
}
wrapper.newLine = () => underlying.newLine();
wrapper.useCaseSensitiveFileNames = () => underlying.useCaseSensitiveFileNames();
wrapper.directoryName = (path): string => { throw new Error("NotSupported"); };
wrapper.createDirectory = path => { throw new Error("NotSupported"); };
wrapper.createDirectory = (path): void => { throw new Error("NotSupported"); };
wrapper.directoryExists = (path): boolean => { throw new Error("NotSupported"); };
wrapper.deleteFile = path => { throw new Error("NotSupported"); };
wrapper.deleteFile = (path): void => { throw new Error("NotSupported"); };
wrapper.listFiles = (path, filter, options): string[] => { throw new Error("NotSupported"); };
wrapper.log = text => underlying.log(text);
wrapper.fileExists = recordReplay(wrapper.fileExists, underlying)(
(path) => callAndRecord(underlying.fileExists(path), recordLog.fileExists, { path: path }),
memoize((path) => {
// If we read from the file, it must exist
if (findResultByPath(wrapper, replayLog.filesRead, path, null) !== null) {
return true;
} else {
return findResultByFields(replayLog.fileExists, { path: path }, false);
}
})
);
wrapper.getExecutingFilePath = () => {
if (replayLog !== undefined) {
return replayLog.executingPath;
} else if (recordLog !== undefined) {
return recordLog.executingPath = underlying.getExecutingFilePath();
} else {
return underlying.getExecutingFilePath();
}
};
wrapper.getCurrentDirectory = () => {
if (replayLog !== undefined) {
return replayLog.currentDirectory || "";
} else if (recordLog !== undefined) {
return recordLog.currentDirectory = underlying.getCurrentDirectory();
} else {
return underlying.getCurrentDirectory();
}
};
wrapper.resolvePath = recordReplay(wrapper.resolvePath, underlying)(
(path) => callAndRecord(underlying.resolvePath(path), recordLog.pathsResolved, { path: path }),
memoize((path) => findResultByFields(replayLog.pathsResolved, { path: path }, !ts.isRootedDiskPath(ts.normalizeSlashes(path)) && replayLog.currentDirectory ? replayLog.currentDirectory + "/" + path : ts.normalizeSlashes(path))));
wrapper.readFile = recordReplay(wrapper.readFile, underlying)(
(path) => {
let result = underlying.readFile(path);
let logEntry = { path: path, codepage: 0, result: { contents: result, codepage: 0 } };
recordLog.filesRead.push(logEntry);
return result;
},
memoize((path) => findResultByPath(wrapper, replayLog.filesRead, path).contents));
wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)(
(path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path: path, contents: contents, bom: false }),
(path, contents) => noOpReplay("writeFile"));
wrapper.exit = (exitCode) => {
if (recordLog !== undefined) {
wrapper.endRecord();
}
underlying.exit(exitCode);
};
return wrapper;
}
export function wrapSystem(underlying: ts.System): PlaybackSystem {
let wrapper: PlaybackSystem = <any>{};
initWrapper(wrapper, underlying);
return wrapper;
}
}
+22 -2
View File
@@ -19,6 +19,11 @@ module RWC {
}
}
function isTsConfigFile(file: { path: string }): boolean {
const tsConfigFileName = "tsconfig.json";
return file.path.substr(file.path.length - tsConfigFileName.length).toLowerCase() === tsConfigFileName;
}
export function runRWCTest(jsonPath: string) {
describe("Testing a RWC project: " + jsonPath, () => {
let inputFiles: { unitName: string; content: string; }[] = [];
@@ -67,10 +72,21 @@ module RWC {
runWithIOLog(ioLog, oldIO => {
harnessCompiler.reset();
let fileNames = opts.fileNames;
let tsconfigFile = ts.forEach(ioLog.filesRead, f => isTsConfigFile(f) ? f : undefined);
if (tsconfigFile) {
let tsconfigFileContents = getHarnessCompilerInputUnit(tsconfigFile.path);
let parsedTsconfigFileContents = ts.parseConfigFileText(tsconfigFile.path, tsconfigFileContents.content);
let configParseResult = ts.parseConfigFile(parsedTsconfigFileContents.config, Harness.IO, ts.getDirectoryPath(tsconfigFile.path));
fileNames = configParseResult.fileNames;
opts.options = ts.extend(opts.options, configParseResult.options);
}
// Load the files
ts.forEach(opts.fileNames, fileName => {
for (let fileName of fileNames) {
inputFiles.push(getHarnessCompilerInputUnit(fileName));
});
}
// Add files to compilation
let isInInputList = (resolvedPath: string) => (inputFile: { unitName: string; content: string; }) => inputFile.unitName === resolvedPath;
@@ -79,6 +95,10 @@ module RWC {
const resolvedPath = ts.normalizeSlashes(Harness.IO.resolvePath(fileRead.path));
let inInputList = ts.forEach(inputFiles, isInInputList(resolvedPath));
if (isTsConfigFile(fileRead)) {
continue;
}
if (!Harness.isLibraryFile(fileRead.path)) {
if (inInputList) {
continue;
+7 -7
View File
@@ -79,7 +79,7 @@ namespace ts.server {
}
}
interface TimestampedResolvedModule extends ResolvedModule {
interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations {
lastCheckTime: number;
}
@@ -99,11 +99,11 @@ namespace ts.server {
}
}
resolveModuleNames(moduleNames: string[], containingFile: string): string[] {
resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] {
let currentResolutionsInFile = this.resolvedModuleNames.get(containingFile);
let newResolutions: Map<TimestampedResolvedModule> = {};
let resolvedFileNames: string[] = [];
let resolvedModules: ResolvedModule[] = [];
let compilerOptions = this.getCompilationSettings();
@@ -119,25 +119,25 @@ namespace ts.server {
else {
resolution = <TimestampedResolvedModule>resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost);
resolution.lastCheckTime = Date.now();
newResolutions[moduleName] = resolution;
newResolutions[moduleName] = resolution;
}
}
ts.Debug.assert(resolution !== undefined);
resolvedFileNames.push(resolution.resolvedFileName);
resolvedModules.push(resolution.resolvedModule);
}
// replace old results with a new one
this.resolvedModuleNames.set(containingFile, newResolutions);
return resolvedFileNames;
return resolvedModules;
function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean {
if (!resolution) {
return false;
}
if (resolution.resolvedFileName) {
if (resolution.resolvedModule) {
// TODO: consider checking failedLookupLocations
// TODO: use lastCheckTime to track expiration for module name resolution
return true;
+22 -2
View File
@@ -802,7 +802,7 @@ namespace ts {
public languageVariant: LanguageVariant;
public identifiers: Map<string>;
public nameTable: Map<string>;
public resolvedModules: Map<string>;
public resolvedModules: Map<ResolvedModule>;
public imports: LiteralExpression[];
private namedDeclarations: Map<Declaration[]>;
@@ -1022,7 +1022,7 @@ namespace ts {
* if implementation is omitted then language service will use built-in module resolution logic and get answers to
* host specific questions using 'getScriptSnapshot'.
*/
resolveModuleNames?(moduleNames: string[], containingFile: string): string[];
resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[];
}
//
@@ -2152,6 +2152,7 @@ namespace ts {
//
// export * from "mod"
// export {a as b} from "mod"
// export import i = require("mod")
while (token !== SyntaxKind.EndOfFileToken) {
if (token === SyntaxKind.DeclareKeyword) {
@@ -2276,6 +2277,25 @@ namespace ts {
}
}
}
else if (token === SyntaxKind.ImportKeyword) {
token = scanner.scan();
if (token === SyntaxKind.Identifier || isKeyword(token)) {
token = scanner.scan();
if (token === SyntaxKind.EqualsToken) {
token = scanner.scan();
if (token === SyntaxKind.RequireKeyword) {
token = scanner.scan();
if (token === SyntaxKind.OpenParenToken) {
token = scanner.scan();
if (token === SyntaxKind.StringLiteral) {
// export import i = require("mod");
recordModuleName();
}
}
}
}
}
}
}
token = scanner.scan();
}
+10 -3
View File
@@ -273,7 +273,7 @@ namespace ts {
private loggingEnabled = false;
private tracingEnabled = false;
public resolveModuleNames: (moduleName: string[], containingFile: string) => string[];
public resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModule[];
constructor(private shimHost: LanguageServiceShimHost) {
// if shimHost is a COM object then property check will become method call with no arguments.
@@ -281,7 +281,10 @@ namespace ts {
if ("getModuleResolutionsForFile" in this.shimHost) {
this.resolveModuleNames = (moduleNames: string[], containingFile: string) => {
let resolutionsInFile = <Map<string>>JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile));
return map(moduleNames, name => lookUp(resolutionsInFile, name));
return map(moduleNames, name => {
const result = lookUp(resolutionsInFile, name);
return result ? { resolvedFileName: result } : undefined;
});
};
}
}
@@ -942,7 +945,11 @@ namespace ts {
public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string {
return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => {
let compilerOptions = <CompilerOptions>JSON.parse(compilerOptionsJson);
return resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host);
const result = resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host);
return {
resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName: undefined,
failedLookupLocations: result.failedLookupLocations
};
});
}
@@ -4,7 +4,7 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tes
==== tests/cases/compiler/aliasAssignments_1.ts (2 errors) ====
import moduleA = require("aliasAssignments_moduleA");
import moduleA = require("./aliasAssignments_moduleA");
var x = moduleA;
x = 1; // Should be error
~
@@ -6,7 +6,7 @@ export class someClass {
}
//// [aliasAssignments_1.ts]
import moduleA = require("aliasAssignments_moduleA");
import moduleA = require("./aliasAssignments_moduleA");
var x = moduleA;
x = 1; // Should be error
var y = 1;
@@ -21,7 +21,7 @@ var someClass = (function () {
})();
exports.someClass = someClass;
//// [aliasAssignments_1.js]
var moduleA = require("aliasAssignments_moduleA");
var moduleA = require("./aliasAssignments_moduleA");
var x = moduleA;
x = 1; // Should be error
var y = 1;
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsage1_moduleA.ts]
import Backbone = require("aliasUsage1_backbone");
import Backbone = require("./aliasUsage1_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsage1_main.ts]
import Backbone = require("aliasUsage1_backbone");
import moduleA = require("aliasUsage1_moduleA");
import Backbone = require("./aliasUsage1_backbone");
import moduleA = require("./aliasUsage1_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -40,7 +40,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsage1_backbone");
var Backbone = require("./aliasUsage1_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -50,7 +50,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsage1_main.js]
var moduleA = require("aliasUsage1_moduleA");
var moduleA = require("./aliasUsage1_moduleA");
var C2 = (function () {
function C2() {
}
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsage1_main.ts ===
import Backbone = require("aliasUsage1_backbone");
import Backbone = require("./aliasUsage1_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsage1_main.ts, 0, 0))
import moduleA = require("aliasUsage1_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 50))
import moduleA = require("./aliasUsage1_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 48))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_main.ts, 2, 34))
@@ -19,7 +19,7 @@ class C2 {
x: IHasVisualizationModel;
>x : Symbol(x, Decl(aliasUsage1_main.ts, 5, 10))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 48))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50))
get A() {
>A : Symbol(A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5))
@@ -35,7 +35,7 @@ class C2 {
x = moduleA;
>x : Symbol(x, Decl(aliasUsage1_main.ts, 10, 10))
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 50))
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52))
}
}
=== tests/cases/compiler/aliasUsage1_backbone.ts ===
@@ -47,11 +47,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsage1_moduleA.ts ===
import Backbone = require("aliasUsage1_backbone");
import Backbone = require("./aliasUsage1_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 50))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 52))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsage1_main.ts ===
import Backbone = require("aliasUsage1_backbone");
import Backbone = require("./aliasUsage1_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsage1_moduleA");
import moduleA = require("./aliasUsage1_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -48,7 +48,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsage1_moduleA.ts ===
import Backbone = require("aliasUsage1_backbone");
import Backbone = require("./aliasUsage1_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsageInArray_moduleA.ts]
import Backbone = require("aliasUsageInArray_backbone");
import Backbone = require("./aliasUsageInArray_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsageInArray_main.ts]
import Backbone = require("aliasUsageInArray_backbone");
import moduleA = require("aliasUsageInArray_moduleA");
import Backbone = require("./aliasUsageInArray_backbone");
import moduleA = require("./aliasUsageInArray_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -34,7 +34,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsageInArray_backbone");
var Backbone = require("./aliasUsageInArray_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -44,6 +44,6 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInArray_main.js]
var moduleA = require("aliasUsageInArray_moduleA");
var moduleA = require("./aliasUsageInArray_moduleA");
var xs = [moduleA];
var xs2 = [moduleA];
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsageInArray_main.ts ===
import Backbone = require("aliasUsageInArray_backbone");
import Backbone = require("./aliasUsageInArray_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_main.ts, 0, 0))
import moduleA = require("aliasUsageInArray_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
import moduleA = require("./aliasUsageInArray_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 54))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_main.ts, 2, 34))
@@ -17,13 +17,13 @@ interface IHasVisualizationModel {
var xs: IHasVisualizationModel[] = [moduleA];
>xs : Symbol(xs, Decl(aliasUsageInArray_main.ts, 6, 3))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 54))
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56))
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
var xs2: typeof moduleA[] = [moduleA];
>xs2 : Symbol(xs2, Decl(aliasUsageInArray_main.ts, 7, 3))
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
=== tests/cases/compiler/aliasUsageInArray_backbone.ts ===
export class Model {
@@ -34,11 +34,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInArray_moduleA.ts ===
import Backbone = require("aliasUsageInArray_backbone");
import Backbone = require("./aliasUsageInArray_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_moduleA.ts, 0, 56))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_moduleA.ts, 0, 58))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsageInArray_main.ts ===
import Backbone = require("aliasUsageInArray_backbone");
import Backbone = require("./aliasUsageInArray_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsageInArray_moduleA");
import moduleA = require("./aliasUsageInArray_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -36,7 +36,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInArray_moduleA.ts ===
import Backbone = require("aliasUsageInArray_backbone");
import Backbone = require("./aliasUsageInArray_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsageInFunctionExpression_moduleA.ts]
import Backbone = require("aliasUsageInFunctionExpression_backbone");
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsageInFunctionExpression_main.ts]
import Backbone = require("aliasUsageInFunctionExpression_backbone");
import moduleA = require("aliasUsageInFunctionExpression_moduleA");
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
import moduleA = require("./aliasUsageInFunctionExpression_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -33,7 +33,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsageInFunctionExpression_backbone");
var Backbone = require("./aliasUsageInFunctionExpression_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -43,6 +43,6 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInFunctionExpression_main.js]
var moduleA = require("aliasUsageInFunctionExpression_moduleA");
var moduleA = require("./aliasUsageInFunctionExpression_moduleA");
var f = function (x) { return x; };
f = function (x) { return moduleA; };
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsageInFunctionExpression_main.ts ===
import Backbone = require("aliasUsageInFunctionExpression_backbone");
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_main.ts, 0, 0))
import moduleA = require("aliasUsageInFunctionExpression_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 69))
import moduleA = require("./aliasUsageInFunctionExpression_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 71))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 67))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 69))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 2, 34))
@@ -17,13 +17,13 @@ interface IHasVisualizationModel {
var f = (x: IHasVisualizationModel) => x;
>f : Symbol(f, Decl(aliasUsageInFunctionExpression_main.ts, 5, 3))
>x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 5, 9))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 67))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInFunctionExpression_main.ts, 1, 69))
>x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 5, 9))
f = (x) => moduleA;
>f : Symbol(f, Decl(aliasUsageInFunctionExpression_main.ts, 5, 3))
>x : Symbol(x, Decl(aliasUsageInFunctionExpression_main.ts, 6, 5))
>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 69))
>moduleA : Symbol(moduleA, Decl(aliasUsageInFunctionExpression_main.ts, 0, 71))
=== tests/cases/compiler/aliasUsageInFunctionExpression_backbone.ts ===
export class Model {
@@ -34,11 +34,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInFunctionExpression_moduleA.ts ===
import Backbone = require("aliasUsageInFunctionExpression_backbone");
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 69))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 71))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsageInFunctionExpression_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsageInFunctionExpression_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsageInFunctionExpression_main.ts ===
import Backbone = require("aliasUsageInFunctionExpression_backbone");
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsageInFunctionExpression_moduleA");
import moduleA = require("./aliasUsageInFunctionExpression_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -37,7 +37,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInFunctionExpression_moduleA.ts ===
import Backbone = require("aliasUsageInFunctionExpression_backbone");
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsageInGenericFunction_moduleA.ts]
import Backbone = require("aliasUsageInGenericFunction_backbone");
import Backbone = require("./aliasUsageInGenericFunction_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsageInGenericFunction_main.ts]
import Backbone = require("aliasUsageInGenericFunction_backbone");
import moduleA = require("aliasUsageInGenericFunction_moduleA");
import Backbone = require("./aliasUsageInGenericFunction_backbone");
import moduleA = require("./aliasUsageInGenericFunction_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsageInGenericFunction_backbone");
var Backbone = require("./aliasUsageInGenericFunction_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -47,7 +47,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInGenericFunction_main.js]
var moduleA = require("aliasUsageInGenericFunction_moduleA");
var moduleA = require("./aliasUsageInGenericFunction_moduleA");
function foo(x) {
return x;
}
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsageInGenericFunction_main.ts ===
import Backbone = require("aliasUsageInGenericFunction_backbone");
import Backbone = require("./aliasUsageInGenericFunction_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_main.ts, 0, 0))
import moduleA = require("aliasUsageInGenericFunction_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 66))
import moduleA = require("./aliasUsageInGenericFunction_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 68))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 2, 34))
@@ -18,7 +18,7 @@ function foo<T extends { a: IHasVisualizationModel }>(x: T) {
>foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1))
>T : Symbol(T, Decl(aliasUsageInGenericFunction_main.ts, 5, 13))
>a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 5, 24))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66))
>x : Symbol(x, Decl(aliasUsageInGenericFunction_main.ts, 5, 54))
>T : Symbol(T, Decl(aliasUsageInGenericFunction_main.ts, 5, 13))
@@ -29,13 +29,13 @@ var r = foo({ a: moduleA });
>r : Symbol(r, Decl(aliasUsageInGenericFunction_main.ts, 8, 3))
>foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1))
>a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 8, 13))
>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 66))
>moduleA : Symbol(moduleA, Decl(aliasUsageInGenericFunction_main.ts, 0, 68))
var r2 = foo({ a: <IHasVisualizationModel>null });
>r2 : Symbol(r2, Decl(aliasUsageInGenericFunction_main.ts, 9, 3))
>foo : Symbol(foo, Decl(aliasUsageInGenericFunction_main.ts, 4, 1))
>a : Symbol(a, Decl(aliasUsageInGenericFunction_main.ts, 9, 14))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 64))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInGenericFunction_main.ts, 1, 66))
=== tests/cases/compiler/aliasUsageInGenericFunction_backbone.ts ===
export class Model {
@@ -46,11 +46,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInGenericFunction_moduleA.ts ===
import Backbone = require("aliasUsageInGenericFunction_backbone");
import Backbone = require("./aliasUsageInGenericFunction_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 66))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 68))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsageInGenericFunction_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsageInGenericFunction_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsageInGenericFunction_main.ts ===
import Backbone = require("aliasUsageInGenericFunction_backbone");
import Backbone = require("./aliasUsageInGenericFunction_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsageInGenericFunction_moduleA");
import moduleA = require("./aliasUsageInGenericFunction_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -52,7 +52,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInGenericFunction_moduleA.ts ===
import Backbone = require("aliasUsageInGenericFunction_backbone");
import Backbone = require("./aliasUsageInGenericFunction_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsageInIndexerOfClass_moduleA.ts]
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsageInIndexerOfClass_main.ts]
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
import moduleA = require("aliasUsageInIndexerOfClass_moduleA");
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
import moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -39,7 +39,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsageInIndexerOfClass_backbone");
var Backbone = require("./aliasUsageInIndexerOfClass_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -49,7 +49,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInIndexerOfClass_main.js]
var moduleA = require("aliasUsageInIndexerOfClass_moduleA");
var moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
var N = (function () {
function N() {
this.x = moduleA;
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsageInIndexerOfClass_main.ts ===
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 0))
import moduleA = require("aliasUsageInIndexerOfClass_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65))
import moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 2, 34))
@@ -19,22 +19,22 @@ class N {
[idx: string]: IHasVisualizationModel
>idx : Symbol(idx, Decl(aliasUsageInIndexerOfClass_main.ts, 6, 5))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65))
x = moduleA;
>x : Symbol(x, Decl(aliasUsageInIndexerOfClass_main.ts, 6, 41))
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65))
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67))
}
class N2 {
>N2 : Symbol(N2, Decl(aliasUsageInIndexerOfClass_main.ts, 8, 1))
[idx: string]: typeof moduleA
>idx : Symbol(idx, Decl(aliasUsageInIndexerOfClass_main.ts, 10, 5))
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 65))
>moduleA : Symbol(moduleA, Decl(aliasUsageInIndexerOfClass_main.ts, 0, 67))
x: IHasVisualizationModel;
>x : Symbol(x, Decl(aliasUsageInIndexerOfClass_main.ts, 10, 33))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 63))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInIndexerOfClass_main.ts, 1, 65))
}
=== tests/cases/compiler/aliasUsageInIndexerOfClass_backbone.ts ===
export class Model {
@@ -45,11 +45,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA.ts ===
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 65))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 67))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsageInIndexerOfClass_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsageInIndexerOfClass_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsageInIndexerOfClass_main.ts ===
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsageInIndexerOfClass_moduleA");
import moduleA = require("./aliasUsageInIndexerOfClass_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -45,7 +45,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInIndexerOfClass_moduleA.ts ===
import Backbone = require("aliasUsageInIndexerOfClass_backbone");
import Backbone = require("./aliasUsageInIndexerOfClass_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsageInObjectLiteral_moduleA.ts]
import Backbone = require("aliasUsageInObjectLiteral_backbone");
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsageInObjectLiteral_main.ts]
import Backbone = require("aliasUsageInObjectLiteral_backbone");
import moduleA = require("aliasUsageInObjectLiteral_moduleA");
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
import moduleA = require("./aliasUsageInObjectLiteral_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -34,7 +34,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsageInObjectLiteral_backbone");
var Backbone = require("./aliasUsageInObjectLiteral_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -44,7 +44,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInObjectLiteral_main.js]
var moduleA = require("aliasUsageInObjectLiteral_moduleA");
var moduleA = require("./aliasUsageInObjectLiteral_moduleA");
var a = { x: moduleA };
var b = { x: moduleA };
var c = { y: { z: moduleA } };
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsageInObjectLiteral_main.ts ===
import Backbone = require("aliasUsageInObjectLiteral_backbone");
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_main.ts, 0, 0))
import moduleA = require("aliasUsageInObjectLiteral_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
import moduleA = require("./aliasUsageInObjectLiteral_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 2, 34))
@@ -17,25 +17,25 @@ interface IHasVisualizationModel {
var a: { x: typeof moduleA } = { x: moduleA };
>a : Symbol(a, Decl(aliasUsageInObjectLiteral_main.ts, 5, 3))
>x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 5, 8))
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
>x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 5, 32))
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
var b: { x: IHasVisualizationModel } = { x: moduleA };
>b : Symbol(b, Decl(aliasUsageInObjectLiteral_main.ts, 6, 3))
>x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 6, 8))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64))
>x : Symbol(x, Decl(aliasUsageInObjectLiteral_main.ts, 6, 40))
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
var c: { y: { z: IHasVisualizationModel } } = { y: { z: moduleA } };
>c : Symbol(c, Decl(aliasUsageInObjectLiteral_main.ts, 7, 3))
>y : Symbol(y, Decl(aliasUsageInObjectLiteral_main.ts, 7, 8))
>z : Symbol(z, Decl(aliasUsageInObjectLiteral_main.ts, 7, 13))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 62))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInObjectLiteral_main.ts, 1, 64))
>y : Symbol(y, Decl(aliasUsageInObjectLiteral_main.ts, 7, 47))
>z : Symbol(z, Decl(aliasUsageInObjectLiteral_main.ts, 7, 52))
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 64))
>moduleA : Symbol(moduleA, Decl(aliasUsageInObjectLiteral_main.ts, 0, 66))
=== tests/cases/compiler/aliasUsageInObjectLiteral_backbone.ts ===
export class Model {
@@ -46,11 +46,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInObjectLiteral_moduleA.ts ===
import Backbone = require("aliasUsageInObjectLiteral_backbone");
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 64))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 66))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsageInObjectLiteral_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsageInObjectLiteral_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsageInObjectLiteral_main.ts ===
import Backbone = require("aliasUsageInObjectLiteral_backbone");
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsageInObjectLiteral_moduleA");
import moduleA = require("./aliasUsageInObjectLiteral_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -50,7 +50,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInObjectLiteral_moduleA.ts ===
import Backbone = require("aliasUsageInObjectLiteral_backbone");
import Backbone = require("./aliasUsageInObjectLiteral_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsageInOrExpression_moduleA.ts]
import Backbone = require("aliasUsageInOrExpression_backbone");
import Backbone = require("./aliasUsageInOrExpression_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsageInOrExpression_main.ts]
import Backbone = require("aliasUsageInOrExpression_backbone");
import moduleA = require("aliasUsageInOrExpression_moduleA");
import Backbone = require("./aliasUsageInOrExpression_backbone");
import moduleA = require("./aliasUsageInOrExpression_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsageInOrExpression_backbone");
var Backbone = require("./aliasUsageInOrExpression_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -47,7 +47,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInOrExpression_main.js]
var moduleA = require("aliasUsageInOrExpression_moduleA");
var moduleA = require("./aliasUsageInOrExpression_moduleA");
var i;
var d1 = i || moduleA;
var d2 = i || moduleA;
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsageInOrExpression_main.ts ===
import Backbone = require("aliasUsageInOrExpression_backbone");
import Backbone = require("./aliasUsageInOrExpression_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_main.ts, 0, 0))
import moduleA = require("aliasUsageInOrExpression_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
import moduleA = require("./aliasUsageInOrExpression_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 2, 34))
@@ -16,42 +16,42 @@ interface IHasVisualizationModel {
}
var i: IHasVisualizationModel;
>i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
var d1 = i || moduleA;
>d1 : Symbol(d1, Decl(aliasUsageInOrExpression_main.ts, 6, 3))
>i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
var d2: IHasVisualizationModel = i || moduleA;
>d2 : Symbol(d2, Decl(aliasUsageInOrExpression_main.ts, 7, 3), Decl(aliasUsageInOrExpression_main.ts, 8, 3))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
>i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
var d2: IHasVisualizationModel = moduleA || i;
>d2 : Symbol(d2, Decl(aliasUsageInOrExpression_main.ts, 7, 3), Decl(aliasUsageInOrExpression_main.ts, 8, 3))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
>i : Symbol(i, Decl(aliasUsageInOrExpression_main.ts, 5, 3))
var e: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null || { x: moduleA };
>e : Symbol(e, Decl(aliasUsageInOrExpression_main.ts, 9, 3))
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 8))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 41))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 9, 79))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x: moduleA } : null;
>f : Symbol(f, Decl(aliasUsageInOrExpression_main.ts, 10, 3))
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 8))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 41))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 61))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInOrExpression_main.ts, 1, 63))
>x : Symbol(x, Decl(aliasUsageInOrExpression_main.ts, 10, 78))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 63))
>moduleA : Symbol(moduleA, Decl(aliasUsageInOrExpression_main.ts, 0, 65))
=== tests/cases/compiler/aliasUsageInOrExpression_backbone.ts ===
export class Model {
@@ -62,11 +62,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts ===
import Backbone = require("aliasUsageInOrExpression_backbone");
import Backbone = require("./aliasUsageInOrExpression_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 63))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 65))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsageInOrExpression_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsageInOrExpression_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsageInOrExpression_main.ts ===
import Backbone = require("aliasUsageInOrExpression_backbone");
import Backbone = require("./aliasUsageInOrExpression_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsageInOrExpression_moduleA");
import moduleA = require("./aliasUsageInOrExpression_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -74,7 +74,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts ===
import Backbone = require("aliasUsageInOrExpression_backbone");
import Backbone = require("./aliasUsageInOrExpression_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts]
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsageInTypeArgumentOfExtendsClause_main.ts]
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA");
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -37,7 +37,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -52,7 +52,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA");
var moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
var C = (function () {
function C() {
}
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_main.ts ===
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 0))
import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 78))
import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 80))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 2, 34))
@@ -17,7 +17,7 @@ interface IHasVisualizationModel {
class C<T extends IHasVisualizationModel> {
>C : Symbol(C, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 4, 1))
>T : Symbol(T, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 8))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78))
x: T;
>x : Symbol(x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 5, 43))
@@ -26,11 +26,11 @@ class C<T extends IHasVisualizationModel> {
class D extends C<IHasVisualizationModel> {
>D : Symbol(D, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 7, 1))
>C : Symbol(C, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 4, 1))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 76))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 1, 78))
x = moduleA;
>x : Symbol(x, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 8, 43))
>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 78))
>moduleA : Symbol(moduleA, Decl(aliasUsageInTypeArgumentOfExtendsClause_main.ts, 0, 80))
}
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_backbone.ts ===
export class Model {
@@ -41,11 +41,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts ===
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 78))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 80))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsageInTypeArgumentOfExtendsClause_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_main.ts ===
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsageInTypeArgumentOfExtendsClause_moduleA");
import moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -41,7 +41,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInTypeArgumentOfExtendsClause_moduleA.ts ===
import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
import Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -6,14 +6,14 @@ export class Model {
}
//// [aliasUsageInVarAssignment_moduleA.ts]
import Backbone = require("aliasUsageInVarAssignment_backbone");
import Backbone = require("./aliasUsageInVarAssignment_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsageInVarAssignment_main.ts]
import Backbone = require("aliasUsageInVarAssignment_backbone");
import moduleA = require("aliasUsageInVarAssignment_moduleA");
import Backbone = require("./aliasUsageInVarAssignment_backbone");
import moduleA = require("./aliasUsageInVarAssignment_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
@@ -33,7 +33,7 @@ var __extends = (this && this.__extends) || function (d, b) {
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Backbone = require("aliasUsageInVarAssignment_backbone");
var Backbone = require("./aliasUsageInVarAssignment_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
@@ -1,12 +1,12 @@
=== tests/cases/compiler/aliasUsageInVarAssignment_main.ts ===
import Backbone = require("aliasUsageInVarAssignment_backbone");
import Backbone = require("./aliasUsageInVarAssignment_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_main.ts, 0, 0))
import moduleA = require("aliasUsageInVarAssignment_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 64))
import moduleA = require("./aliasUsageInVarAssignment_moduleA");
>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 66))
interface IHasVisualizationModel {
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 62))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 64))
VisualizationModel: typeof Backbone.Model;
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 2, 34))
@@ -16,11 +16,11 @@ interface IHasVisualizationModel {
}
var i: IHasVisualizationModel;
>i : Symbol(i, Decl(aliasUsageInVarAssignment_main.ts, 5, 3))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 62))
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInVarAssignment_main.ts, 1, 64))
var m: typeof moduleA = i;
>m : Symbol(m, Decl(aliasUsageInVarAssignment_main.ts, 6, 3))
>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 64))
>moduleA : Symbol(moduleA, Decl(aliasUsageInVarAssignment_main.ts, 0, 66))
>i : Symbol(i, Decl(aliasUsageInVarAssignment_main.ts, 5, 3))
=== tests/cases/compiler/aliasUsageInVarAssignment_backbone.ts ===
@@ -32,11 +32,11 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInVarAssignment_moduleA.ts ===
import Backbone = require("aliasUsageInVarAssignment_backbone");
import Backbone = require("./aliasUsageInVarAssignment_backbone");
>Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 0))
export class VisualizationModel extends Backbone.Model {
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 64))
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 66))
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0))
>Backbone : Symbol(Backbone, Decl(aliasUsageInVarAssignment_moduleA.ts, 0, 0))
>Model : Symbol(Backbone.Model, Decl(aliasUsageInVarAssignment_backbone.ts, 0, 0))
@@ -1,8 +1,8 @@
=== tests/cases/compiler/aliasUsageInVarAssignment_main.ts ===
import Backbone = require("aliasUsageInVarAssignment_backbone");
import Backbone = require("./aliasUsageInVarAssignment_backbone");
>Backbone : typeof Backbone
import moduleA = require("aliasUsageInVarAssignment_moduleA");
import moduleA = require("./aliasUsageInVarAssignment_moduleA");
>moduleA : typeof moduleA
interface IHasVisualizationModel {
@@ -32,7 +32,7 @@ export class Model {
}
=== tests/cases/compiler/aliasUsageInVarAssignment_moduleA.ts ===
import Backbone = require("aliasUsageInVarAssignment_backbone");
import Backbone = require("./aliasUsageInVarAssignment_backbone");
>Backbone : typeof Backbone
export class VisualizationModel extends Backbone.Model {
@@ -9,8 +9,8 @@ export function b(a: any): any { return null; }
//// [aliasUsedAsNameValue_2.ts]
///<reference path='aliasUsedAsNameValue_0.ts' />
///<reference path='aliasUsedAsNameValue_1.ts' />
import mod = require("aliasUsedAsNameValue_0");
import b = require("aliasUsedAsNameValue_1");
import mod = require("./aliasUsedAsNameValue_0");
import b = require("./aliasUsedAsNameValue_1");
export var a = function () {
//var x = mod.id; // TODO needed hack that mod is loaded
@@ -25,8 +25,8 @@ exports.b = b;
//// [aliasUsedAsNameValue_2.js]
///<reference path='aliasUsedAsNameValue_0.ts' />
///<reference path='aliasUsedAsNameValue_1.ts' />
var mod = require("aliasUsedAsNameValue_0");
var b = require("aliasUsedAsNameValue_1");
var mod = require("./aliasUsedAsNameValue_0");
var b = require("./aliasUsedAsNameValue_1");
exports.a = function () {
//var x = mod.id; // TODO needed hack that mod is loaded
b.b(mod);
@@ -1,11 +1,11 @@
=== tests/cases/compiler/aliasUsedAsNameValue_2.ts ===
///<reference path='aliasUsedAsNameValue_0.ts' />
///<reference path='aliasUsedAsNameValue_1.ts' />
import mod = require("aliasUsedAsNameValue_0");
import mod = require("./aliasUsedAsNameValue_0");
>mod : Symbol(mod, Decl(aliasUsedAsNameValue_2.ts, 0, 0))
import b = require("aliasUsedAsNameValue_1");
>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 47))
import b = require("./aliasUsedAsNameValue_1");
>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 49))
export var a = function () {
>a : Symbol(a, Decl(aliasUsedAsNameValue_2.ts, 5, 10))
@@ -13,7 +13,7 @@ export var a = function () {
//var x = mod.id; // TODO needed hack that mod is loaded
b.b(mod);
>b.b : Symbol(b.b, Decl(aliasUsedAsNameValue_1.ts, 0, 0))
>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 47))
>b : Symbol(b, Decl(aliasUsedAsNameValue_2.ts, 2, 49))
>b : Symbol(b.b, Decl(aliasUsedAsNameValue_1.ts, 0, 0))
>mod : Symbol(mod, Decl(aliasUsedAsNameValue_2.ts, 0, 0))
}
@@ -1,10 +1,10 @@
=== tests/cases/compiler/aliasUsedAsNameValue_2.ts ===
///<reference path='aliasUsedAsNameValue_0.ts' />
///<reference path='aliasUsedAsNameValue_1.ts' />
import mod = require("aliasUsedAsNameValue_0");
import mod = require("./aliasUsedAsNameValue_0");
>mod : typeof mod
import b = require("aliasUsedAsNameValue_1");
import b = require("./aliasUsedAsNameValue_1");
>b : typeof b
export var a = function () {
@@ -2,7 +2,7 @@ tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts
==== tests/cases/compiler/aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts (1 errors) ====
import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
var d = b.q3;
~
!!! error TS2304: Cannot find name 'b'.
@@ -7,7 +7,7 @@ interface c {
export = c;
//// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_1.ts]
import moduleA = require("aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
import moduleA = require("./aliasWithInterfaceExportAssignmentUsedInVarInitializer_0");
var d = b.q3;
//// [aliasWithInterfaceExportAssignmentUsedInVarInitializer_0.js]
@@ -9,7 +9,7 @@ export = Car;
//// [arrayOfExportedClass_1.ts]
///<reference path='arrayOfExportedClass_0.ts'/>
import Car = require('arrayOfExportedClass_0');
import Car = require('./arrayOfExportedClass_0');
class Road {
@@ -1,10 +1,10 @@
=== tests/cases/compiler/arrayOfExportedClass_1.ts ===
///<reference path='arrayOfExportedClass_0.ts'/>
import Car = require('arrayOfExportedClass_0');
import Car = require('./arrayOfExportedClass_0');
>Car : Symbol(Car, Decl(arrayOfExportedClass_1.ts, 0, 0))
class Road {
>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47))
>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49))
public cars: Car[];
>cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12))
@@ -17,14 +17,14 @@ class Road {
this.cars = cars;
>this.cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12))
>this : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47))
>this : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49))
>cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 3, 12))
>cars : Symbol(cars, Decl(arrayOfExportedClass_1.ts, 7, 19))
}
}
export = Road;
>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 47))
>Road : Symbol(Road, Decl(arrayOfExportedClass_1.ts, 1, 49))
=== tests/cases/compiler/arrayOfExportedClass_0.ts ===
class Car {
@@ -1,6 +1,6 @@
=== tests/cases/compiler/arrayOfExportedClass_1.ts ===
///<reference path='arrayOfExportedClass_0.ts'/>
import Car = require('arrayOfExportedClass_0');
import Car = require('./arrayOfExportedClass_0');
>Car : typeof Car
class Road {
@@ -100,12 +100,12 @@ var p8 = ({ a = 1 }) => { };
>1 : number
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b?: number; }; }) => void
>a : any
>b : number
>1 : number
>{ b: 1 } : { b: number; }
>{ b: 1 } : { b?: number; }
>b : number
>1 : number
@@ -6,7 +6,7 @@ export module m {
}
//// [chainedImportAlias_file1.ts]
import x = require('chainedImportAlias_file0');
import x = require('./chainedImportAlias_file0');
import y = x;
y.m.foo();
@@ -18,6 +18,6 @@ var m;
m.foo = foo;
})(m = exports.m || (exports.m = {}));
//// [chainedImportAlias_file1.js]
var x = require('chainedImportAlias_file0');
var x = require('./chainedImportAlias_file0');
var y = x;
y.m.foo();
@@ -1,15 +1,15 @@
=== tests/cases/compiler/chainedImportAlias_file1.ts ===
import x = require('chainedImportAlias_file0');
import x = require('./chainedImportAlias_file0');
>x : Symbol(x, Decl(chainedImportAlias_file1.ts, 0, 0))
import y = x;
>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 47))
>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 49))
>x : Symbol(x, Decl(chainedImportAlias_file0.ts, 0, 0))
y.m.foo();
>y.m.foo : Symbol(x.m.foo, Decl(chainedImportAlias_file0.ts, 0, 17))
>y.m : Symbol(x.m, Decl(chainedImportAlias_file0.ts, 0, 0))
>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 47))
>y : Symbol(y, Decl(chainedImportAlias_file1.ts, 0, 49))
>m : Symbol(x.m, Decl(chainedImportAlias_file0.ts, 0, 0))
>foo : Symbol(x.m.foo, Decl(chainedImportAlias_file0.ts, 0, 17))
@@ -1,5 +1,5 @@
=== tests/cases/compiler/chainedImportAlias_file1.ts ===
import x = require('chainedImportAlias_file0');
import x = require('./chainedImportAlias_file0');
>x : typeof x
import y = x;
@@ -54,7 +54,7 @@ var myvar2 = new m4.m2.c();
//// [commentsExternalModules_1.ts]
/**This is on import declaration*/
import extMod = require("commentsExternalModules2_0"); // trailing comment 1
import extMod = require("./commentsExternalModules2_0"); // trailing comment 1
extMod.m1.fooExport();
export var newVar = new extMod.m1.m2.c();
extMod.m4.fooExport();
@@ -124,7 +124,7 @@ m4.fooExport();
var myvar2 = new m4.m2.c();
//// [commentsExternalModules_1.js]
/**This is on import declaration*/
var extMod = require("commentsExternalModules2_0"); // trailing comment 1
var extMod = require("./commentsExternalModules2_0"); // trailing comment 1
extMod.m1.fooExport();
exports.newVar = new extMod.m1.m2.c();
extMod.m4.fooExport();
@@ -165,6 +165,6 @@ export declare module m4 {
}
//// [commentsExternalModules_1.d.ts]
/**This is on import declaration*/
import extMod = require("commentsExternalModules2_0");
import extMod = require("./commentsExternalModules2_0");
export declare var newVar: extMod.m1.m2.c;
export declare var newVar2: extMod.m4.m2.c;
@@ -1,6 +1,6 @@
=== tests/cases/compiler/commentsExternalModules_1.ts ===
/**This is on import declaration*/
import extMod = require("commentsExternalModules2_0"); // trailing comment 1
import extMod = require("./commentsExternalModules2_0"); // trailing comment 1
>extMod : Symbol(extMod, Decl(commentsExternalModules_1.ts, 0, 0))
extMod.m1.fooExport();
@@ -1,6 +1,6 @@
=== tests/cases/compiler/commentsExternalModules_1.ts ===
/**This is on import declaration*/
import extMod = require("commentsExternalModules2_0"); // trailing comment 1
import extMod = require("./commentsExternalModules2_0"); // trailing comment 1
>extMod : typeof extMod
extMod.m1.fooExport();
@@ -6,7 +6,7 @@ export class Foo { }
//// [declFileAliasUseBeforeDeclaration_test.ts]
export function bar(a: foo.Foo) { }
import foo = require("declFileAliasUseBeforeDeclaration_foo");
import foo = require("./declFileAliasUseBeforeDeclaration_foo");
//// [declFileAliasUseBeforeDeclaration_foo.js]
var Foo = (function () {
@@ -25,4 +25,4 @@ export declare class Foo {
}
//// [declFileAliasUseBeforeDeclaration_test.d.ts]
export declare function bar(a: foo.Foo): void;
import foo = require("declFileAliasUseBeforeDeclaration_foo");
import foo = require("./declFileAliasUseBeforeDeclaration_foo");
@@ -5,7 +5,7 @@ export function bar(a: foo.Foo) { }
>foo : Symbol(foo, Decl(declFileAliasUseBeforeDeclaration_test.ts, 0, 35))
>Foo : Symbol(foo.Foo, Decl(declFileAliasUseBeforeDeclaration_foo.ts, 0, 0))
import foo = require("declFileAliasUseBeforeDeclaration_foo");
import foo = require("./declFileAliasUseBeforeDeclaration_foo");
>foo : Symbol(foo, Decl(declFileAliasUseBeforeDeclaration_test.ts, 0, 35))
=== tests/cases/compiler/declFileAliasUseBeforeDeclaration_foo.ts ===
@@ -5,7 +5,7 @@ export function bar(a: foo.Foo) { }
>foo : any
>Foo : foo.Foo
import foo = require("declFileAliasUseBeforeDeclaration_foo");
import foo = require("./declFileAliasUseBeforeDeclaration_foo");
>foo : typeof foo
=== tests/cases/compiler/declFileAliasUseBeforeDeclaration_foo.ts ===
@@ -5,7 +5,7 @@ export var x: number;
//// [declFileForExportedImport_1.ts]
///<reference path='declFileForExportedImport_0.ts'/>
export import a = require('declFileForExportedImport_0');
export import a = require('./declFileForExportedImport_0');
var y = a.x;
export import b = a;
@@ -14,7 +14,7 @@ var z = b.x;
//// [declFileForExportedImport_0.js]
//// [declFileForExportedImport_1.js]
///<reference path='declFileForExportedImport_0.ts'/>
exports.a = require('declFileForExportedImport_0');
exports.a = require('./declFileForExportedImport_0');
var y = exports.a.x;
exports.b = exports.a;
var z = exports.b.x;
@@ -24,5 +24,5 @@ var z = exports.b.x;
export declare var x: number;
//// [declFileForExportedImport_1.d.ts]
/// <reference path="declFileForExportedImport_0.d.ts" />
export import a = require('declFileForExportedImport_0');
export import a = require('./declFileForExportedImport_0');
export import b = a;
@@ -1,6 +1,6 @@
=== tests/cases/compiler/declFileForExportedImport_1.ts ===
///<reference path='declFileForExportedImport_0.ts'/>
export import a = require('declFileForExportedImport_0');
export import a = require('./declFileForExportedImport_0');
>a : Symbol(a, Decl(declFileForExportedImport_1.ts, 0, 0))
var y = a.x;
@@ -1,6 +1,6 @@
=== tests/cases/compiler/declFileForExportedImport_1.ts ===
///<reference path='declFileForExportedImport_0.ts'/>
export import a = require('declFileForExportedImport_0');
export import a = require('./declFileForExportedImport_0');
>a : typeof a
var y = a.x;
@@ -21,7 +21,7 @@ export = m2;
//// [declFileImportModuleWithExportAssignment_1.ts]
/**This is on import declaration*/
import a1 = require("declFileImportModuleWithExportAssignment_0");
import a1 = require("./declFileImportModuleWithExportAssignment_0");
export var a = a1;
a.test1(null, null, null);
@@ -31,7 +31,7 @@ var m2;
module.exports = m2;
//// [declFileImportModuleWithExportAssignment_1.js]
/**This is on import declaration*/
var a1 = require("declFileImportModuleWithExportAssignment_0");
var a1 = require("./declFileImportModuleWithExportAssignment_0");
exports.a = a1;
exports.a.test1(null, null, null);
@@ -54,7 +54,7 @@ declare var m2: {
export = m2;
//// [declFileImportModuleWithExportAssignment_1.d.ts]
/**This is on import declaration*/
import a1 = require("declFileImportModuleWithExportAssignment_0");
import a1 = require("./declFileImportModuleWithExportAssignment_0");
export declare var a: {
(): a1.connectExport;
test1: a1.connectModule;
@@ -1,6 +1,6 @@
=== tests/cases/compiler/declFileImportModuleWithExportAssignment_1.ts ===
/**This is on import declaration*/
import a1 = require("declFileImportModuleWithExportAssignment_0");
import a1 = require("./declFileImportModuleWithExportAssignment_0");
>a1 : Symbol(a1, Decl(declFileImportModuleWithExportAssignment_1.ts, 0, 0))
export var a = a1;
@@ -1,6 +1,6 @@
=== tests/cases/compiler/declFileImportModuleWithExportAssignment_1.ts ===
/**This is on import declaration*/
import a1 = require("declFileImportModuleWithExportAssignment_0");
import a1 = require("./declFileImportModuleWithExportAssignment_0");
>a1 : { (): a1.connectExport; test1: a1.connectModule; test2(): a1.connectModule; }
export var a = a1;
@@ -21,8 +21,8 @@ function h1(_a) {
//// [declarationEmitDestructuring2.d.ts]
declare function f({x, y: [a, b, c, d]}?: {
x: number;
y: [number, number, number, number];
x?: number;
y?: [number, number, number, number];
}): void;
declare function g([a, b, c, d]?: [number, number, number, number]): void;
declare function h([a, [b], [[c]], {x, y: [a, b, c], z: {a1, b1}}]: [any, [any], [[any]], {
@@ -0,0 +1,17 @@
tests/cases/compiler/declarationEmitDestructuring4.ts(9,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
==== tests/cases/compiler/declarationEmitDestructuring4.ts (1 errors) ====
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
function baz1([] = [1,2,3]) { }
function baz2([[]] = [[1,2,3]]) { }
function baz3({}) { }
function baz4({} = { x: 10 }) { }
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
@@ -1,21 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuring4.ts ===
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
>baz : Symbol(baz, Decl(declarationEmitDestructuring4.ts, 0, 0))
function baz1([] = [1,2,3]) { }
>baz1 : Symbol(baz1, Decl(declarationEmitDestructuring4.ts, 3, 20))
function baz2([[]] = [[1,2,3]]) { }
>baz2 : Symbol(baz2, Decl(declarationEmitDestructuring4.ts, 4, 31))
function baz3({}) { }
>baz3 : Symbol(baz3, Decl(declarationEmitDestructuring4.ts, 5, 35))
function baz4({} = { x: 10 }) { }
>baz4 : Symbol(baz4, Decl(declarationEmitDestructuring4.ts, 7, 21))
>x : Symbol(x, Decl(declarationEmitDestructuring4.ts, 8, 20))
@@ -1,32 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuring4.ts ===
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz([]) { }
>baz : ([]: any[]) => void
function baz1([] = [1,2,3]) { }
>baz1 : ([]?: number[]) => void
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
function baz2([[]] = [[1,2,3]]) { }
>baz2 : ([[]]?: [number[]]) => void
>[[1,2,3]] : [number[]]
>[1,2,3] : number[]
>1 : number
>2 : number
>3 : number
function baz3({}) { }
>baz3 : ({}: {}) => void
function baz4({} = { x: 10 }) { }
>baz4 : ({}?: { x: number; }) => void
>{ x: 10 } : { x: number; }
>x : number
>10 : number
@@ -0,0 +1,22 @@
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,6): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts(4,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
==== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts (3 errors) ====
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
var [x11 = 0, y11 = ""] = [1, "hello"];
var [a11, b11, c11] = [];
~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~~~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
var [x13, y13] = [1, "hello"];
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
@@ -1,40 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts ===
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
>x10 : Symbol(x10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 5))
>y10 : Symbol(y10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 11))
>z10 : Symbol(z10, Decl(declarationEmitDestructuringArrayPattern2.ts, 0, 17))
var [x11 = 0, y11 = ""] = [1, "hello"];
>x11 : Symbol(x11, Decl(declarationEmitDestructuringArrayPattern2.ts, 2, 5))
>y11 : Symbol(y11, Decl(declarationEmitDestructuringArrayPattern2.ts, 2, 13))
var [a11, b11, c11] = [];
>a11 : Symbol(a11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 5))
>b11 : Symbol(b11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 9))
>c11 : Symbol(c11, Decl(declarationEmitDestructuringArrayPattern2.ts, 3, 14))
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
>a2 : Symbol(a2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 5))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 10))
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 15))
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91))
>c2 : Symbol(c2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 20))
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 41))
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 50))
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 83))
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91))
var [x13, y13] = [1, "hello"];
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
>a3 : Symbol(a3, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 5))
>b3 : Symbol(b3, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 8))
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
>x : Symbol(x, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 29))
>x13 : Symbol(x13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 5))
>y : Symbol(y, Decl(declarationEmitDestructuringArrayPattern2.ts, 8, 37))
>y13 : Symbol(y13, Decl(declarationEmitDestructuringArrayPattern2.ts, 7, 9))
@@ -1,70 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern2.ts ===
var [x10, [y10, [z10]]] = [1, ["hello", [true]]];
>x10 : number
>y10 : string
>z10 : boolean
>[1, ["hello", [true]]] : [number, [string, [boolean]]]
>1 : number
>["hello", [true]] : [string, [boolean]]
>"hello" : string
>[true] : [boolean]
>true : boolean
var [x11 = 0, y11 = ""] = [1, "hello"];
>x11 : number
>0 : number
>y11 : string
>"" : string
>[1, "hello"] : [number, string]
>1 : number
>"hello" : string
var [a11, b11, c11] = [];
>a11 : any
>b11 : any
>c11 : any
>[] : undefined[]
var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello", { x12: 5, y12: true }]];
>a2 : number
>b2 : string
>x12 : number
>y12 : any
>c2 : boolean
>["abc", { x12: 10, y12: false }] : [string, { x12: number; y12: boolean; }]
>"abc" : string
>{ x12: 10, y12: false } : { x12: number; y12: boolean; }
>x12 : number
>10 : number
>y12 : boolean
>false : boolean
>[1, ["hello", { x12: 5, y12: true }]] : [number, [string, { x12: number; y12: boolean; }]]
>1 : number
>["hello", { x12: 5, y12: true }] : [string, { x12: number; y12: boolean; }]
>"hello" : string
>{ x12: 5, y12: true } : { x12: number; y12: boolean; }
>x12 : number
>5 : number
>y12 : boolean
>true : boolean
var [x13, y13] = [1, "hello"];
>x13 : number
>y13 : string
>[1, "hello"] : [number, string]
>1 : number
>"hello" : string
var [a3, b3] = [[x13, y13], { x: x13, y: y13 }];
>a3 : (number | string)[]
>b3 : { x: number; y: string; }
>[[x13, y13], { x: x13, y: y13 }] : [(number | string)[], { x: number; y: string; }]
>[x13, y13] : (number | string)[]
>x13 : number
>y13 : string
>{ x: x13, y: y13 } : { x: number; y: string; }
>x : number
>x13 : number
>y : string
>y13 : string
@@ -0,0 +1,43 @@
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(2,13): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(2,19): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(3,23): error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(4,16): error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(6,27): error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts(7,20): error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
==== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts (6 errors) ====
var { } = { x: 5, y: "hello" };
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
var { x4 } = { x4: 5, y4: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
var { y5 } = { x5: 5, y5: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
var { x6, y6 } = { x6: 5, y6: "hello" };
var { x7: a1 } = { x7: 5, y7: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
var { y8: b1 } = { x8: 5, y8: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
function f15() {
var a4 = "hello";
var b4 = 1;
var c4 = true;
return { a4, b4, c4 };
}
var { a4, b4, c4 } = f15();
module m {
export var { a4, b4, c4 } = f15();
}
@@ -1,89 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts ===
var { } = { x: 5, y: "hello" };
>x : Symbol(x, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 1, 11))
>y : Symbol(y, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 1, 17))
var { x4 } = { x4: 5, y4: "hello" };
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 5))
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 14))
>y4 : Symbol(y4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 2, 21))
var { y5 } = { x5: 5, y5: "hello" };
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 5))
>x5 : Symbol(x5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 14))
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 3, 21))
var { x6, y6 } = { x6: 5, y6: "hello" };
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 5))
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 9))
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 18))
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 25))
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 5))
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 25))
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 5))
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 18))
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 5))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 13))
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
>x11 : Symbol(x11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 5))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57))
>y11 : Symbol(y11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 18))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74))
>z11 : Symbol(z11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 31))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57))
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69))
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74))
function f15() {
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
var a4 = "hello";
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 12, 7))
var b4 = 1;
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 13, 7))
var c4 = true;
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 14, 7))
return { a4, b4, c4 };
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 12))
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 16))
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 15, 20))
}
var { a4, b4, c4 } = f15();
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 5))
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 9))
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 13))
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
module m {
>m : Symbol(m, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 17, 27))
export var { a4, b4, c4 } = f15();
>a4 : Symbol(a4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 16))
>b4 : Symbol(b4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 20))
>c4 : Symbol(c4, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 20, 24))
>f15 : Symbol(f15, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 89))
}
@@ -1,122 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern.ts ===
var { } = { x: 5, y: "hello" };
>{ x: 5, y: "hello" } : { x: number; y: string; }
>x : number
>5 : number
>y : string
>"hello" : string
var { x4 } = { x4: 5, y4: "hello" };
>x4 : number
>{ x4: 5, y4: "hello" } : { x4: number; y4: string; }
>x4 : number
>5 : number
>y4 : string
>"hello" : string
var { y5 } = { x5: 5, y5: "hello" };
>y5 : string
>{ x5: 5, y5: "hello" } : { x5: number; y5: string; }
>x5 : number
>5 : number
>y5 : string
>"hello" : string
var { x6, y6 } = { x6: 5, y6: "hello" };
>x6 : number
>y6 : string
>{ x6: 5, y6: "hello" } : { x6: number; y6: string; }
>x6 : number
>5 : number
>y6 : string
>"hello" : string
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : any
>a1 : number
>{ x7: 5, y7: "hello" } : { x7: number; y7: string; }
>x7 : number
>5 : number
>y7 : string
>"hello" : string
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : any
>b1 : string
>{ x8: 5, y8: "hello" } : { x8: number; y8: string; }
>x8 : number
>5 : number
>y8 : string
>"hello" : string
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : any
>a2 : number
>y9 : any
>b2 : string
>{ x9: 5, y9: "hello" } : { x9: number; y9: string; }
>x9 : number
>5 : number
>y9 : string
>"hello" : string
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
>a : any
>x11 : number
>b : any
>a : any
>y11 : string
>b : any
>a : any
>z11 : boolean
>{ a: 1, b: { a: "hello", b: { a: true } } } : { a: number; b: { a: string; b: { a: boolean; }; }; }
>a : number
>1 : number
>b : { a: string; b: { a: boolean; }; }
>{ a: "hello", b: { a: true } } : { a: string; b: { a: boolean; }; }
>a : string
>"hello" : string
>b : { a: boolean; }
>{ a: true } : { a: boolean; }
>a : boolean
>true : boolean
function f15() {
>f15 : () => { a4: string; b4: number; c4: boolean; }
var a4 = "hello";
>a4 : string
>"hello" : string
var b4 = 1;
>b4 : number
>1 : number
var c4 = true;
>c4 : boolean
>true : boolean
return { a4, b4, c4 };
>{ a4, b4, c4 } : { a4: string; b4: number; c4: boolean; }
>a4 : string
>b4 : number
>c4 : boolean
}
var { a4, b4, c4 } = f15();
>a4 : string
>b4 : number
>c4 : boolean
>f15() : { a4: string; b4: number; c4: boolean; }
>f15 : () => { a4: string; b4: number; c4: boolean; }
module m {
>m : typeof m
export var { a4, b4, c4 } = f15();
>a4 : string
>b4 : number
>c4 : boolean
>f15() : { a4: string; b4: number; c4: boolean; }
>f15 : () => { a4: string; b4: number; c4: boolean; }
}
@@ -0,0 +1,29 @@
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(2,13): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(2,19): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(3,23): error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(4,16): error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(6,27): error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts(7,20): error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
==== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts (6 errors) ====
var { } = { x: 5, y: "hello" };
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
var { x4 } = { x4: 5, y4: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'y4' does not exist in type '{ x4: any; }'.
var { y5 } = { x5: 5, y5: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'x5' does not exist in type '{ y5: any; }'.
var { x6, y6 } = { x6: 5, y6: "hello" };
var { x7: a1 } = { x7: 5, y7: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'y7' does not exist in type '{ x7: any; }'.
var { y8: b1 } = { x8: 5, y8: "hello" };
~~
!!! error TS2353: Object literal may only specify known properties, and 'x8' does not exist in type '{ y8: any; }'.
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
@@ -1,42 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts ===
var { } = { x: 5, y: "hello" };
>x : Symbol(x, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 1, 11))
>y : Symbol(y, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 1, 17))
var { x4 } = { x4: 5, y4: "hello" };
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 5))
>x4 : Symbol(x4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 14))
>y4 : Symbol(y4, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 2, 21))
var { y5 } = { x5: 5, y5: "hello" };
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 5))
>x5 : Symbol(x5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 14))
>y5 : Symbol(y5, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 3, 21))
var { x6, y6 } = { x6: 5, y6: "hello" };
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 5))
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 9))
>x6 : Symbol(x6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 18))
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 25))
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 5))
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 25))
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 5))
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 18))
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 5))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 13))
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
@@ -1,63 +0,0 @@
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern1.ts ===
var { } = { x: 5, y: "hello" };
>{ x: 5, y: "hello" } : { x: number; y: string; }
>x : number
>5 : number
>y : string
>"hello" : string
var { x4 } = { x4: 5, y4: "hello" };
>x4 : number
>{ x4: 5, y4: "hello" } : { x4: number; y4: string; }
>x4 : number
>5 : number
>y4 : string
>"hello" : string
var { y5 } = { x5: 5, y5: "hello" };
>y5 : string
>{ x5: 5, y5: "hello" } : { x5: number; y5: string; }
>x5 : number
>5 : number
>y5 : string
>"hello" : string
var { x6, y6 } = { x6: 5, y6: "hello" };
>x6 : number
>y6 : string
>{ x6: 5, y6: "hello" } : { x6: number; y6: string; }
>x6 : number
>5 : number
>y6 : string
>"hello" : string
var { x7: a1 } = { x7: 5, y7: "hello" };
>x7 : any
>a1 : number
>{ x7: 5, y7: "hello" } : { x7: number; y7: string; }
>x7 : number
>5 : number
>y7 : string
>"hello" : string
var { y8: b1 } = { x8: 5, y8: "hello" };
>y8 : any
>b1 : string
>{ x8: 5, y8: "hello" } : { x8: number; y8: string; }
>x8 : number
>5 : number
>y8 : string
>"hello" : string
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
>x9 : any
>a2 : number
>y9 : any
>b2 : string
>{ x9: 5, y9: "hello" } : { x9: number; y9: string; }
>x9 : number
>5 : number
>y9 : string
>"hello" : string
@@ -7,7 +7,7 @@ export function bar() { }
export interface Buzz { }
//// [index.ts]
import {foo} from "utils";
import {foo} from "./utils";
export = foo;
//// [utils.js]
@@ -16,7 +16,7 @@ exports.foo = foo;
function bar() { }
exports.bar = bar;
//// [index.js]
var utils_1 = require("utils");
var utils_1 = require("./utils");
module.exports = utils_1.foo;
@@ -26,5 +26,5 @@ export declare function bar(): void;
export interface Buzz {
}
//// [index.d.ts]
import { foo } from "utils";
import { foo } from "./utils";
export = foo;
@@ -10,7 +10,7 @@ export interface Buzz { }
>Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25))
=== tests/cases/compiler/index.ts ===
import {foo} from "utils";
import {foo} from "./utils";
>foo : Symbol(foo, Decl(index.ts, 0, 8))
export = foo;
@@ -10,7 +10,7 @@ export interface Buzz { }
>Buzz : Buzz
=== tests/cases/compiler/index.ts ===
import {foo} from "utils";
import {foo} from "./utils";
>foo : () => void
export = foo;
@@ -7,7 +7,7 @@ export function bar() { }
export interface Buzz { }
//// [index.ts]
import {foo, bar, Buzz} from "utils";
import {foo, bar, Buzz} from "./utils";
foo();
let obj: Buzz;
@@ -19,7 +19,7 @@ exports.foo = foo;
function bar() { }
exports.bar = bar;
//// [index.js]
var utils_1 = require("utils");
var utils_1 = require("./utils");
exports.bar = utils_1.bar;
utils_1.foo();
var obj;
@@ -31,5 +31,5 @@ export declare function bar(): void;
export interface Buzz {
}
//// [index.d.ts]
import { bar } from "utils";
import { bar } from "./utils";
export { bar };
Loaded 100 of 560 files, more files were not shown because too many files have changed in this diff. Show more