Update baselines for not emitting when module flag is not specified

This commit is contained in:
Jason Freeman 2014-07-18 14:06:32 -07:00
parent 837a8935c7
commit c2fc52e92b
52 changed files with 17 additions and 1696 deletions

View File

@ -1,13 +0,0 @@
//// [ExportAssignment7.ts]
export class C {
}
export = B;
//// [ExportAssignment7.js]
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;

View File

@ -1,13 +0,0 @@
//// [ExportAssignment8.ts]
export = B;
export class C {
}
//// [ExportAssignment8.js]
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;

View File

@ -1,59 +0,0 @@
//// [tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.ts] ////
//// [part1.ts]
export module A {
export interface Point {
x: number;
y: number;
}
export module Utils {
export function mirror<T extends Point>(p: T) {
return { x: p.y, y: p.x };
}
}
export var Origin: Point = { x: 0, y: 0 };
}
//// [part2.ts]
export module A {
// collision with 'Origin' var in other part of merged module
export var Origin: Point = { x: 0, y: 0 };
export module Utils {
export class Plane {
constructor(public tl: Point, public br: Point) { }
}
}
}
//// [part1.js]
(function (A) {
(function (Utils) {
function mirror(p) {
return { x: p.y, y: p.x };
}
Utils.mirror = mirror;
})(A.Utils || (A.Utils = {}));
var Utils = A.Utils;
A.Origin = { x: 0, y: 0 };
})(exports.A || (exports.A = {}));
var A = exports.A;
//// [part2.js]
(function (A) {
A.Origin = { x: 0, y: 0 };
(function (Utils) {
var Plane = (function () {
function Plane(tl, br) {
this.tl = tl;
this.br = br;
}
return Plane;
})();
Utils.Plane = Plane;
})(A.Utils || (A.Utils = {}));
var Utils = A.Utils;
})(exports.A || (exports.A = {}));
var A = exports.A;

View File

@ -1,31 +0,0 @@
//// [tests/cases/conformance/ambient/ambientDeclarationsExternal.ts] ////
//// [decls.ts]
// Ambient external module with export assignment
declare module 'equ' {
var x;
export = x;
}
declare module 'equ2' {
var x: number;
}
// Ambient external import declaration referencing ambient external module using top level module name
//// [consumer.ts]
/// <reference path="decls.ts" />
import imp1 = require('equ');
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
import imp3 = require('equ2');
var n = imp3.x;
var n: number;
//// [decls.js]
//// [consumer.js]
var imp3 = require('equ2');
var n = imp3.x;
var n;

View File

@ -1,66 +0,0 @@
//// [tests/cases/conformance/externalModules/circularReference.ts] ////
//// [foo1.ts]
import foo2 = require('./foo2');
export module M1 {
export class C1 {
m1: foo2.M1.C1;
x: number;
constructor(){
this.m1 = new foo2.M1.C1();
this.m1.y = 10; // OK
this.m1.x = 20; // Error
}
}
}
//// [foo2.ts]
import foo1 = require('./foo1');
export module M1 {
export class C1 {
m1: foo1.M1.C1;
y: number
constructor(){
this.m1 = new foo1.M1.C1();
this.m1.y = 10; // Error
this.m1.x = 20; // OK
var tmp = new M1.C1();
tmp.y = 10; // OK
tmp.x = 20; // Error
}
}
}
//// [foo1.js]
var foo2 = require('./foo2');
(function (M1) {
var C1 = (function () {
function C1() {
this.m1 = new foo2.M1.C1();
this.m1.y = 10;
this.m1.x = 20;
}
return C1;
})();
M1.C1 = C1;
})(exports.M1 || (exports.M1 = {}));
var M1 = exports.M1;
//// [foo2.js]
var foo1 = require('./foo1');
(function (M1) {
var C1 = (function () {
function C1() {
this.m1 = new foo1.M1.C1();
this.m1.y = 10;
this.m1.x = 20;
var tmp = new M1.C1();
tmp.y = 10;
tmp.x = 20;
}
return C1;
})();
M1.C1 = C1;
})(exports.M1 || (exports.M1 = {}));
var M1 = exports.M1;

View File

@ -1,32 +0,0 @@
//// [tests/cases/compiler/classMemberInitializerWithLamdaScoping3.ts] ////
//// [classMemberInitializerWithLamdaScoping3_0.ts]
var field1: string;
//// [classMemberInitializerWithLamdaScoping3_1.ts]
declare var console: {
log(msg?: any): void;
};
export class Test1 {
constructor(private field1: string) {
}
messageHandler = () => {
console.log(field1); // But this should be error as the field1 will resolve to var field1
// but since this code would be generated inside constructor, in generated js
// it would resolve to private field1 and thats not what user intended here.
};
}
//// [classMemberInitializerWithLamdaScoping3_0.js]
var field1;
//// [classMemberInitializerWithLamdaScoping3_1.js]
var Test1 = (function () {
function Test1(field1) {
this.field1 = field1;
this.messageHandler = function () {
console.log(field1);
};
}
return Test1;
})();
exports.Test1 = Test1;

View File

@ -1,30 +0,0 @@
//// [tests/cases/compiler/classMemberInitializerWithLamdaScoping4.ts] ////
//// [classMemberInitializerWithLamdaScoping3_0.ts]
export var field1: string;
//// [classMemberInitializerWithLamdaScoping3_1.ts]
declare var console: {
log(msg?: any): void;
};
export class Test1 {
constructor(private field1: string) {
}
messageHandler = () => {
console.log(field1); // Should be error that couldnt find symbol field1
};
}
//// [classMemberInitializerWithLamdaScoping3_0.js]
exports.field1;
//// [classMemberInitializerWithLamdaScoping3_1.js]
var Test1 = (function () {
function Test1(field1) {
this.field1 = field1;
this.messageHandler = function () {
console.log(field1);
};
}
return Test1;
})();
exports.Test1 = Test1;

View File

@ -1,80 +0,0 @@
//// [tests/cases/conformance/externalModules/duplicateExportAssignments.ts] ////
//// [foo1.ts]
var x = 10;
var y = 20;
export = x;
export = y;
//// [foo2.ts]
var x = 10;
class y {};
export = x;
export = y;
//// [foo3.ts]
module x {
export var x = 10;
}
class y {
y: number;
}
export = x;
export = y;
//// [foo4.ts]
export = x;
function x(){
return 42;
}
function y(){
return 42;
}
export = y;
//// [foo5.ts]
var x = 5;
var y = "test";
var z = {};
export = x;
export = y;
export = z;
//// [foo1.js]
var x = 10;
var y = 20;
module.exports = x;
//// [foo2.js]
var x = 10;
var y = (function () {
function y() {
}
return y;
})();
;
module.exports = x;
//// [foo3.js]
var x;
(function (x) {
x.x = 10;
})(x || (x = {}));
var y = (function () {
function y() {
}
return y;
})();
module.exports = x;
//// [foo4.js]
function x() {
return 42;
}
function y() {
return 42;
}
module.exports = x;
//// [foo5.js]
var x = 5;
var y = "test";
var z = {};
module.exports = x;

View File

@ -1,28 +0,0 @@
//// [tests/cases/conformance/externalModules/exportAssignImportedIdentifier.ts] ////
//// [foo1.ts]
export function x(){
return true;
}
//// [foo2.ts]
import foo1 = require('./foo1');
var x = foo1.x;
export = x;
//// [foo3.ts]
import foo2 = require('./foo2');
var x = foo2(); // should be boolean
//// [foo1.js]
function x() {
return true;
}
exports.x = x;
//// [foo2.js]
var foo1 = require('./foo1');
var x = foo1.x;
module.exports = x;
//// [foo3.js]
var foo2 = require('./foo2');
var x = foo2();

View File

@ -1,10 +1,10 @@
==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ====
var x = 10;
export = typeof x; // Error
~~~~~~
!!! Identifier expected.
~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
~~~~~~
!!! Identifier expected.
==== tests/cases/conformance/externalModules/foo2.ts (1 errors) ====
export = "sausages"; // Error

View File

@ -1,93 +0,0 @@
//// [tests/cases/conformance/externalModules/exportAssignTypes.ts] ////
//// [expString.ts]
var x = "test";
export = x;
//// [expNumber.ts]
var x = 42;
export = x;
//// [expBoolean.ts]
var x = true;
export = x;
//// [expArray.ts]
var x = [1,2];
export = x;
//// [expObject.ts]
var x = { answer: 42, when: 1776};
export = x;
//// [expAny.ts]
var x;
export = x;
//// [expGeneric.ts]
function x<T>(a: T){
return a;
}
export = x;
//// [consumer.ts]
import iString = require('./expString');
var v1: string = iString;
import iNumber = require('./expNumber');
var v2: number = iNumber;
import iBoolean = require('./expBoolean');
var v3: boolean = iBoolean;
import iArray = require('./expArray');
var v4: Array<number> = iArray;
import iObject = require('./expObject');
var v5: Object = iObject;
import iAny = require('./expAny');
var v6 = iAny;
import iGeneric = require('./expGeneric');
var v7: {<x>(p1: x): x} = iGeneric;
//// [expString.js]
var x = "test";
module.exports = x;
//// [expNumber.js]
var x = 42;
module.exports = x;
//// [expBoolean.js]
var x = true;
module.exports = x;
//// [expArray.js]
var x = [1, 2];
module.exports = x;
//// [expObject.js]
var x = { answer: 42, when: 1776 };
module.exports = x;
//// [expAny.js]
var x;
module.exports = x;
//// [expGeneric.js]
function x(a) {
return a;
}
module.exports = x;
//// [consumer.js]
var iString = require('./expString');
var v1 = iString;
var iNumber = require('./expNumber');
var v2 = iNumber;
var iBoolean = require('./expBoolean');
var v3 = iBoolean;
var iArray = require('./expArray');
var v4 = iArray;
var iObject = require('./expObject');
var v5 = iObject;
var iAny = require('./expAny');
var v6 = iAny;
var iGeneric = require('./expGeneric');
var v7 = iGeneric;

View File

@ -1,19 +0,0 @@
//// [tests/cases/conformance/externalModules/exportDeclaredModule.ts] ////
//// [foo1.ts]
declare module M1 {
export var a: string;
export function b(): number;
}
export = M1;
//// [foo2.ts]
import foo1 = require('./foo1');
var x: number = foo1.b();
//// [foo1.js]
module.exports = M1;
//// [foo2.js]
var foo1 = require('./foo1');
var x = foo1.b();

View File

@ -1,54 +0,0 @@
//// [tests/cases/conformance/externalModules/exportNonVisibleType.ts] ////
//// [foo1.ts]
interface I1 {
a: string;
b: number;
}
var x: I1 = {a: "test", b: 42};
export = x; // Should fail, I1 not exported.
//// [foo2.ts]
interface I1 {
a: string;
b: number;
}
class C1 {
m1: I1;
}
export = C1; // Should fail, type I1 of visible member C1.m1 not exported.
//// [foo3.ts]
interface I1 {
a: string;
b: number;
}
class C1 {
private m1: I1;
}
export = C1; // Should work, private type I1 of visible class C1 only used in private member m1.
//// [foo1.js]
var x = { a: "test", b: 42 };
module.exports = x;
//// [foo2.js]
var C1 = (function () {
function C1() {
}
return C1;
})();
module.exports = C1;
//// [foo3.js]
var C1 = (function () {
function C1() {
}
return C1;
})();
module.exports = C1;

View File

@ -1,7 +0,0 @@
//// [externalModuleWithoutCompilerFlag1.ts]
// Not on line 0 because we want to verify the error is placed in the appropriate location.
export module M {
}
//// [externalModuleWithoutCompilerFlag1.js]

View File

@ -1,8 +0,0 @@
//// [genericArrayExtenstions.ts]
export declare class ObservableArray<T> implements Array<T> { // MS.Entertainment.ObservableArray
concat<U extends T[]>(...items: U[]): T[];
concat(...items: T[]): T[];
}
//// [genericArrayExtenstions.js]

View File

@ -1,30 +0,0 @@
//// [tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts] ////
//// [importAliasAnExternalModuleInsideAnInternalModule_file0.ts]
export module m {
export function foo() { }
}
//// [importAliasAnExternalModuleInsideAnInternalModule_file1.ts]
import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0');
module m_private {
//import r2 = require('m'); // would be error
export import C = r; // no error
C.m.foo();
}
//// [importAliasAnExternalModuleInsideAnInternalModule_file0.js]
(function (m) {
function foo() {
}
m.foo = foo;
})(exports.m || (exports.m = {}));
var m = exports.m;
//// [importAliasAnExternalModuleInsideAnInternalModule_file1.js]
var r = require('importAliasAnExternalModuleInsideAnInternalModule_file0');
var m_private;
(function (m_private) {
m_private.C = r;
m_private.C.m.foo();
})(m_private || (m_private = {}));

View File

@ -1,8 +0,0 @@
//// [importDeclRefereingExternalModuleWithNoResolve.ts]
import b = require("externalModule");
declare module "m1" {
import im2 = require("externalModule");
}
//// [importDeclRefereingExternalModuleWithNoResolve.js]

View File

@ -6,10 +6,10 @@
declare export import a = x.c;
~~~~~~~
!!! A 'declare' modifier cannot be used with an import declaration.
~~~~~~
!!! 'export' modifier must precede 'declare' modifier.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
~~~~~~
!!! 'export' modifier must precede 'declare' modifier.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Module 'x' has no exported member 'c'.
var b: a;

View File

@ -1,42 +0,0 @@
//// [mergedModuleDeclarationCodeGen.ts]
export module X {
export module Y {
class A {
constructor(Y: any) {
new B();
}
}
}
}
export module X {
export module Y {
export class B {
}
}
}
//// [mergedModuleDeclarationCodeGen.js]
(function (X) {
(function (Y) {
var A = (function () {
function A(Y) {
new Y.B();
}
return A;
})();
})(X.Y || (X.Y = {}));
var Y = X.Y;
})(exports.X || (exports.X = {}));
var X = exports.X;
(function (X) {
(function (Y) {
var B = (function () {
function B() {
}
return B;
})();
Y.B = B;
})(X.Y || (X.Y = {}));
var Y = X.Y;
})(exports.X || (exports.X = {}));
var X = exports.X;

View File

@ -1,40 +0,0 @@
//// [tests/cases/conformance/externalModules/moduleScoping.ts] ////
//// [file1.ts]
var v1 = "sausages"; // Global scope
//// [file2.ts]
var v2 = 42; // Global scope
var v4 = () => 5;
//// [file3.ts]
export var v3 = true;
var v2 = [1,2,3]; // Module scope. Should not appear in global scope
//// [file4.ts]
import file3 = require('./file3');
var t1 = v1;
var t2 = v2;
var t3 = file3.v3;
var v4 = {a: true, b: NaN}; // Should shadow global v2 in this module
//// [file5.ts]
var x = v2; // Should be global v2 of type number again
//// [file1.js]
var v1 = "sausages";
//// [file2.js]
var v2 = 42;
var v4 = function () { return 5; };
//// [file3.js]
exports.v3 = true;
var v2 = [1, 2, 3];
//// [file4.js]
var file3 = require('./file3');
var t1 = v1;
var t2 = v2;
var t3 = file3.v3;
var v4 = { a: true, b: NaN };
//// [file5.js]
var x = v2;

View File

@ -1,47 +0,0 @@
//// [tests/cases/compiler/multiImportExport.ts] ////
//// [consumer.ts]
import Drawing = require('./Drawing');
var addr = new Drawing.Math.Adder();
//// [Drawing.ts]
export import Math = require('Math/Math')
//// [Math.ts]
import Adder = require('Math/Adder');
var Math = {
Adder:Adder
};
export = Math
//// [Adder.ts]
class Adder {
add(a: number, b: number) {
}
}
export = Adder;
//// [Adder.js]
var Adder = (function () {
function Adder() {
}
Adder.prototype.add = function (a, b) {
};
return Adder;
})();
module.exports = Adder;
//// [Math.js]
var Adder = require('Math/Adder');
var Math = {
Adder: Adder
};
module.exports = Math;
//// [Drawing.js]
exports.Math = require('Math/Math');
//// [consumer.js]
var Drawing = require('./Drawing');
var addr = new Drawing.Math.Adder();

View File

@ -2,6 +2,7 @@
export class Game {
~~~~~~~~~~~~~~~~~~~
private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
!!! Expression or comma expected.
~
@ -40,7 +41,6 @@
!!! ';' expected.
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~
!!! Cannot find name 'DisplayPosition'.
~

View File

@ -1,13 +0,0 @@
//// [parser509546.ts]
export class Logger {
public
}
//// [parser509546.js]
var Logger = (function () {
function Logger() {
}
return Logger;
})();
exports.Logger = Logger;

View File

@ -1,13 +0,0 @@
//// [parser509546_1.ts]
export class Logger {
public
}
//// [parser509546_1.js]
var Logger = (function () {
function Logger() {
}
return Logger;
})();
exports.Logger = Logger;

View File

@ -1,16 +0,0 @@
//// [parser509546_2.ts]
"use strict";
export class Logger {
public
}
//// [parser509546_2.js]
"use strict";
var Logger = (function () {
function Logger() {
}
return Logger;
})();
exports.Logger = Logger;

View File

@ -1,8 +1,8 @@
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts (2 errors) ====
export export class Foo {
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! 'export' modifier already seen.
~~~~~~~~~~~~~~~~~~~~~~~~~
public Bar() {
~~~~~~~~~~~~~~~~
}

View File

@ -1,14 +0,0 @@
//// [parserArgumentList1.ts]
export function removeClass (node:HTMLElement, className:string) {
node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) {
return leftDelimiter.length + rightDelimiter.length === 2 ? ' ' : '';
});
}
//// [parserArgumentList1.js]
function removeClass(node, className) {
node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) {
return leftDelimiter.length + rightDelimiter.length === 2 ? ' ' : '';
});
}
exports.removeClass = removeClass;

View File

@ -1,35 +0,0 @@
//// [parserClass1.ts]
export class NullLogger implements ILogger {
public information(): boolean { return false; }
public debug(): boolean { return false; }
public warning(): boolean { return false; }
public error(): boolean { return false; }
public fatal(): boolean { return false; }
public log(s: string): void {
}
}
//// [parserClass1.js]
var NullLogger = (function () {
function NullLogger() {
}
NullLogger.prototype.information = function () {
return false;
};
NullLogger.prototype.debug = function () {
return false;
};
NullLogger.prototype.warning = function () {
return false;
};
NullLogger.prototype.error = function () {
return false;
};
NullLogger.prototype.fatal = function () {
return false;
};
NullLogger.prototype.log = function (s) {
};
return NullLogger;
})();
exports.NullLogger = NullLogger;

View File

@ -1,18 +0,0 @@
//// [parserClass2.ts]
export class LoggerAdapter implements ILogger {
constructor (public logger: ILogger) {
this._information = this.logger.information();
}
}
//// [parserClass2.js]
var LoggerAdapter = (function () {
function LoggerAdapter(logger) {
this.logger = logger;
this._information = this.logger.information();
}
return LoggerAdapter;
})();
exports.LoggerAdapter = LoggerAdapter;

View File

@ -1,18 +0,0 @@
//// [parserEnum1.ts]
export enum SignatureFlags {
None = 0,
IsIndexer = 1,
IsStringIndexer = 1 << 1,
IsNumberIndexer = 1 << 2,
}
//// [parserEnum1.js]
(function (SignatureFlags) {
SignatureFlags[SignatureFlags["None"] = 0] = "None";
SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer";
SignatureFlags[SignatureFlags["IsStringIndexer"] = 1 << 1] = "IsStringIndexer";
SignatureFlags[SignatureFlags["IsNumberIndexer"] = 1 << 2] = "IsNumberIndexer";
})(exports.SignatureFlags || (exports.SignatureFlags = {}));
var SignatureFlags = exports.SignatureFlags;

View File

@ -1,18 +0,0 @@
//// [parserEnum2.ts]
export enum SignatureFlags {
None = 0,
IsIndexer = 1,
IsStringIndexer = 1 << 1,
IsNumberIndexer = 1 << 2
}
//// [parserEnum2.js]
(function (SignatureFlags) {
SignatureFlags[SignatureFlags["None"] = 0] = "None";
SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer";
SignatureFlags[SignatureFlags["IsStringIndexer"] = 1 << 1] = "IsStringIndexer";
SignatureFlags[SignatureFlags["IsNumberIndexer"] = 1 << 2] = "IsNumberIndexer";
})(exports.SignatureFlags || (exports.SignatureFlags = {}));
var SignatureFlags = exports.SignatureFlags;

View File

@ -1,10 +0,0 @@
//// [parserEnum3.ts]
export enum SignatureFlags {
}
//// [parserEnum3.js]
(function (SignatureFlags) {
})(exports.SignatureFlags || (exports.SignatureFlags = {}));
var SignatureFlags = exports.SignatureFlags;

View File

@ -4,9 +4,9 @@
export enum SignatureFlags {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
,
~~~~~~~~~
~
!!! Enum member expected.
~~~~~~~~~
}
~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.

View File

@ -1,4 +0,0 @@
//// [parserExportAssignment1.ts]
export = foo
//// [parserExportAssignment1.js]

View File

@ -1,4 +0,0 @@
//// [parserExportAssignment2.ts]
export = foo;
//// [parserExportAssignment2.js]

View File

@ -1,6 +1,6 @@
==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts (2 errors) ====
export =
!!! Identifier expected.
~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! Identifier expected.

View File

@ -1,6 +1,6 @@
==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts (2 errors) ====
export = ;
~
!!! Identifier expected.
~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! Cannot compile external modules unless the '--module' flag is provided.
~
!!! Identifier expected.

View File

@ -1,13 +0,0 @@
//// [parserExportAssignment7.ts]
export class C {
}
export = B;
//// [parserExportAssignment7.js]
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;

View File

@ -1,13 +0,0 @@
//// [parserExportAssignment8.ts]
export = B;
export class C {
}
//// [parserExportAssignment8.js]
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;

View File

@ -1,8 +1,8 @@
==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration6.ts (2 errors) ====
export export interface I {
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~
!!! 'export' modifier already seen.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
~
!!! Cannot compile external modules unless the '--module' flag is provided.

View File

@ -1,5 +0,0 @@
//// [parserInterfaceDeclaration7.ts]
export interface I {
}
//// [parserInterfaceDeclaration7.js]

View File

@ -1,60 +0,0 @@
//// [parserModule1.ts]
export module CompilerDiagnostics {
export var debug = false;
export interface IDiagnosticWriter {
Alert(output: string): void;
}
export var diagnosticWriter: IDiagnosticWriter = null;
export var analysisPass: number = 0;
export function Alert(output: string) {
if (diagnosticWriter) {
diagnosticWriter.Alert(output);
}
}
export function debugPrint(s: string) {
if (debug) {
Alert(s);
}
}
export function assert(condition: boolean, s: string) {
if (debug) {
if (!condition) {
Alert(s);
}
}
}
}
//// [parserModule1.js]
(function (CompilerDiagnostics) {
CompilerDiagnostics.debug = false;
CompilerDiagnostics.diagnosticWriter = null;
CompilerDiagnostics.analysisPass = 0;
function Alert(output) {
if (CompilerDiagnostics.diagnosticWriter) {
CompilerDiagnostics.diagnosticWriter.Alert(output);
}
}
CompilerDiagnostics.Alert = Alert;
function debugPrint(s) {
if (CompilerDiagnostics.debug) {
Alert(s);
}
}
CompilerDiagnostics.debugPrint = debugPrint;
function assert(condition, s) {
if (CompilerDiagnostics.debug) {
if (!condition) {
Alert(s);
}
}
}
CompilerDiagnostics.assert = assert;
})(exports.CompilerDiagnostics || (exports.CompilerDiagnostics = {}));
var CompilerDiagnostics = exports.CompilerDiagnostics;

View File

@ -1,12 +0,0 @@
//// [privacyCheckTypeOfFunction.ts]
function foo() {
}
export var x: typeof foo;
export var b = foo;
//// [privacyCheckTypeOfFunction.js]
function foo() {
}
exports.x;
exports.b = foo;

View File

@ -1,242 +0,0 @@
//// [privacyTypeParameterOfFunction.ts]
class privateClass {
}
export class publicClass {
}
export interface publicInterfaceWithPrivateTypeParameters {
// TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1
new <T extends privateClass>(): privateClass;
// TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_type_1
<T extends privateClass>(): privateClass;
// TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_type_1
myMethod<T extends privateClass>(): privateClass;
}
export interface publicInterfaceWithPublicTypeParameters {
new <T extends publicClass>(): publicClass;
<T extends publicClass>(): publicClass;
myMethod<T extends publicClass>(): publicClass;
}
interface privateInterfaceWithPrivateTypeParameters {
new <T extends privateClass>(): privateClass;
<T extends privateClass>(): privateClass;
myMethod<T extends privateClass>(): privateClass;
}
interface privateInterfaceWithPublicTypeParameters {
new <T extends publicClass>(): publicClass;
<T extends publicClass>(): publicClass;
myMethod<T extends publicClass>(): publicClass;
}
export class publicClassWithWithPrivateTypeParameters {
// TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_type_1
static myPublicStaticMethod<T extends privateClass>() {
}
private static myPrivateStaticMethod<T extends privateClass>() { // No error
}
// TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_type_1
myPublicMethod<T extends privateClass>() {
}
private myPrivateMethod<T extends privateClass>() { // No error
}
}
export class publicClassWithWithPublicTypeParameters {
static myPublicStaticMethod<T extends publicClass>() {
}
private static myPrivateStaticMethod<T extends publicClass>() {
}
myPublicMethod<T extends publicClass>() {
}
private myPrivateMethod<T extends publicClass>() {
}
}
class privateClassWithWithPrivateTypeParameters {
static myPublicStaticMethod<T extends privateClass>() {
}
private static myPrivateStaticMethod<T extends privateClass>() { // No error
}
myPublicMethod<T extends privateClass>() {
}
private myPrivateMethod<T extends privateClass>() { // No error
}
}
class privateClassWithWithPublicTypeParameters {
static myPublicStaticMethod<T extends publicClass>() {
}
private static myPrivateStaticMethod<T extends publicClass>() {
}
myPublicMethod<T extends publicClass>() {
}
private myPrivateMethod<T extends publicClass>() {
}
}
// TypeParameter_0_of_exported_function_has_or_is_using_private_type_1
export function publicFunctionWithPrivateTypeParameters<T extends privateClass>() {
}
export function publicFunctionWithPublicTypeParameters<T extends publicClass>() {
}
function privateFunctionWithPrivateTypeParameters<T extends privateClass>() {
}
function privateFunctionWithPublicTypeParameters<T extends publicClass>() {
}
export interface publicInterfaceWithPublicTypeParametersWithoutExtends {
new <T>(): publicClass;
<T>(): publicClass;
myMethod<T>(): publicClass;
}
interface privateInterfaceWithPublicTypeParametersWithoutExtends {
new <T>(): publicClass;
<T>(): publicClass;
myMethod<T>(): publicClass;
}
export class publicClassWithWithPublicTypeParametersWithoutExtends {
static myPublicStaticMethod<T>() {
}
private static myPrivateStaticMethod<T>() {
}
myPublicMethod<T>() {
}
private myPrivateMethod<T>() {
}
}
class privateClassWithWithPublicTypeParametersWithoutExtends {
static myPublicStaticMethod<T>() {
}
private static myPrivateStaticMethod<T>() {
}
myPublicMethod<T>() {
}
private myPrivateMethod<T>() {
}
}
export function publicFunctionWithPublicTypeParametersWithoutExtends<T>() {
}
function privateFunctionWithPublicTypeParametersWithoutExtends<T>() {
}
//// [privacyTypeParameterOfFunction.js]
var privateClass = (function () {
function privateClass() {
}
return privateClass;
})();
var publicClass = (function () {
function publicClass() {
}
return publicClass;
})();
exports.publicClass = publicClass;
var publicClassWithWithPrivateTypeParameters = (function () {
function publicClassWithWithPrivateTypeParameters() {
}
publicClassWithWithPrivateTypeParameters.myPublicStaticMethod = function () {
};
publicClassWithWithPrivateTypeParameters.myPrivateStaticMethod = function () {
};
publicClassWithWithPrivateTypeParameters.prototype.myPublicMethod = function () {
};
publicClassWithWithPrivateTypeParameters.prototype.myPrivateMethod = function () {
};
return publicClassWithWithPrivateTypeParameters;
})();
exports.publicClassWithWithPrivateTypeParameters = publicClassWithWithPrivateTypeParameters;
var publicClassWithWithPublicTypeParameters = (function () {
function publicClassWithWithPublicTypeParameters() {
}
publicClassWithWithPublicTypeParameters.myPublicStaticMethod = function () {
};
publicClassWithWithPublicTypeParameters.myPrivateStaticMethod = function () {
};
publicClassWithWithPublicTypeParameters.prototype.myPublicMethod = function () {
};
publicClassWithWithPublicTypeParameters.prototype.myPrivateMethod = function () {
};
return publicClassWithWithPublicTypeParameters;
})();
exports.publicClassWithWithPublicTypeParameters = publicClassWithWithPublicTypeParameters;
var privateClassWithWithPrivateTypeParameters = (function () {
function privateClassWithWithPrivateTypeParameters() {
}
privateClassWithWithPrivateTypeParameters.myPublicStaticMethod = function () {
};
privateClassWithWithPrivateTypeParameters.myPrivateStaticMethod = function () {
};
privateClassWithWithPrivateTypeParameters.prototype.myPublicMethod = function () {
};
privateClassWithWithPrivateTypeParameters.prototype.myPrivateMethod = function () {
};
return privateClassWithWithPrivateTypeParameters;
})();
var privateClassWithWithPublicTypeParameters = (function () {
function privateClassWithWithPublicTypeParameters() {
}
privateClassWithWithPublicTypeParameters.myPublicStaticMethod = function () {
};
privateClassWithWithPublicTypeParameters.myPrivateStaticMethod = function () {
};
privateClassWithWithPublicTypeParameters.prototype.myPublicMethod = function () {
};
privateClassWithWithPublicTypeParameters.prototype.myPrivateMethod = function () {
};
return privateClassWithWithPublicTypeParameters;
})();
function publicFunctionWithPrivateTypeParameters() {
}
exports.publicFunctionWithPrivateTypeParameters = publicFunctionWithPrivateTypeParameters;
function publicFunctionWithPublicTypeParameters() {
}
exports.publicFunctionWithPublicTypeParameters = publicFunctionWithPublicTypeParameters;
function privateFunctionWithPrivateTypeParameters() {
}
function privateFunctionWithPublicTypeParameters() {
}
var publicClassWithWithPublicTypeParametersWithoutExtends = (function () {
function publicClassWithWithPublicTypeParametersWithoutExtends() {
}
publicClassWithWithPublicTypeParametersWithoutExtends.myPublicStaticMethod = function () {
};
publicClassWithWithPublicTypeParametersWithoutExtends.myPrivateStaticMethod = function () {
};
publicClassWithWithPublicTypeParametersWithoutExtends.prototype.myPublicMethod = function () {
};
publicClassWithWithPublicTypeParametersWithoutExtends.prototype.myPrivateMethod = function () {
};
return publicClassWithWithPublicTypeParametersWithoutExtends;
})();
exports.publicClassWithWithPublicTypeParametersWithoutExtends = publicClassWithWithPublicTypeParametersWithoutExtends;
var privateClassWithWithPublicTypeParametersWithoutExtends = (function () {
function privateClassWithWithPublicTypeParametersWithoutExtends() {
}
privateClassWithWithPublicTypeParametersWithoutExtends.myPublicStaticMethod = function () {
};
privateClassWithWithPublicTypeParametersWithoutExtends.myPrivateStaticMethod = function () {
};
privateClassWithWithPublicTypeParametersWithoutExtends.prototype.myPublicMethod = function () {
};
privateClassWithWithPublicTypeParametersWithoutExtends.prototype.myPrivateMethod = function () {
};
return privateClassWithWithPublicTypeParametersWithoutExtends;
})();
function publicFunctionWithPublicTypeParametersWithoutExtends() {
}
exports.publicFunctionWithPublicTypeParametersWithoutExtends = publicFunctionWithPublicTypeParametersWithoutExtends;
function privateFunctionWithPublicTypeParametersWithoutExtends() {
}

View File

@ -1,108 +0,0 @@
//// [privacyTypeParametersOfClass.ts]
class privateClass {
}
export class publicClass {
}
// TypeParameter_0_of_exported_class_1_has_or_is_using_private_type_2
export class publicClassWithPrivateTypeParameters<T extends privateClass> {
myMethod(val: T): T { // Error
return val;
}
}
export class publicClassWithPublicTypeParameters<T extends publicClass> {
myMethod(val: T): T { // No Error
return val;
}
}
class privateClassWithPrivateTypeParameters<T extends privateClass> {
myMethod(val: T): T { // No Error
return val;
}
}
class privateClassWithPublicTypeParameters<T extends publicClass> {
myMethod(val: T): T { // No Error
return val;
}
}
export class publicClassWithPublicTypeParametersWithoutExtends<T> {
myMethod(val: T): T { // No Error
return val;
}
}
class privateClassWithPublicTypeParametersWithoutExtends<T> {
myMethod(val: T): T { // No Error
return val;
}
}
//// [privacyTypeParametersOfClass.js]
var privateClass = (function () {
function privateClass() {
}
return privateClass;
})();
var publicClass = (function () {
function publicClass() {
}
return publicClass;
})();
exports.publicClass = publicClass;
var publicClassWithPrivateTypeParameters = (function () {
function publicClassWithPrivateTypeParameters() {
}
publicClassWithPrivateTypeParameters.prototype.myMethod = function (val) {
return val;
};
return publicClassWithPrivateTypeParameters;
})();
exports.publicClassWithPrivateTypeParameters = publicClassWithPrivateTypeParameters;
var publicClassWithPublicTypeParameters = (function () {
function publicClassWithPublicTypeParameters() {
}
publicClassWithPublicTypeParameters.prototype.myMethod = function (val) {
return val;
};
return publicClassWithPublicTypeParameters;
})();
exports.publicClassWithPublicTypeParameters = publicClassWithPublicTypeParameters;
var privateClassWithPrivateTypeParameters = (function () {
function privateClassWithPrivateTypeParameters() {
}
privateClassWithPrivateTypeParameters.prototype.myMethod = function (val) {
return val;
};
return privateClassWithPrivateTypeParameters;
})();
var privateClassWithPublicTypeParameters = (function () {
function privateClassWithPublicTypeParameters() {
}
privateClassWithPublicTypeParameters.prototype.myMethod = function (val) {
return val;
};
return privateClassWithPublicTypeParameters;
})();
var publicClassWithPublicTypeParametersWithoutExtends = (function () {
function publicClassWithPublicTypeParametersWithoutExtends() {
}
publicClassWithPublicTypeParametersWithoutExtends.prototype.myMethod = function (val) {
return val;
};
return publicClassWithPublicTypeParametersWithoutExtends;
})();
exports.publicClassWithPublicTypeParametersWithoutExtends = publicClassWithPublicTypeParametersWithoutExtends;
var privateClassWithPublicTypeParametersWithoutExtends = (function () {
function privateClassWithPublicTypeParametersWithoutExtends() {
}
privateClassWithPublicTypeParametersWithoutExtends.prototype.myMethod = function (val) {
return val;
};
return privateClassWithPublicTypeParametersWithoutExtends;
})();

View File

@ -1,83 +0,0 @@
//// [privacyTypeParametersOfInterface.ts]
class privateClass {
}
export class publicClass {
}
class privateClassT<T> {
}
export class publicClassT<T> {
}
// TypeParameter_0_of_exported_interface_1_has_or_is_using_private_type_2
export interface publicInterfaceWithPrivateTypeParameters<T extends privateClass> {
myMethod(val: T): T; // Error
myMethod0(): publicClassT<T>; // error
myMethod1(): privateClassT<privateClass>; // error
myMethod2(): privateClassT<publicClass>; // error
myMethod3(): publicClassT<privateClass>; //error
myMethod4(): publicClassT<publicClass>; // no error
}
export interface publicInterfaceWithPublicTypeParameters<T extends publicClass> {
myMethod(val: T): T; // No Error
myMethod0(): publicClassT<T>; // No error
myMethod1(): privateClassT<privateClass>; // error
myMethod2(): privateClassT<publicClass>; // error
myMethod3(): publicClassT<privateClass>; //error
myMethod4(): publicClassT<publicClass>; // no error
}
interface privateInterfaceWithPrivateTypeParameters<T extends privateClass> {
myMethod(val: T): T; // No Error
myMethod0(): publicClassT<T>; // No error
myMethod1(): privateClassT<privateClass>; // No error
myMethod2(): privateClassT<publicClass>; // No error
myMethod3(): publicClassT<privateClass>; //No error
myMethod4(): publicClassT<publicClass>; // no error
}
interface privateInterfaceWithPublicTypeParameters<T extends publicClass> {
myMethod(val: T): T; // No Error
myMethod0(): publicClassT<T>; // No error
myMethod1(): privateClassT<privateClass>; // No error
myMethod2(): privateClassT<publicClass>; // No error
myMethod3(): publicClassT<privateClass>; //No error
myMethod4(): publicClassT<publicClass>; // no error
}
export interface publicInterfaceWithPublicTypeParametersWithoutExtends<T> {
myMethod(val: T): T; // No Error
myMethod0(): publicClassT<T>; // No error
}
interface privateInterfaceWithPublicTypeParametersWithoutExtends<T> {
myMethod(val: T): T; // No Error
myMethod0(): publicClassT<T>; // No error
}
//// [privacyTypeParametersOfInterface.js]
var privateClass = (function () {
function privateClass() {
}
return privateClass;
})();
var publicClass = (function () {
function publicClass() {
}
return publicClass;
})();
exports.publicClass = publicClass;
var privateClassT = (function () {
function privateClassT() {
}
return privateClassT;
})();
var publicClassT = (function () {
function publicClassT() {
}
return publicClassT;
})();
exports.publicClassT = publicClassT;

View File

@ -1,35 +0,0 @@
//// [tests/cases/conformance/externalModules/relativePathToDeclarationFile.ts] ////
//// [foo.d.ts]
export declare module M2 {
export var x: boolean;
}
//// [other.d.ts]
export declare module M2 {
export var x: string;
}
//// [relMod.d.ts]
declare class Test {
constructor(x: number);
}
export = Test;
//// [file1.ts]
import foo = require('foo');
import other = require('./other');
import relMod = require('./sub/relMod');
if(foo.M2.x){
var x = new relMod(other.M2.x.charCodeAt(0));
}
//// [file1.js]
var foo = require('foo');
var other = require('./other');
var relMod = require('./sub/relMod');
if (foo.M2.x) {
var x = new relMod(other.M2.x.charCodeAt(0));
}

View File

@ -1,18 +0,0 @@
//// [scannerClass2.ts]
export class LoggerAdapter implements ILogger {
constructor (public logger: ILogger) {
this._information = this.logger.information();
}
}
//// [scannerClass2.js]
var LoggerAdapter = (function () {
function LoggerAdapter(logger) {
this.logger = logger;
this._information = this.logger.information();
}
return LoggerAdapter;
})();
exports.LoggerAdapter = LoggerAdapter;

View File

@ -1,12 +0,0 @@
//// [scannerEnum1.ts]
export enum CodeGenTarget {
ES3 = 0,
ES5 = 1,
}
//// [scannerEnum1.js]
(function (CodeGenTarget) {
CodeGenTarget[CodeGenTarget["ES3"] = 0] = "ES3";
CodeGenTarget[CodeGenTarget["ES5"] = 1] = "ES5";
})(exports.CodeGenTarget || (exports.CodeGenTarget = {}));
var CodeGenTarget = exports.CodeGenTarget;

View File

@ -61,7 +61,7 @@
}
export = this; // Should be an error
~~~~
!!! Identifier expected.
~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
!!! Cannot compile external modules unless the '--module' flag is provided.
~~~~
!!! Identifier expected.

View File

@ -1,106 +0,0 @@
//// [typeofANonExportedType.ts]
var x = 1;
export var r1: typeof x;
var y = { foo: '' };
export var r2: typeof y;
class C {
foo: string;
}
export var c: C;
var c2: C;
export var r3: typeof C;
export var r4: typeof c;
export var r4b: typeof c2;
interface I {
foo: string;
}
export var i: I;
var i2: I;
export var r5: typeof i;
export var r5: typeof i2;
module M {
export var foo = '';
export class C {
foo: string;
}
}
export var r6: typeof M;
export var r7: typeof M.foo;
import Z = M;
export var r8: typeof Z;
export var r9: typeof Z.foo;
enum E {
A
}
export var r10: typeof E;
export var r11: typeof E.A;
export var r12: typeof r12;
function foo() { }
module foo {
export var y = 1;
export class C {
foo: string;
}
}
export var r13: typeof foo;
//// [typeofANonExportedType.js]
var x = 1;
exports.r1;
var y = { foo: '' };
exports.r2;
var C = (function () {
function C() {
}
return C;
})();
exports.c;
var c2;
exports.r3;
exports.r4;
exports.r4b;
exports.i;
var i2;
exports.r5;
exports.r5;
var M;
(function (M) {
M.foo = '';
var C = (function () {
function C() {
}
return C;
})();
M.C = C;
})(M || (M = {}));
exports.r6;
exports.r7;
exports.r8;
exports.r9;
var E;
(function (E) {
E[E["A"] = 0] = "A";
})(E || (E = {}));
exports.r10;
exports.r11;
exports.r12;
function foo() {
}
var foo;
(function (foo) {
foo.y = 1;
var C = (function () {
function C() {
}
return C;
})();
foo.C = C;
})(foo || (foo = {}));
exports.r13;

View File

@ -1,109 +0,0 @@
//// [typeofAnExportedType.ts]
export var x = 1;
export var r1: typeof x;
export var y = { foo: '' };
export var r2: typeof y;
export class C {
foo: string;
}
export var c: C;
var c2: C;
export var r3: typeof C;
export var r4: typeof c;
export var r4b: typeof c2;
export interface I {
foo: string;
}
export var i: I;
var i2: I;
export var r5: typeof i;
export var r5: typeof i2;
export module M {
export var foo = '';
export class C {
foo: string;
}
}
export var r6: typeof M;
export var r7: typeof M.foo;
export import Z = M;
export var r8: typeof Z;
export var r9: typeof Z.foo;
export enum E {
A
}
export var r10: typeof E;
export var r11: typeof E.A;
export var r12: typeof r12;
export function foo() { }
export module foo {
export var y = 1;
export class C {
foo: string;
}
}
export var r13: typeof foo;
//// [typeofAnExportedType.js]
exports.x = 1;
exports.r1;
exports.y = { foo: '' };
exports.r2;
var C = (function () {
function C() {
}
return C;
})();
exports.C = C;
exports.c;
var c2;
exports.r3;
exports.r4;
exports.r4b;
exports.i;
var i2;
exports.r5;
exports.r5;
(function (M) {
M.foo = '';
var C = (function () {
function C() {
}
return C;
})();
M.C = C;
})(exports.M || (exports.M = {}));
var M = exports.M;
exports.r6;
exports.r7;
exports.Z = M;
exports.r8;
exports.r9;
(function (E) {
E[E["A"] = 0] = "A";
})(exports.E || (exports.E = {}));
var E = exports.E;
exports.r10;
exports.r11;
exports.r12;
function foo() {
}
exports.foo = foo;
(function (foo) {
foo.y = 1;
var C = (function () {
function C() {
}
return C;
})();
foo.C = C;
})(exports.foo || (exports.foo = {}));
var foo = exports.foo;
exports.r13;