Merge branch 'release-1.5'
Conflicts: src/compiler/emitter.ts src/compiler/parser.ts src/compiler/program.ts src/services/services.ts tests/cases/unittests/transpile.ts
This commit is contained in:
Коммит
111fdcb499
|
@ -24740,7 +24740,7 @@ var ts;
|
|||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
write(");");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
|
@ -24848,7 +24848,7 @@ var ts;
|
|||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
write(");");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
|
|
|
@ -25131,7 +25131,7 @@ var ts;
|
|||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
write(");");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
|
@ -25239,7 +25239,7 @@ var ts;
|
|||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
write(");");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
|
|
|
@ -29466,7 +29466,7 @@ var ts;
|
|||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
write(");");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
|
@ -29576,7 +29576,7 @@ var ts;
|
|||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
write(");");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
|
|
|
@ -29466,7 +29466,7 @@ var ts;
|
|||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
write(");");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
|
@ -29576,7 +29576,7 @@ var ts;
|
|||
emitDeclarationName(node);
|
||||
write("\", ");
|
||||
emitDeclarationName(node);
|
||||
write(")");
|
||||
write(");");
|
||||
}
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
|
|
|
@ -365,21 +365,38 @@ namespace ts {
|
|||
case SyntaxKind.SourceFile:
|
||||
if (!isExternalModule(<SourceFile>location)) break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.ModuleMember)) {
|
||||
if (result.flags & meaning || !(result.flags & SymbolFlags.Alias && getDeclarationOfAliasSymbol(result).kind === SyntaxKind.ExportSpecifier)) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
}
|
||||
else if (location.kind === SyntaxKind.SourceFile ||
|
||||
let moduleExports = getSymbolOfNode(location).exports;
|
||||
if (location.kind === SyntaxKind.SourceFile ||
|
||||
(location.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>location).name.kind === SyntaxKind.StringLiteral)) {
|
||||
result = getSymbolOfNode(location).exports["default"];
|
||||
|
||||
// It's an external module. Because of module/namespace merging, a module's exports are in scope,
|
||||
// yet we never want to treat an export specifier as putting a member in scope. Therefore,
|
||||
// if the name we find is purely an export specifier, it is not actually considered in scope.
|
||||
// Two things to note about this:
|
||||
// 1. We have to check this without calling getSymbol. The problem with calling getSymbol
|
||||
// on an export specifier is that it might find the export specifier itself, and try to
|
||||
// resolve it as an alias. This will cause the checker to consider the export specifier
|
||||
// a circular alias reference when it might not be.
|
||||
// 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely*
|
||||
// an alias. If we used &, we'd be throwing out symbols that have non alias aspects,
|
||||
// which is not the desired behavior.
|
||||
if (hasProperty(moduleExports, name) &&
|
||||
moduleExports[name].flags === SymbolFlags.Alias &&
|
||||
getDeclarationOfKind(moduleExports[name], SyntaxKind.ExportSpecifier)) {
|
||||
break;
|
||||
}
|
||||
|
||||
result = moduleExports["default"];
|
||||
let localSymbol = getLocalSymbolForExportDefault(result);
|
||||
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
}
|
||||
|
||||
if (result = getSymbol(moduleExports, name, meaning & SymbolFlags.ModuleMember)) {
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.EnumMember)) {
|
||||
|
|
|
@ -5347,7 +5347,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
decreaseIndent();
|
||||
writeLine();
|
||||
write("}"); // return
|
||||
emitTempDeclarations(/*newLine*/ true)
|
||||
emitTempDeclarations(/*newLine*/ true);
|
||||
}
|
||||
|
||||
function emitSetters(exportStarFunction: string) {
|
||||
|
|
|
@ -3988,7 +3988,7 @@ namespace ts {
|
|||
parseExportAssignment(fullStart, decorators, modifiers) :
|
||||
parseExportDeclaration(fullStart, decorators, modifiers);
|
||||
default:
|
||||
if (decorators) {
|
||||
if (decorators || modifiers) {
|
||||
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
|
||||
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
|
||||
let node = <Statement>createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
|
||||
|
@ -4390,7 +4390,7 @@ namespace ts {
|
|||
return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers);
|
||||
}
|
||||
|
||||
if (decorators) {
|
||||
if (decorators || modifiers) {
|
||||
// treat this as a property declaration with a missing name.
|
||||
let name = <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
|
||||
return parsePropertyDeclaration(fullStart, decorators, modifiers, name, /*questionToken*/ undefined);
|
||||
|
|
|
@ -1792,6 +1792,11 @@ namespace ts {
|
|||
sourceFile.moduleName = moduleName;
|
||||
}
|
||||
|
||||
// Store syntactic diagnostics
|
||||
if (diagnostics && sourceFile.parseDiagnostics) {
|
||||
diagnostics.push(...sourceFile.parseDiagnostics);
|
||||
}
|
||||
|
||||
let newLine = getNewLineCharacter(options);
|
||||
|
||||
// Output
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
tests/cases/compiler/classMemberWithMissingIdentifier.ts(2,11): error TS1146: Declaration expected.
|
||||
tests/cases/compiler/classMemberWithMissingIdentifier.ts(2,12): error TS1005: '=' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classMemberWithMissingIdentifier.ts (2 errors) ====
|
||||
class C {
|
||||
public {};
|
||||
|
||||
!!! error TS1146: Declaration expected.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
//// [classMemberWithMissingIdentifier.ts]
|
||||
class C {
|
||||
public {};
|
||||
}
|
||||
|
||||
//// [classMemberWithMissingIdentifier.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
this. = {};
|
||||
}
|
||||
return C;
|
||||
})();
|
|
@ -0,0 +1,30 @@
|
|||
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,11): error TS1146: Declaration expected.
|
||||
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,12): error TS1005: '=' expected.
|
||||
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,14): error TS2304: Cannot find name 'name'.
|
||||
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,18): error TS1005: ']' expected.
|
||||
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,19): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,25): error TS1005: ',' expected.
|
||||
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,26): error TS1136: Property assignment expected.
|
||||
tests/cases/compiler/classMemberWithMissingIdentifier2.ts(2,27): error TS2304: Cannot find name 'VariableDeclaration'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classMemberWithMissingIdentifier2.ts (8 errors) ====
|
||||
class C {
|
||||
public {[name:string]:VariableDeclaration};
|
||||
|
||||
!!! error TS1146: Declaration expected.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'name'.
|
||||
~
|
||||
!!! error TS1005: ']' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'string'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'VariableDeclaration'.
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
//// [classMemberWithMissingIdentifier2.ts]
|
||||
class C {
|
||||
public {[name:string]:VariableDeclaration};
|
||||
}
|
||||
|
||||
//// [classMemberWithMissingIdentifier2.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
this. = (_a = {}, _a[name] = string, _a.VariableDeclaration = VariableDeclaration, _a);
|
||||
var _a;
|
||||
}
|
||||
return C;
|
||||
})();
|
|
@ -0,0 +1,15 @@
|
|||
//// [exportSpecifierAndExportedMemberDeclaration.ts]
|
||||
declare module "m2" {
|
||||
export module X {
|
||||
interface I { }
|
||||
}
|
||||
function Y();
|
||||
export { Y as X };
|
||||
function Z(): X.I;
|
||||
}
|
||||
|
||||
declare module "m2" {
|
||||
function Z2(): X.I;
|
||||
}
|
||||
|
||||
//// [exportSpecifierAndExportedMemberDeclaration.js]
|
|
@ -0,0 +1,27 @@
|
|||
=== tests/cases/compiler/exportSpecifierAndExportedMemberDeclaration.ts ===
|
||||
declare module "m2" {
|
||||
export module X {
|
||||
>X : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
|
||||
|
||||
interface I { }
|
||||
>I : Symbol(I, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 1, 21))
|
||||
}
|
||||
function Y();
|
||||
>Y : Symbol(Y, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 3, 5))
|
||||
|
||||
export { Y as X };
|
||||
>Y : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
|
||||
>X : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
|
||||
|
||||
function Z(): X.I;
|
||||
>Z : Symbol(Z, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 22))
|
||||
>X : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
|
||||
>I : Symbol(X.I, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 1, 21))
|
||||
}
|
||||
|
||||
declare module "m2" {
|
||||
function Z2(): X.I;
|
||||
>Z2 : Symbol(Z2, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 9, 21))
|
||||
>X : Symbol(X, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 0, 21), Decl(exportSpecifierAndExportedMemberDeclaration.ts, 5, 12))
|
||||
>I : Symbol(X.I, Decl(exportSpecifierAndExportedMemberDeclaration.ts, 1, 21))
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
=== tests/cases/compiler/exportSpecifierAndExportedMemberDeclaration.ts ===
|
||||
declare module "m2" {
|
||||
export module X {
|
||||
>X : () => any
|
||||
|
||||
interface I { }
|
||||
>I : I
|
||||
}
|
||||
function Y();
|
||||
>Y : () => any
|
||||
|
||||
export { Y as X };
|
||||
>Y : () => any
|
||||
>X : () => any
|
||||
|
||||
function Z(): X.I;
|
||||
>Z : () => X.I
|
||||
>X : any
|
||||
>I : X.I
|
||||
}
|
||||
|
||||
declare module "m2" {
|
||||
function Z2(): X.I;
|
||||
>Z2 : () => X.I
|
||||
>X : any
|
||||
>I : X.I
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
tests/cases/compiler/exportSpecifierAndLocalMemberDeclaration.ts(11,20): error TS2503: Cannot find namespace 'X'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/exportSpecifierAndLocalMemberDeclaration.ts (1 errors) ====
|
||||
declare module "m2" {
|
||||
module X {
|
||||
interface I { }
|
||||
}
|
||||
function Y();
|
||||
export { Y as X };
|
||||
function Z(): X.I;
|
||||
}
|
||||
|
||||
declare module "m2" {
|
||||
function Z2(): X.I;
|
||||
~
|
||||
!!! error TS2503: Cannot find namespace 'X'.
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
//// [exportSpecifierAndLocalMemberDeclaration.ts]
|
||||
declare module "m2" {
|
||||
module X {
|
||||
interface I { }
|
||||
}
|
||||
function Y();
|
||||
export { Y as X };
|
||||
function Z(): X.I;
|
||||
}
|
||||
|
||||
declare module "m2" {
|
||||
function Z2(): X.I;
|
||||
}
|
||||
|
||||
//// [exportSpecifierAndLocalMemberDeclaration.js]
|
|
@ -0,0 +1,8 @@
|
|||
//// [exportSpecifierReferencingOuterDeclaration1.ts]
|
||||
declare module X { export interface bar { } }
|
||||
declare module "m" {
|
||||
export { X };
|
||||
export function foo(): X.bar;
|
||||
}
|
||||
|
||||
//// [exportSpecifierReferencingOuterDeclaration1.js]
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration1.ts ===
|
||||
declare module X { export interface bar { } }
|
||||
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 0))
|
||||
>bar : Symbol(bar, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 18))
|
||||
|
||||
declare module "m" {
|
||||
export { X };
|
||||
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 2, 12))
|
||||
|
||||
export function foo(): X.bar;
|
||||
>foo : Symbol(foo, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 2, 17))
|
||||
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 0))
|
||||
>bar : Symbol(X.bar, Decl(exportSpecifierReferencingOuterDeclaration1.ts, 0, 18))
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration1.ts ===
|
||||
declare module X { export interface bar { } }
|
||||
>X : any
|
||||
>bar : bar
|
||||
|
||||
declare module "m" {
|
||||
export { X };
|
||||
>X : any
|
||||
|
||||
export function foo(): X.bar;
|
||||
>foo : () => X.bar
|
||||
>X : any
|
||||
>bar : X.bar
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
//// [tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2.ts] ////
|
||||
|
||||
//// [exportSpecifierReferencingOuterDeclaration2_A.ts]
|
||||
declare module X { export interface bar { } }
|
||||
|
||||
//// [exportSpecifierReferencingOuterDeclaration2_B.ts]
|
||||
export { X };
|
||||
export declare function foo(): X.bar;
|
||||
|
||||
//// [exportSpecifierReferencingOuterDeclaration2_A.js]
|
||||
//// [exportSpecifierReferencingOuterDeclaration2_B.js]
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts ===
|
||||
declare module X { export interface bar { } }
|
||||
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 0))
|
||||
>bar : Symbol(bar, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 18))
|
||||
|
||||
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts ===
|
||||
export { X };
|
||||
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_B.ts, 0, 8))
|
||||
|
||||
export declare function foo(): X.bar;
|
||||
>foo : Symbol(foo, Decl(exportSpecifierReferencingOuterDeclaration2_B.ts, 0, 13))
|
||||
>X : Symbol(X, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 0))
|
||||
>bar : Symbol(X.bar, Decl(exportSpecifierReferencingOuterDeclaration2_A.ts, 0, 18))
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts ===
|
||||
declare module X { export interface bar { } }
|
||||
>X : any
|
||||
>bar : bar
|
||||
|
||||
=== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts ===
|
||||
export { X };
|
||||
>X : any
|
||||
|
||||
export declare function foo(): X.bar;
|
||||
>foo : () => X.bar
|
||||
>X : any
|
||||
>bar : X.bar
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
tests/cases/compiler/exportSpecifierReferencingOuterDeclaration3.ts(6,30): error TS2305: Module 'X' has no exported member 'bar'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration3.ts (1 errors) ====
|
||||
declare module X { export interface bar { } }
|
||||
declare module "m" {
|
||||
module X { export interface foo { } }
|
||||
export { X };
|
||||
export function foo(): X.foo;
|
||||
export function bar(): X.bar; // error
|
||||
~~~
|
||||
!!! error TS2305: Module 'X' has no exported member 'bar'.
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
//// [exportSpecifierReferencingOuterDeclaration3.ts]
|
||||
declare module X { export interface bar { } }
|
||||
declare module "m" {
|
||||
module X { export interface foo { } }
|
||||
export { X };
|
||||
export function foo(): X.foo;
|
||||
export function bar(): X.bar; // error
|
||||
}
|
||||
|
||||
//// [exportSpecifierReferencingOuterDeclaration3.js]
|
|
@ -0,0 +1,13 @@
|
|||
tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts(4,34): error TS2305: Module 'X' has no exported member 'bar'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_A.ts (0 errors) ====
|
||||
declare module X { export interface bar { } }
|
||||
|
||||
==== tests/cases/compiler/exportSpecifierReferencingOuterDeclaration2_B.ts (1 errors) ====
|
||||
declare module X { export interface foo { } }
|
||||
export { X };
|
||||
export declare function foo(): X.foo;
|
||||
export declare function bar(): X.bar; // error
|
||||
~~~
|
||||
!!! error TS2305: Module 'X' has no exported member 'bar'.
|
|
@ -0,0 +1,13 @@
|
|||
//// [tests/cases/compiler/exportSpecifierReferencingOuterDeclaration4.ts] ////
|
||||
|
||||
//// [exportSpecifierReferencingOuterDeclaration2_A.ts]
|
||||
declare module X { export interface bar { } }
|
||||
|
||||
//// [exportSpecifierReferencingOuterDeclaration2_B.ts]
|
||||
declare module X { export interface foo { } }
|
||||
export { X };
|
||||
export declare function foo(): X.foo;
|
||||
export declare function bar(): X.bar; // error
|
||||
|
||||
//// [exportSpecifierReferencingOuterDeclaration2_A.js]
|
||||
//// [exportSpecifierReferencingOuterDeclaration2_B.js]
|
|
@ -0,0 +1,21 @@
|
|||
//// [systemModule13.ts]
|
||||
|
||||
export let [x,y,z] = [1, 2, 3];
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
for ([x] of [[1]]) {}
|
||||
|
||||
//// [systemModule13.js]
|
||||
System.register([], function(exports_1) {
|
||||
var x, y, z, z0, z1;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
_a = [1, 2, 3], exports_1("x", x = _a[0]), exports_1("y", y = _a[1]), exports_1("z", z = _a[2]);
|
||||
_b = { a: true, b: { c: "123" } }, exports_1("z0", z0 = _b.a), exports_1("z1", z1 = _b.b.c);
|
||||
for (var _i = 0, _c = [[1]]; _i < _c.length; _i++) {
|
||||
exports_1("x", x = _c[_i][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
var _a, _b;
|
||||
});
|
|
@ -0,0 +1,17 @@
|
|||
=== tests/cases/compiler/systemModule13.ts ===
|
||||
|
||||
export let [x,y,z] = [1, 2, 3];
|
||||
>x : Symbol(x, Decl(systemModule13.ts, 1, 12))
|
||||
>y : Symbol(y, Decl(systemModule13.ts, 1, 14))
|
||||
>z : Symbol(z, Decl(systemModule13.ts, 1, 16))
|
||||
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
>z0 : Symbol(z0, Decl(systemModule13.ts, 2, 14))
|
||||
>z1 : Symbol(z1, Decl(systemModule13.ts, 2, 25))
|
||||
>a : Symbol(a, Decl(systemModule13.ts, 2, 36))
|
||||
>b : Symbol(b, Decl(systemModule13.ts, 2, 44))
|
||||
>c : Symbol(c, Decl(systemModule13.ts, 2, 49))
|
||||
|
||||
for ([x] of [[1]]) {}
|
||||
>x : Symbol(x, Decl(systemModule13.ts, 1, 12))
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
=== tests/cases/compiler/systemModule13.ts ===
|
||||
|
||||
export let [x,y,z] = [1, 2, 3];
|
||||
>x : number
|
||||
>y : number
|
||||
>z : number
|
||||
>[1, 2, 3] : [number, number, number]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
>a : any
|
||||
>z0 : boolean
|
||||
>b : any
|
||||
>c : any
|
||||
>z1 : string
|
||||
>{a: true, b: {c: "123"}} : { a: boolean; b: { c: string; }; }
|
||||
>a : boolean
|
||||
>true : boolean
|
||||
>b : { c: string; }
|
||||
>{c: "123"} : { c: string; }
|
||||
>c : string
|
||||
>"123" : string
|
||||
|
||||
for ([x] of [[1]]) {}
|
||||
>[x] : number[]
|
||||
>x : number
|
||||
>[[1]] : number[][]
|
||||
>[1] : number[]
|
||||
>1 : number
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
class C {
|
||||
public {};
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
class C {
|
||||
public {[name:string]:VariableDeclaration};
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
declare module "m2" {
|
||||
export module X {
|
||||
interface I { }
|
||||
}
|
||||
function Y();
|
||||
export { Y as X };
|
||||
function Z(): X.I;
|
||||
}
|
||||
|
||||
declare module "m2" {
|
||||
function Z2(): X.I;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
declare module "m2" {
|
||||
module X {
|
||||
interface I { }
|
||||
}
|
||||
function Y();
|
||||
export { Y as X };
|
||||
function Z(): X.I;
|
||||
}
|
||||
|
||||
declare module "m2" {
|
||||
function Z2(): X.I;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
declare module X { export interface bar { } }
|
||||
declare module "m" {
|
||||
export { X };
|
||||
export function foo(): X.bar;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// @module: commonjs
|
||||
// @Filename: exportSpecifierReferencingOuterDeclaration2_A.ts
|
||||
declare module X { export interface bar { } }
|
||||
|
||||
// @Filename: exportSpecifierReferencingOuterDeclaration2_B.ts
|
||||
export { X };
|
||||
export declare function foo(): X.bar;
|
|
@ -0,0 +1,7 @@
|
|||
declare module X { export interface bar { } }
|
||||
declare module "m" {
|
||||
module X { export interface foo { } }
|
||||
export { X };
|
||||
export function foo(): X.foo;
|
||||
export function bar(): X.bar; // error
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
// @module: commonjs
|
||||
// @Filename: exportSpecifierReferencingOuterDeclaration2_A.ts
|
||||
declare module X { export interface bar { } }
|
||||
|
||||
// @Filename: exportSpecifierReferencingOuterDeclaration2_B.ts
|
||||
declare module X { export interface foo { } }
|
||||
export { X };
|
||||
export declare function foo(): X.foo;
|
||||
export declare function bar(): X.bar; // error
|
|
@ -0,0 +1,5 @@
|
|||
// @module: system
|
||||
|
||||
export let [x,y,z] = [1, 2, 3];
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
for ([x] of [[1]]) {}
|
|
@ -68,6 +68,7 @@ var x = 0;`,
|
|||
`});\n`;
|
||||
runTest("var x = 1;", { module: ModuleKind.System, newLine: NewLineKind.LineFeed }, /*fileName*/ undefined, "NamedModule", output)
|
||||
});
|
||||
|
||||
it("No extra errors for file without extension", () => {
|
||||
runTest(`var x = 0;`, { module: ModuleKind.CommonJS }, "file", /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/[]);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче