Tests update for emitting declarations if no errors

This commit is contained in:
Sheetal Nandi
2015-10-28 13:07:08 -07:00
parent 3215438ddf
commit d14934e4da
96 changed files with 2074 additions and 1189 deletions
@@ -1,108 +0,0 @@
tests/cases/compiler/classdecl.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/classdecl.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/classdecl.ts(18,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/classdecl.ts(24,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/classdecl.ts (4 errors) ====
class a {
//constructor ();
constructor (n: number);
constructor (s: string);
constructor (ns: any) {
}
public pgF() { }
public pv;
public get d() {
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return 30;
}
public set d() {
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}
public static get p2() {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return { x: 30, y: 40 };
}
private static d2() {
}
private static get p3() {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return "string";
}
private pv3;
private foo(n: number): string;
private foo(s: string): string;
private foo(ns: any) {
return ns.toString();
}
}
class b extends a {
}
module m1 {
export class b {
}
class d {
}
export interface ib {
}
}
module m2 {
export module m3 {
export class c extends b {
}
export class ib2 implements m1.ib {
}
}
}
class c extends m1.b {
}
class ib2 implements m1.ib {
}
declare class aAmbient {
constructor (n: number);
constructor (s: string);
public pgF(): void;
public pv;
public d : number;
static p2 : { x: number; y: number; };
static d2();
static p3;
private pv3;
private foo(s);
}
class d {
private foo(n: number): string;
private foo(s: string): string;
private foo(ns: any) {
return ns.toString();
}
}
class e {
private foo(s: string): string;
private foo(n: number): string;
private foo(ns: any) {
return ns.toString();
}
}
+2 -2
View File
@@ -13,7 +13,7 @@ class a {
public get d() {
return 30;
}
public set d() {
public set d(a: number) {
}
public static get p2() {
@@ -107,7 +107,7 @@ var a = (function () {
get: function () {
return 30;
},
set: function () {
set: function (a) {
},
enumerable: true,
configurable: true
+198
View File
@@ -0,0 +1,198 @@
=== tests/cases/compiler/classdecl.ts ===
class a {
>a : Symbol(a, Decl(classdecl.ts, 0, 0))
//constructor ();
constructor (n: number);
>n : Symbol(n, Decl(classdecl.ts, 2, 17))
constructor (s: string);
>s : Symbol(s, Decl(classdecl.ts, 3, 17))
constructor (ns: any) {
>ns : Symbol(ns, Decl(classdecl.ts, 4, 17))
}
public pgF() { }
>pgF : Symbol(pgF, Decl(classdecl.ts, 6, 5))
public pv;
>pv : Symbol(pv, Decl(classdecl.ts, 8, 20))
public get d() {
>d : Symbol(d, Decl(classdecl.ts, 10, 14), Decl(classdecl.ts, 13, 5))
return 30;
}
public set d(a: number) {
>d : Symbol(d, Decl(classdecl.ts, 10, 14), Decl(classdecl.ts, 13, 5))
>a : Symbol(a, Decl(classdecl.ts, 14, 17))
}
public static get p2() {
>p2 : Symbol(a.p2, Decl(classdecl.ts, 15, 5))
return { x: 30, y: 40 };
>x : Symbol(x, Decl(classdecl.ts, 18, 16))
>y : Symbol(y, Decl(classdecl.ts, 18, 23))
}
private static d2() {
>d2 : Symbol(a.d2, Decl(classdecl.ts, 19, 5))
}
private static get p3() {
>p3 : Symbol(a.p3, Decl(classdecl.ts, 22, 5))
return "string";
}
private pv3;
>pv3 : Symbol(pv3, Decl(classdecl.ts, 25, 5))
private foo(n: number): string;
>foo : Symbol(foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35))
>n : Symbol(n, Decl(classdecl.ts, 28, 16))
private foo(s: string): string;
>foo : Symbol(foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35))
>s : Symbol(s, Decl(classdecl.ts, 29, 16))
private foo(ns: any) {
>foo : Symbol(foo, Decl(classdecl.ts, 26, 16), Decl(classdecl.ts, 28, 35), Decl(classdecl.ts, 29, 35))
>ns : Symbol(ns, Decl(classdecl.ts, 30, 16))
return ns.toString();
>ns : Symbol(ns, Decl(classdecl.ts, 30, 16))
}
}
class b extends a {
>b : Symbol(b, Decl(classdecl.ts, 33, 1))
>a : Symbol(a, Decl(classdecl.ts, 0, 0))
}
module m1 {
>m1 : Symbol(m1, Decl(classdecl.ts, 36, 1))
export class b {
>b : Symbol(b, Decl(classdecl.ts, 38, 11))
}
class d {
>d : Symbol(d, Decl(classdecl.ts, 40, 5))
}
export interface ib {
>ib : Symbol(ib, Decl(classdecl.ts, 42, 5))
}
}
module m2 {
>m2 : Symbol(m2, Decl(classdecl.ts, 47, 1))
export module m3 {
>m3 : Symbol(m3, Decl(classdecl.ts, 49, 11))
export class c extends b {
>c : Symbol(c, Decl(classdecl.ts, 51, 22))
>b : Symbol(b, Decl(classdecl.ts, 33, 1))
}
export class ib2 implements m1.ib {
>ib2 : Symbol(ib2, Decl(classdecl.ts, 53, 9))
>m1.ib : Symbol(m1.ib, Decl(classdecl.ts, 42, 5))
>m1 : Symbol(m1, Decl(classdecl.ts, 36, 1))
>ib : Symbol(m1.ib, Decl(classdecl.ts, 42, 5))
}
}
}
class c extends m1.b {
>c : Symbol(c, Decl(classdecl.ts, 57, 1))
>m1.b : Symbol(m1.b, Decl(classdecl.ts, 38, 11))
>m1 : Symbol(m1, Decl(classdecl.ts, 36, 1))
>b : Symbol(m1.b, Decl(classdecl.ts, 38, 11))
}
class ib2 implements m1.ib {
>ib2 : Symbol(ib2, Decl(classdecl.ts, 60, 1))
>m1.ib : Symbol(m1.ib, Decl(classdecl.ts, 42, 5))
>m1 : Symbol(m1, Decl(classdecl.ts, 36, 1))
>ib : Symbol(m1.ib, Decl(classdecl.ts, 42, 5))
}
declare class aAmbient {
>aAmbient : Symbol(aAmbient, Decl(classdecl.ts, 63, 1))
constructor (n: number);
>n : Symbol(n, Decl(classdecl.ts, 66, 17))
constructor (s: string);
>s : Symbol(s, Decl(classdecl.ts, 67, 17))
public pgF(): void;
>pgF : Symbol(pgF, Decl(classdecl.ts, 67, 28))
public pv;
>pv : Symbol(pv, Decl(classdecl.ts, 68, 23))
public d : number;
>d : Symbol(d, Decl(classdecl.ts, 69, 14))
static p2 : { x: number; y: number; };
>p2 : Symbol(aAmbient.p2, Decl(classdecl.ts, 70, 22))
>x : Symbol(x, Decl(classdecl.ts, 71, 17))
>y : Symbol(y, Decl(classdecl.ts, 71, 28))
static d2();
>d2 : Symbol(aAmbient.d2, Decl(classdecl.ts, 71, 42))
static p3;
>p3 : Symbol(aAmbient.p3, Decl(classdecl.ts, 72, 16))
private pv3;
>pv3 : Symbol(pv3, Decl(classdecl.ts, 73, 14))
private foo(s);
>foo : Symbol(foo, Decl(classdecl.ts, 74, 16))
>s : Symbol(s, Decl(classdecl.ts, 75, 16))
}
class d {
>d : Symbol(d, Decl(classdecl.ts, 76, 1))
private foo(n: number): string;
>foo : Symbol(foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35))
>n : Symbol(n, Decl(classdecl.ts, 79, 16))
private foo(s: string): string;
>foo : Symbol(foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35))
>s : Symbol(s, Decl(classdecl.ts, 80, 16))
private foo(ns: any) {
>foo : Symbol(foo, Decl(classdecl.ts, 78, 9), Decl(classdecl.ts, 79, 35), Decl(classdecl.ts, 80, 35))
>ns : Symbol(ns, Decl(classdecl.ts, 81, 16))
return ns.toString();
>ns : Symbol(ns, Decl(classdecl.ts, 81, 16))
}
}
class e {
>e : Symbol(e, Decl(classdecl.ts, 84, 1))
private foo(s: string): string;
>foo : Symbol(foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35))
>s : Symbol(s, Decl(classdecl.ts, 87, 16))
private foo(n: number): string;
>foo : Symbol(foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35))
>n : Symbol(n, Decl(classdecl.ts, 88, 16))
private foo(ns: any) {
>foo : Symbol(foo, Decl(classdecl.ts, 86, 9), Decl(classdecl.ts, 87, 35), Decl(classdecl.ts, 88, 35))
>ns : Symbol(ns, Decl(classdecl.ts, 89, 16))
return ns.toString();
>ns : Symbol(ns, Decl(classdecl.ts, 89, 16))
}
}
+212
View File
@@ -0,0 +1,212 @@
=== tests/cases/compiler/classdecl.ts ===
class a {
>a : a
//constructor ();
constructor (n: number);
>n : number
constructor (s: string);
>s : string
constructor (ns: any) {
>ns : any
}
public pgF() { }
>pgF : () => void
public pv;
>pv : any
public get d() {
>d : number
return 30;
>30 : number
}
public set d(a: number) {
>d : number
>a : number
}
public static get p2() {
>p2 : { x: number; y: number; }
return { x: 30, y: 40 };
>{ x: 30, y: 40 } : { x: number; y: number; }
>x : number
>30 : number
>y : number
>40 : number
}
private static d2() {
>d2 : () => void
}
private static get p3() {
>p3 : string
return "string";
>"string" : string
}
private pv3;
>pv3 : any
private foo(n: number): string;
>foo : { (n: number): string; (s: string): string; }
>n : number
private foo(s: string): string;
>foo : { (n: number): string; (s: string): string; }
>s : string
private foo(ns: any) {
>foo : { (n: number): string; (s: string): string; }
>ns : any
return ns.toString();
>ns.toString() : any
>ns.toString : any
>ns : any
>toString : any
}
}
class b extends a {
>b : b
>a : a
}
module m1 {
>m1 : typeof m1
export class b {
>b : b
}
class d {
>d : d
}
export interface ib {
>ib : ib
}
}
module m2 {
>m2 : typeof m2
export module m3 {
>m3 : typeof m3
export class c extends b {
>c : c
>b : b
}
export class ib2 implements m1.ib {
>ib2 : ib2
>m1.ib : any
>m1 : typeof m1
>ib : m1.ib
}
}
}
class c extends m1.b {
>c : c
>m1.b : m1.b
>m1 : typeof m1
>b : typeof m1.b
}
class ib2 implements m1.ib {
>ib2 : ib2
>m1.ib : any
>m1 : typeof m1
>ib : m1.ib
}
declare class aAmbient {
>aAmbient : aAmbient
constructor (n: number);
>n : number
constructor (s: string);
>s : string
public pgF(): void;
>pgF : () => void
public pv;
>pv : any
public d : number;
>d : number
static p2 : { x: number; y: number; };
>p2 : { x: number; y: number; }
>x : number
>y : number
static d2();
>d2 : () => any
static p3;
>p3 : any
private pv3;
>pv3 : any
private foo(s);
>foo : (s: any) => any
>s : any
}
class d {
>d : d
private foo(n: number): string;
>foo : { (n: number): string; (s: string): string; }
>n : number
private foo(s: string): string;
>foo : { (n: number): string; (s: string): string; }
>s : string
private foo(ns: any) {
>foo : { (n: number): string; (s: string): string; }
>ns : any
return ns.toString();
>ns.toString() : any
>ns.toString : any
>ns : any
>toString : any
}
}
class e {
>e : e
private foo(s: string): string;
>foo : { (s: string): string; (n: number): string; }
>s : string
private foo(n: number): string;
>foo : { (s: string): string; (n: number): string; }
>n : number
private foo(ns: any) {
>foo : { (s: string): string; (n: number): string; }
>ns : any
return ns.toString();
>ns.toString() : any
>ns.toString : any
>ns : any
>toString : any
}
}
@@ -4,8 +4,3 @@ interface I {
}
//// [computedPropertyNamesDeclarationEmit3_ES5.js]
//// [computedPropertyNamesDeclarationEmit3_ES5.d.ts]
interface I {
}
@@ -4,8 +4,3 @@ interface I {
}
//// [computedPropertyNamesDeclarationEmit3_ES6.js]
//// [computedPropertyNamesDeclarationEmit3_ES6.d.ts]
interface I {
}
@@ -5,8 +5,3 @@ var v: {
//// [computedPropertyNamesDeclarationEmit4_ES5.js]
var v;
//// [computedPropertyNamesDeclarationEmit4_ES5.d.ts]
declare var v: {
};
@@ -5,8 +5,3 @@ var v: {
//// [computedPropertyNamesDeclarationEmit4_ES6.js]
var v;
//// [computedPropertyNamesDeclarationEmit4_ES6.d.ts]
declare var v: {
};
-10
View File
@@ -20,13 +20,3 @@ const enum D {
// it is an error for a member declaration to specify an expression that isn't classified as a constant enum expression.
// Error : not a constant enum expression
var CONST = 9000 % 2;
//// [constEnum2.d.ts]
declare const CONST: number;
declare const enum D {
d = 10,
e,
f,
g,
}
@@ -31,16 +31,3 @@ var g;
g = "string";
function foo(x) { }
2 /* B */ = 3;
//// [constEnumPropertyAccess2.d.ts]
declare const enum G {
A = 1,
B = 2,
C = 3,
D = 2,
}
declare var z: typeof G;
declare var z1: any;
declare var g: G;
declare function foo(x: G): void;
@@ -1,20 +0,0 @@
tests/cases/compiler/declFileObjectLiteralWithAccessors.ts(5,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/declFileObjectLiteralWithAccessors.ts(6,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/declFileObjectLiteralWithAccessors.ts (2 errors) ====
function /*1*/makePoint(x: number) {
return {
b: 10,
get x() { return x; },
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
set x(a: number) { this.b = a; }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
};
};
var /*4*/point = makePoint(2);
var /*2*/x = point.x;
point./*3*/x = 30;
@@ -0,0 +1,36 @@
=== tests/cases/compiler/declFileObjectLiteralWithAccessors.ts ===
function /*1*/makePoint(x: number) {
>makePoint : Symbol(makePoint, Decl(declFileObjectLiteralWithAccessors.ts, 0, 0))
>x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 1, 24))
return {
b: 10,
>b : Symbol(b, Decl(declFileObjectLiteralWithAccessors.ts, 2, 12))
get x() { return x; },
>x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 3, 14), Decl(declFileObjectLiteralWithAccessors.ts, 4, 30))
>x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 1, 24))
set x(a: number) { this.b = a; }
>x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 3, 14), Decl(declFileObjectLiteralWithAccessors.ts, 4, 30))
>a : Symbol(a, Decl(declFileObjectLiteralWithAccessors.ts, 5, 14))
>a : Symbol(a, Decl(declFileObjectLiteralWithAccessors.ts, 5, 14))
};
};
var /*4*/point = makePoint(2);
>point : Symbol(point, Decl(declFileObjectLiteralWithAccessors.ts, 8, 3))
>makePoint : Symbol(makePoint, Decl(declFileObjectLiteralWithAccessors.ts, 0, 0))
var /*2*/x = point.x;
>x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 9, 3))
>point.x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 3, 14), Decl(declFileObjectLiteralWithAccessors.ts, 4, 30))
>point : Symbol(point, Decl(declFileObjectLiteralWithAccessors.ts, 8, 3))
>x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 3, 14), Decl(declFileObjectLiteralWithAccessors.ts, 4, 30))
point./*3*/x = 30;
>point./*3*/x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 3, 14), Decl(declFileObjectLiteralWithAccessors.ts, 4, 30))
>point : Symbol(point, Decl(declFileObjectLiteralWithAccessors.ts, 8, 3))
>x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 3, 14), Decl(declFileObjectLiteralWithAccessors.ts, 4, 30))
@@ -0,0 +1,47 @@
=== tests/cases/compiler/declFileObjectLiteralWithAccessors.ts ===
function /*1*/makePoint(x: number) {
>makePoint : (x: number) => { b: number; x: number; }
>x : number
return {
>{ b: 10, get x() { return x; }, set x(a: number) { this.b = a; } } : { b: number; x: number; }
b: 10,
>b : number
>10 : number
get x() { return x; },
>x : number
>x : number
set x(a: number) { this.b = a; }
>x : number
>a : number
>this.b = a : number
>this.b : any
>this : any
>b : any
>a : number
};
};
var /*4*/point = makePoint(2);
>point : { b: number; x: number; }
>makePoint(2) : { b: number; x: number; }
>makePoint : (x: number) => { b: number; x: number; }
>2 : number
var /*2*/x = point.x;
>x : number
>point.x : number
>point : { b: number; x: number; }
>x : number
point./*3*/x = 30;
>point./*3*/x = 30 : number
>point./*3*/x : number
>point : { b: number; x: number; }
>x : number
>30 : number
@@ -1,15 +0,0 @@
tests/cases/compiler/declFileObjectLiteralWithOnlyGetter.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/declFileObjectLiteralWithOnlyGetter.ts (1 errors) ====
function /*1*/makePoint(x: number) {
return {
get x() { return x; },
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
};
};
var /*4*/point = makePoint(2);
var /*2*/x = point./*3*/x;
@@ -12,7 +12,7 @@ var /*2*/x = point./*3*/x;
//// [declFileObjectLiteralWithOnlyGetter.js]
function makePoint(x) {
return {
get x() { return x; }
get x() { return x; },
};
}
;
@@ -0,0 +1,23 @@
=== tests/cases/compiler/declFileObjectLiteralWithOnlyGetter.ts ===
function /*1*/makePoint(x: number) {
>makePoint : Symbol(makePoint, Decl(declFileObjectLiteralWithOnlyGetter.ts, 0, 0))
>x : Symbol(x, Decl(declFileObjectLiteralWithOnlyGetter.ts, 1, 24))
return {
get x() { return x; },
>x : Symbol(x, Decl(declFileObjectLiteralWithOnlyGetter.ts, 2, 12))
>x : Symbol(x, Decl(declFileObjectLiteralWithOnlyGetter.ts, 1, 24))
};
};
var /*4*/point = makePoint(2);
>point : Symbol(point, Decl(declFileObjectLiteralWithOnlyGetter.ts, 6, 3))
>makePoint : Symbol(makePoint, Decl(declFileObjectLiteralWithOnlyGetter.ts, 0, 0))
var /*2*/x = point./*3*/x;
>x : Symbol(x, Decl(declFileObjectLiteralWithOnlyGetter.ts, 7, 3))
>point./*3*/x : Symbol(x, Decl(declFileObjectLiteralWithOnlyGetter.ts, 2, 12))
>point : Symbol(point, Decl(declFileObjectLiteralWithOnlyGetter.ts, 6, 3))
>x : Symbol(x, Decl(declFileObjectLiteralWithOnlyGetter.ts, 2, 12))
@@ -0,0 +1,27 @@
=== tests/cases/compiler/declFileObjectLiteralWithOnlyGetter.ts ===
function /*1*/makePoint(x: number) {
>makePoint : (x: number) => { x: number; }
>x : number
return {
>{ get x() { return x; }, } : { x: number; }
get x() { return x; },
>x : number
>x : number
};
};
var /*4*/point = makePoint(2);
>point : { x: number; }
>makePoint(2) : { x: number; }
>makePoint : (x: number) => { x: number; }
>2 : number
var /*2*/x = point./*3*/x;
>x : number
>point./*3*/x : number
>point : { x: number; }
>x : number
@@ -1,15 +0,0 @@
tests/cases/compiler/declFileObjectLiteralWithOnlySetter.ts(5,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/declFileObjectLiteralWithOnlySetter.ts (1 errors) ====
function /*1*/makePoint(x: number) {
return {
b: 10,
set x(a: number) { this.b = a; }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
};
};
var /*3*/point = makePoint(2);
point./*2*/x = 30;
@@ -0,0 +1,26 @@
=== tests/cases/compiler/declFileObjectLiteralWithOnlySetter.ts ===
function /*1*/makePoint(x: number) {
>makePoint : Symbol(makePoint, Decl(declFileObjectLiteralWithOnlySetter.ts, 0, 0))
>x : Symbol(x, Decl(declFileObjectLiteralWithOnlySetter.ts, 1, 24))
return {
b: 10,
>b : Symbol(b, Decl(declFileObjectLiteralWithOnlySetter.ts, 2, 12))
set x(a: number) { this.b = a; }
>x : Symbol(x, Decl(declFileObjectLiteralWithOnlySetter.ts, 3, 14))
>a : Symbol(a, Decl(declFileObjectLiteralWithOnlySetter.ts, 4, 14))
>a : Symbol(a, Decl(declFileObjectLiteralWithOnlySetter.ts, 4, 14))
};
};
var /*3*/point = makePoint(2);
>point : Symbol(point, Decl(declFileObjectLiteralWithOnlySetter.ts, 7, 3))
>makePoint : Symbol(makePoint, Decl(declFileObjectLiteralWithOnlySetter.ts, 0, 0))
point./*2*/x = 30;
>point./*2*/x : Symbol(x, Decl(declFileObjectLiteralWithOnlySetter.ts, 3, 14))
>point : Symbol(point, Decl(declFileObjectLiteralWithOnlySetter.ts, 7, 3))
>x : Symbol(x, Decl(declFileObjectLiteralWithOnlySetter.ts, 3, 14))
@@ -0,0 +1,37 @@
=== tests/cases/compiler/declFileObjectLiteralWithOnlySetter.ts ===
function /*1*/makePoint(x: number) {
>makePoint : (x: number) => { b: number; x: number; }
>x : number
return {
>{ b: 10, set x(a: number) { this.b = a; } } : { b: number; x: number; }
b: 10,
>b : number
>10 : number
set x(a: number) { this.b = a; }
>x : number
>a : number
>this.b = a : number
>this.b : any
>this : any
>b : any
>a : number
};
};
var /*3*/point = makePoint(2);
>point : { b: number; x: number; }
>makePoint(2) : { b: number; x: number; }
>makePoint : (x: number) => { b: number; x: number; }
>2 : number
point./*2*/x = 30;
>point./*2*/x = 30 : number
>point./*2*/x : number
>point : { b: number; x: number; }
>x : number
>30 : number
@@ -1,29 +0,0 @@
tests/cases/compiler/declFilePrivateStatic.ts(9,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/declFilePrivateStatic.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/declFilePrivateStatic.ts(12,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/declFilePrivateStatic.ts(13,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/declFilePrivateStatic.ts (4 errors) ====
class C {
private static x = 1;
static y = 1;
private static a() { }
static b() { }
private static get c() { return 1; }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
static get d() { return 1; }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
private static set e(v) { }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
static set f(v) { }
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
}
@@ -0,0 +1,31 @@
=== tests/cases/compiler/declFilePrivateStatic.ts ===
class C {
>C : Symbol(C, Decl(declFilePrivateStatic.ts, 0, 0))
private static x = 1;
>x : Symbol(C.x, Decl(declFilePrivateStatic.ts, 1, 9))
static y = 1;
>y : Symbol(C.y, Decl(declFilePrivateStatic.ts, 2, 25))
private static a() { }
>a : Symbol(C.a, Decl(declFilePrivateStatic.ts, 3, 17))
static b() { }
>b : Symbol(C.b, Decl(declFilePrivateStatic.ts, 5, 26))
private static get c() { return 1; }
>c : Symbol(C.c, Decl(declFilePrivateStatic.ts, 6, 18))
static get d() { return 1; }
>d : Symbol(C.d, Decl(declFilePrivateStatic.ts, 8, 40))
private static set e(v) { }
>e : Symbol(C.e, Decl(declFilePrivateStatic.ts, 9, 32))
>v : Symbol(v, Decl(declFilePrivateStatic.ts, 11, 25))
static set f(v) { }
>f : Symbol(C.f, Decl(declFilePrivateStatic.ts, 11, 31))
>v : Symbol(v, Decl(declFilePrivateStatic.ts, 12, 17))
}
@@ -0,0 +1,35 @@
=== tests/cases/compiler/declFilePrivateStatic.ts ===
class C {
>C : C
private static x = 1;
>x : number
>1 : number
static y = 1;
>y : number
>1 : number
private static a() { }
>a : () => void
static b() { }
>b : () => void
private static get c() { return 1; }
>c : number
>1 : number
static get d() { return 1; }
>d : number
>1 : number
private static set e(v) { }
>e : any
>v : any
static set f(v) { }
>f : any
>v : any
}
@@ -17,27 +17,3 @@ function h(_a) {
function h1(_a) {
var a = _a[0], b = _a[1][0], c = _a[2][0][0], _b = _a[3], _c = _b.x, x = _c === void 0 ? 10 : _c, _d = _b.y, y = _d === void 0 ? [1, 2, 3] : _d, _e = _b.z, a1 = _e.a1, b1 = _e.b1;
}
//// [declarationEmitDestructuring2.d.ts]
declare function f({x, y: [a, b, c, d]}?: {
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]], {
x?: number;
y: [any, any, any];
z: {
a1: any;
b1: any;
};
}]): void;
declare function h1([a, [b], [[c]], {x, y, z: {a1, b1}}]: [any, [any], [[any]], {
x?: number;
y?: number[];
z: {
a1: any;
b1: any;
};
}]): void;
@@ -26,13 +26,3 @@ function baz3(_a) { }
function baz4(_a) {
var _a = { x: 10 };
}
//// [declarationEmitDestructuring4.d.ts]
declare function baz([]: any[]): void;
declare function baz1([]?: number[]): void;
declare function baz2([[]]?: [number[]]): void;
declare function baz3({}: {}): void;
declare function baz4({}?: {
x: number;
}): void;
@@ -17,15 +17,3 @@ var _f = [], a11 = _f[0], b11 = _f[1], c11 = _f[2];
var _g = [1, ["hello", { x12: 5, y12: true }]], a2 = _g[0], _h = _g[1], _j = _h === void 0 ? ["abc", { x12: 10, y12: false }] : _h, b2 = _j[0], _k = _j[1], x12 = _k.x12, c2 = _k.y12;
var _l = [1, "hello"], x13 = _l[0], y13 = _l[1];
var _m = [[x13, y13], { x: x13, y: y13 }], a3 = _m[0], b3 = _m[1];
//// [declarationEmitDestructuringArrayPattern2.d.ts]
declare var x10: number, y10: string, z10: boolean;
declare var x11: number, y11: string;
declare var a11: any, b11: any, c11: any;
declare var a2: number, b2: string, x12: number, c2: boolean;
declare var x13: number, y13: string;
declare var a3: (number | string)[], b3: {
x: number;
y: string;
};
@@ -43,22 +43,3 @@ var m;
_a = f15(), m.a4 = _a.a4, m.b4 = _a.b4, m.c4 = _a.c4;
var _a;
})(m || (m = {}));
//// [declarationEmitDestructuringObjectLiteralPattern.d.ts]
declare var x4: number;
declare var y5: string;
declare var x6: number, y6: string;
declare var a1: number;
declare var b1: string;
declare var a2: number, b2: string;
declare var x11: number, y11: string, z11: boolean;
declare function f15(): {
a4: string;
b4: number;
c4: boolean;
};
declare var a4: string, b4: number, c4: boolean;
declare module m {
var a4: string, b4: number, c4: boolean;
}
@@ -16,12 +16,3 @@ var _b = { x6: 5, y6: "hello" }, x6 = _b.x6, y6 = _b.y6;
var a1 = { x7: 5, y7: "hello" }.x7;
var b1 = { x8: 5, y8: "hello" }.y8;
var _c = { x9: 5, y9: "hello" }, a2 = _c.x9, b2 = _c.y9;
//// [declarationEmitDestructuringObjectLiteralPattern1.d.ts]
declare var x4: number;
declare var y5: string;
declare var x6: number, y6: string;
declare var a1: number;
declare var b1: string;
declare var a2: number, b2: string;
@@ -38,24 +38,3 @@ var C3 = (function () {
}
return C3;
})();
//// [declarationEmitDestructuringParameterProperties.d.ts]
declare class C1 {
x: string, y: string, z: string;
constructor([x, y, z]: string[]);
}
declare type TupleType1 = [string, number, boolean];
declare class C2 {
x: string, y: number, z: boolean;
constructor([x, y, z]: TupleType1);
}
declare type ObjType1 = {
x: number;
y: string;
z: boolean;
};
declare class C3 {
x: number, y: string, z: boolean;
constructor({x, y, z}: ObjType1);
}
@@ -11,12 +11,3 @@ function foo(_a) {
function foo1(_a) {
var x = _a.x, y = _a.y, z = _a.z;
}
//// [declarationEmitDestructuringWithOptionalBindingParameters.d.ts]
declare function foo([x, y, z]?: [string, number, boolean]): void;
declare function foo1({x, y, z}?: {
x: string;
y: number;
z: boolean;
}): void;
@@ -5,7 +5,3 @@ var x = 0;
//// [declarationEmit_invalidReference2.js]
/// <reference path="invalid.ts" />
var x = 0;
//// [declarationEmit_invalidReference2.d.ts]
declare var x: number;
@@ -75,36 +75,3 @@ var v = 3;
var Foo;
(function (Foo) {
})(Foo || (Foo = {}));
//// [file1.d.ts]
interface I {
}
declare class C1 {
}
declare class C2 {
}
declare function f(): void;
declare var v: number;
declare class Foo {
static x: number;
}
declare module N {
module F {
}
}
//// [file2.d.ts]
declare class I {
}
interface C1 {
}
declare function C2(): void;
declare class f {
}
declare var v: number;
declare module Foo {
var x: number;
}
declare module N {
function F(): any;
}
@@ -9,11 +9,3 @@ function f(_a) {
var _a = { a: 1, b: "2", c: true };
var x, y, z;
}
//// [emptyObjectBindingPatternParameter04.d.ts]
declare function f({}?: {
a: number;
b: string;
c: boolean;
}): void;
@@ -19,6 +19,3 @@
var _e = void 0;
var _f = void 0;
})();
//// [emptyVariableDeclarationBindingPatterns02_ES5.d.ts]
@@ -19,6 +19,3 @@
let [];
const [];
})();
//// [emptyVariableDeclarationBindingPatterns02_ES6.d.ts]
@@ -9,8 +9,3 @@ export = f;
function f() { }
exports.f = f;
module.exports = f;
//// [es5ExportEquals.d.ts]
export declare function f(): void;
export = f;
@@ -7,8 +7,3 @@ export = f;
//// [es6ExportEquals.js]
export function f() { }
//// [es6ExportEquals.d.ts]
export declare function f(): void;
export = f;
@@ -41,4 +41,3 @@ var x1 = defaultBinding6;
//// [es6ImportDefaultBindingFollowedWithNamedImport1_0.d.ts]
declare var a: number;
export default a;
//// [es6ImportDefaultBindingFollowedWithNamedImport1_1.d.ts]
@@ -42,4 +42,3 @@ var x = es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0_6.default;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.d.ts]
declare var a: number;
export default a;
//// [es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.d.ts]
@@ -42,10 +42,3 @@ exports.x1 = server_6.default;
//// [server.d.ts]
declare var a: number;
export default a;
//// [client.d.ts]
export declare var x1: number;
export declare var x1: number;
export declare var x1: number;
export declare var x1: number;
export declare var x1: number;
export declare var x1: number;
@@ -88,15 +88,3 @@ export declare class a12 {
}
export declare class x11 {
}
//// [client.d.ts]
import { a } from "./server";
export declare var x1: a;
import { a11 as b } from "./server";
export declare var x2: b;
import { x, a12 as y } from "./server";
export declare var x4: x;
export declare var x5: y;
import { x11 as z } from "./server";
export declare var x3: z;
import { m } from "./server";
export declare var x6: m;
@@ -46,11 +46,3 @@ exports.x6 = new server_6.default();
declare class a {
}
export default a;
//// [client.d.ts]
import defaultBinding1 from "./server";
export declare var x1: defaultBinding1;
export declare var x2: defaultBinding1;
export declare var x3: defaultBinding1;
export declare var x4: defaultBinding1;
export declare var x5: defaultBinding1;
export declare var x6: defaultBinding1;
@@ -43,4 +43,3 @@ var x1 = es6ImportDefaultBindingFollowedWithNamedImportInEs5_0_5.m;
export declare var a: number;
export declare var x: number;
export declare var m: number;
//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.d.ts]
@@ -47,10 +47,3 @@ export declare var x: number;
export declare var m: number;
declare var _default: {};
export default _default;
//// [client.d.ts]
export declare var x1: number;
export declare var x1: number;
export declare var x1: number;
export declare var x1: number;
export declare var x1: number;
export declare var x1: number;
@@ -17,4 +17,3 @@ var x = nameSpaceBinding.a;
//// [es6ImportDefaultBindingFollowedWithNamespaceBinding_0.d.ts]
export declare var a: number;
//// [es6ImportDefaultBindingFollowedWithNamespaceBinding_1.d.ts]
@@ -25,5 +25,3 @@ define(["require", "exports", "server"], function (require, exports, server_1) {
//// [server.d.ts]
declare var a: number;
export default a;
//// [client.d.ts]
export declare var x: number;
@@ -23,6 +23,3 @@ exports.x = new nameSpaceBinding.a();
//// [server.d.ts]
export declare class a {
}
//// [client.d.ts]
import * as nameSpaceBinding from "./server";
export declare var x: nameSpaceBinding.a;
@@ -17,4 +17,3 @@ var x = nameSpaceBinding.a;
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.d.ts]
export declare var a: number;
//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.d.ts]
@@ -17,5 +17,3 @@ exports.x = nameSpaceBinding.a;
//// [server.d.ts]
export declare var a: number;
//// [client.d.ts]
export declare var x: number;
@@ -17,4 +17,3 @@ module.exports = a;
//// [es6ImportDefaultBindingInEs5_0.d.ts]
declare var a: number;
export = a;
//// [es6ImportDefaultBindingInEs5_1.d.ts]
@@ -25,5 +25,3 @@ define(["require", "exports", "server"], function (require, exports, server_1) {
//// [server.d.ts]
declare var a: number;
export default a;
//// [client.d.ts]
export declare var x: number;
@@ -22,5 +22,3 @@ define(["require", "exports", "server"], function (require, exports, nameSpaceBi
//// [server.d.ts]
export declare var a: number;
//// [client.d.ts]
export declare var x: number;
@@ -82,16 +82,3 @@ export declare var x1: number;
export declare var z1: number;
export declare var z2: number;
export declare var aaaa: number;
//// [client.d.ts]
export declare var xxxx: number;
export declare var xxxx: number;
export declare var xxxx: number;
export declare var xxxx: number;
export declare var xxxx: number;
export declare var xxxx: number;
export declare var xxxx: number;
export declare var xxxx: number;
export declare var xxxx: number;
export declare var xxxx: number;
export declare var z111: number;
export declare var z2: number;
@@ -15,5 +15,3 @@ require("server");
//// [server.d.ts]
export declare var a: number;
//// [client.d.ts]
export import "server";
@@ -56,20 +56,3 @@ var Bbb;
__export(require()); // this line causes the nullref
})(Bbb || (Bbb = {}));
var a;
//// [exportDeclarationInInternalModule.d.ts]
declare class Bbb {
}
declare class Aaa extends Bbb {
}
declare module Aaa {
class SomeType {
}
}
declare module Bbb {
class SomeType {
}
export * from Aaa;
}
declare var a: Bbb.SomeType;
@@ -56,10 +56,3 @@ export declare class A {
static r: any;
}
//// [exportStarFromEmptyModule_module2.d.ts]
//// [exportStarFromEmptyModule_module3.d.ts]
export * from "./exportStarFromEmptyModule_module2";
export * from "./exportStarFromEmptyModule_module1";
export declare class A {
static q: any;
}
//// [exportStarFromEmptyModule_module4.d.ts]
@@ -17,10 +17,11 @@ declare class Bar {
EmitSkipped: false
FileName : tests/cases/fourslash/inputFile2.js.map
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["inputFile2.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,QAAQ,CAAC;AACjB,IAAI,CAAC,GAAG,qBAAC,GAAG,KAAC,IAAI,GAAG,CAAE,EAAG,CAAA"}FileName : tests/cases/fourslash/inputFile2.js
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["inputFile2.tsx"],"names":[],"mappings":"AACA,IAAI,CAAC,GAAG,QAAQ,CAAC;AACjB,IAAI,CAAC,GAAG,qBAAC,GAAG,KAAC,IAAI,GAAG,CAAE,EAAG,CAAA"}FileName : tests/cases/fourslash/inputFile2.js
var y = "my div";
var x = React.createElement("div", {"name": y});
//# sourceMappingURL=inputFile2.js.mapFileName : tests/cases/fourslash/inputFile2.d.ts
declare var React: any;
declare var y: string;
declare var x: any;
@@ -1,6 +1,4 @@
EmitSkipped: false
FileName : tests/cases/fourslash/inputFile.js
var x = "hello world";
FileName : tests/cases/fourslash/inputFile.d.ts
declare var x: number;
@@ -5,7 +5,4 @@ FileName : out.js
var noErrors = true;
// File not emitted, and contains semantic errors
var semanticError = "string";
FileName : out.d.ts
declare var noErrors: boolean;
declare var semanticError: boolean;
-304
View File
@@ -1107,307 +1107,3 @@ define(["require", "exports"], function (require, exports) {
})(eM = exports.eM || (exports.eM = {}));
;
});
//// [giant.d.ts]
export declare var eV: any;
export declare function eF(): void;
export declare class eC {
constructor();
pV: any;
private rV;
pF(): void;
private rF();
pgF(): void;
pgF: any;
psF(param: any): void;
psF: any;
private rgF();
private rgF;
private rsF(param);
private rsF;
static tV: any;
static tF(): void;
static tsF(param: any): void;
static tsF: any;
static tgF(): void;
static tgF: any;
}
export interface eI {
(): any;
(): number;
(p: any): any;
(p1: string): any;
(p2?: string): any;
(...p3: any[]): any;
(p4: string, p5?: string): any;
(p6: string, ...p7: any[]): any;
new (): any;
new (): number;
new (p: string): any;
new (p2?: string): any;
new (...p3: any[]): any;
new (p4: string, p5?: string): any;
new (p6: string, ...p7: any[]): any;
[p1: string]: any;
[p2: string, p3: number]: any;
p: any;
p1?: any;
p2?: string;
p3(): any;
p4?(): any;
p5?(): void;
p6(pa1: any): void;
p7(pa1: any, pa2: any): void;
p7?(pa1: any, pa2: any): void;
}
export declare module eM {
var eV: any;
function eF(): void;
class eC {
constructor();
pV: any;
private rV;
pF(): void;
private rF();
pgF(): void;
pgF: any;
psF(param: any): void;
psF: any;
private rgF();
private rgF;
private rsF(param);
private rsF;
static tV: any;
static tF(): void;
static tsF(param: any): void;
static tsF: any;
static tgF(): void;
static tgF: any;
}
interface eI {
(): any;
(): number;
(p: any): any;
(p1: string): any;
(p2?: string): any;
(...p3: any[]): any;
(p4: string, p5?: string): any;
(p6: string, ...p7: any[]): any;
new (): any;
new (): number;
new (p: string): any;
new (p2?: string): any;
new (...p3: any[]): any;
new (p4: string, p5?: string): any;
new (p6: string, ...p7: any[]): any;
[p1: string]: any;
[p2: string, p3: number]: any;
p: any;
p1?: any;
p2?: string;
p3(): any;
p4?(): any;
p5?(): void;
p6(pa1: any): void;
p7(pa1: any, pa2: any): void;
p7?(pa1: any, pa2: any): void;
}
module eM {
var eV: any;
function eF(): void;
class eC {
}
interface eI {
}
module eM {
}
var eaV: any;
function eaF(): void;
class eaC {
}
module eaM {
}
}
var eaV: any;
function eaF(): void;
class eaC {
constructor();
pV: any;
private rV;
pF(): void;
private rF();
pgF(): void;
pgF: any;
psF(param: any): void;
psF: any;
private rgF();
private rgF;
private rsF(param);
private rsF;
static tV: any;
static tF(): void;
static tsF(param: any): void;
static tsF: any;
static tgF(): void;
static tgF: any;
}
module eaM {
var V: any;
function F(): void;
class C {
}
interface I {
}
module M {
}
var eV: any;
function eF(): void;
class eC {
}
interface eI {
}
module eM {
}
}
}
export declare var eaV: any;
export declare function eaF(): void;
export declare class eaC {
constructor();
pV: any;
private rV;
pF(): void;
private rF();
pgF(): void;
pgF: any;
psF(param: any): void;
psF: any;
private rgF();
private rgF;
private rsF(param);
private rsF;
static tV: any;
static tF(): void;
static tsF(param: any): void;
static tsF: any;
static tgF(): void;
static tgF: any;
}
export declare module eaM {
var V: any;
function F(): void;
class C {
constructor();
pV: any;
private rV;
pF(): void;
static tV: any;
static tF(): void;
}
interface I {
(): any;
(): number;
(p: string): any;
(p2?: string): any;
(...p3: any[]): any;
(p4: string, p5?: string): any;
(p6: string, ...p7: any[]): any;
new (): any;
new (): number;
new (p: string): any;
new (p2?: string): any;
new (...p3: any[]): any;
new (p4: string, p5?: string): any;
new (p6: string, ...p7: any[]): any;
[p1: string]: any;
[p2: string, p3: number]: any;
p: any;
p1?: any;
p2?: string;
p3(): any;
p4?(): any;
p5?(): void;
p6(pa1: any): void;
p7(pa1: any, pa2: any): void;
p7?(pa1: any, pa2: any): void;
}
module M {
var V: any;
function F(): void;
class C {
}
interface I {
}
module M {
}
var eV: any;
function eF(): void;
class eC {
}
interface eI {
}
module eM {
}
var eaV: any;
function eaF(): void;
class eaC {
}
module eaM {
}
}
var eV: any;
function eF(): void;
class eC {
constructor();
pV: any;
private rV;
pF(): void;
static tV: any;
static tF(): void;
}
interface eI {
(): any;
(): number;
(p: any): any;
(p1: string): any;
(p2?: string): any;
(...p3: any[]): any;
(p4: string, p5?: string): any;
(p6: string, ...p7: any[]): any;
new (): any;
new (): number;
new (p: string): any;
new (p2?: string): any;
new (...p3: any[]): any;
new (p4: string, p5?: string): any;
new (p6: string, ...p7: any[]): any;
[p1: string]: any;
[p2: string, p3: number]: any;
p: any;
p1?: any;
p2?: string;
p3(): any;
p4?(): any;
p5?(): void;
p6(pa1: any): void;
p7(pa1: any, pa2: any): void;
p7?(pa1: any, pa2: any): void;
}
module eM {
var V: any;
function F(): void;
class C {
}
module M {
}
var eV: any;
function eF(): void;
class eC {
}
interface eI {
}
module eM {
}
}
}
@@ -4,7 +4,3 @@ export var x;
//// [file1.js]
export var x;
//// [file1.d.ts]
export declare var x: any;
@@ -18,6 +18,3 @@ function foo() {
function foo() {
return 30;
}
//// [out.d.ts]
@@ -19,6 +19,3 @@ function foo() {
function foo() {
return 10;
}
//// [out.d.ts]
@@ -9,8 +9,3 @@ var x = 10; // Error reported so no declaration file generated?
//// [out.js]
var x = "hello";
var x = 10; // Error reported so no declaration file generated?
//// [out.d.ts]
declare var x: string;
declare var x: string;
@@ -25,13 +25,3 @@ var c = (function () {
// error on above reference path when emitting declarations
function foo() {
}
//// [a.d.ts]
declare class c {
}
//// [c.d.ts]
declare function bar(): void;
//// [b.d.ts]
/// <reference path="c.d.ts" />
declare function foo(): void;
@@ -13,8 +13,3 @@ var b = 30;
a = 10;
var a = 10;
b = 30;
//// [out.d.ts]
declare let b: number;
declare let a: number;
@@ -11,9 +11,3 @@ var let = 10;
var a = 10;
let = 30;
var a;
//// [letAsIdentifier.d.ts]
declare var let: number;
declare var a: number;
declare let a: any;
@@ -1,241 +0,0 @@
tests/cases/compiler/moduledecl.ts(164,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/moduledecl.ts(172,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
==== tests/cases/compiler/moduledecl.ts (2 errors) ====
module a {
}
module b.a {
}
module c.a.b {
import ma = a;
}
module mImport {
import d = a;
import e = b.a;
import d1 = a;
import e1 = b.a;
}
module m0 {
function f1() {
}
function f2(s: string);
function f2(n: number);
function f2(ns: any) {
}
class c1 {
public a : ()=>string;
private b: ()=>number;
private static s1;
public static s2;
}
interface i1 {
() : Object;
[n: number]: c1;
}
import m2 = a;
import m3 = b;
import m4 = b.a;
import m5 = c;
import m6 = c.a;
import m7 = c.a.b;
}
module m1 {
export function f1() {
}
export function f2(s: string);
export function f2(n: number);
export function f2(ns: any) {
}
export class c1 {
public a: () =>string;
private b: () =>number;
private static s1;
public static s2;
public d() {
return "Hello";
}
public e: { x: number; y: string; };
constructor (public n, public n2: number, private n3, private n4: string) {
}
}
export interface i1 {
() : Object;
[n: number]: c1;
}
import m2 = a;
import m3 = b;
import m4 = b.a;
import m5 = c;
import m6 = c.a;
import m7 = c.a.b;
}
module m {
export module m2 {
var a = 10;
export var b: number;
}
export module m3 {
export var c: number;
}
}
module m {
export module m25 {
export module m5 {
export var c: number;
}
}
}
module m13 {
export module m4 {
export module m2 {
export module m3 {
export var c: number;
}
}
export function f() {
return 20;
}
}
}
declare module m4 {
export var b;
}
declare module m5 {
export var c;
}
declare module m43 {
export var b;
}
declare module m55 {
export var c;
}
declare module "m3" {
export var b: number;
}
module exportTests {
export class C1_public {
private f2() {
return 30;
}
public f3() {
return "string";
}
}
class C2_private {
private f2() {
return 30;
}
public f3() {
return "string";
}
}
export class C3_public {
private getC2_private() {
return new C2_private();
}
private setC2_private(arg: C2_private) {
}
private get c2() {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private();
}
public getC1_public() {
return new C1_public();
}
public setC1_public(arg: C1_public) {
}
public get c1() {
~~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
}
}
declare module mAmbient {
class C {
public myProp: number;
}
function foo() : C;
var aVar: C;
interface B {
x: number;
y: C;
}
enum e {
x,
y,
z
}
module m3 {
class C {
public myProp: number;
}
function foo(): C;
var aVar: C;
interface B {
x: number;
y: C;
}
enum e {
x,
y,
z
}
}
}
function foo() {
return mAmbient.foo();
}
var cVar = new mAmbient.C();
var aVar = mAmbient.aVar;
var bB: mAmbient.B;
var eVar: mAmbient.e;
function m3foo() {
return mAmbient.m3.foo();
}
var m3cVar = new mAmbient.m3.C();
var m3aVar = mAmbient.m3.aVar;
var m3bB: mAmbient.m3.B;
var m3eVar: mAmbient.m3.e;
+1
View File
@@ -1,4 +1,5 @@
//// [moduledecl.ts]
module a {
}
@@ -0,0 +1,536 @@
=== tests/cases/compiler/moduledecl.ts ===
module a {
>a : Symbol(a, Decl(moduledecl.ts, 0, 0))
}
module b.a {
>b : Symbol(b, Decl(moduledecl.ts, 2, 1))
>a : Symbol(a, Decl(moduledecl.ts, 4, 9))
}
module c.a.b {
>c : Symbol(c, Decl(moduledecl.ts, 5, 1))
>a : Symbol(a, Decl(moduledecl.ts, 7, 9))
>b : Symbol(ma.b, Decl(moduledecl.ts, 7, 11))
import ma = a;
>ma : Symbol(ma, Decl(moduledecl.ts, 7, 14))
>a : Symbol(ma, Decl(moduledecl.ts, 7, 9))
}
module mImport {
>mImport : Symbol(mImport, Decl(moduledecl.ts, 9, 1))
import d = a;
>d : Symbol(d, Decl(moduledecl.ts, 11, 16))
>a : Symbol(d, Decl(moduledecl.ts, 0, 0))
import e = b.a;
>e : Symbol(e, Decl(moduledecl.ts, 12, 17))
>b : Symbol(b, Decl(moduledecl.ts, 2, 1))
>a : Symbol(e, Decl(moduledecl.ts, 4, 9))
import d1 = a;
>d1 : Symbol(d1, Decl(moduledecl.ts, 13, 19))
>a : Symbol(d, Decl(moduledecl.ts, 0, 0))
import e1 = b.a;
>e1 : Symbol(e1, Decl(moduledecl.ts, 14, 18))
>b : Symbol(b, Decl(moduledecl.ts, 2, 1))
>a : Symbol(e, Decl(moduledecl.ts, 4, 9))
}
module m0 {
>m0 : Symbol(m0, Decl(moduledecl.ts, 16, 1))
function f1() {
>f1 : Symbol(f1, Decl(moduledecl.ts, 18, 11))
}
function f2(s: string);
>f2 : Symbol(f2, Decl(moduledecl.ts, 20, 5), Decl(moduledecl.ts, 22, 27), Decl(moduledecl.ts, 23, 27))
>s : Symbol(s, Decl(moduledecl.ts, 22, 16))
function f2(n: number);
>f2 : Symbol(f2, Decl(moduledecl.ts, 20, 5), Decl(moduledecl.ts, 22, 27), Decl(moduledecl.ts, 23, 27))
>n : Symbol(n, Decl(moduledecl.ts, 23, 16))
function f2(ns: any) {
>f2 : Symbol(f2, Decl(moduledecl.ts, 20, 5), Decl(moduledecl.ts, 22, 27), Decl(moduledecl.ts, 23, 27))
>ns : Symbol(ns, Decl(moduledecl.ts, 24, 16))
}
class c1 {
>c1 : Symbol(c1, Decl(moduledecl.ts, 25, 5))
public a : ()=>string;
>a : Symbol(a, Decl(moduledecl.ts, 27, 14))
private b: ()=>number;
>b : Symbol(b, Decl(moduledecl.ts, 28, 30))
private static s1;
>s1 : Symbol(c1.s1, Decl(moduledecl.ts, 29, 30))
public static s2;
>s2 : Symbol(c1.s2, Decl(moduledecl.ts, 30, 26))
}
interface i1 {
>i1 : Symbol(i1, Decl(moduledecl.ts, 32, 5))
() : Object;
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
[n: number]: c1;
>n : Symbol(n, Decl(moduledecl.ts, 36, 9))
>c1 : Symbol(c1, Decl(moduledecl.ts, 25, 5))
}
import m2 = a;
>m2 : Symbol(m2, Decl(moduledecl.ts, 37, 5))
>a : Symbol(m2, Decl(moduledecl.ts, 0, 0))
import m3 = b;
>m3 : Symbol(m3, Decl(moduledecl.ts, 39, 18))
>b : Symbol(m3, Decl(moduledecl.ts, 2, 1))
import m4 = b.a;
>m4 : Symbol(m4, Decl(moduledecl.ts, 40, 18))
>b : Symbol(m3, Decl(moduledecl.ts, 2, 1))
>a : Symbol(m3.a, Decl(moduledecl.ts, 4, 9))
import m5 = c;
>m5 : Symbol(m5, Decl(moduledecl.ts, 41, 20))
>c : Symbol(m5, Decl(moduledecl.ts, 5, 1))
import m6 = c.a;
>m6 : Symbol(m6, Decl(moduledecl.ts, 42, 18))
>c : Symbol(m5, Decl(moduledecl.ts, 5, 1))
>a : Symbol(m5.a, Decl(moduledecl.ts, 7, 9))
import m7 = c.a.b;
>m7 : Symbol(m7, Decl(moduledecl.ts, 43, 20))
>c : Symbol(m5, Decl(moduledecl.ts, 5, 1))
>a : Symbol(m5.a, Decl(moduledecl.ts, 7, 9))
>b : Symbol(m6.b, Decl(moduledecl.ts, 7, 11))
}
module m1 {
>m1 : Symbol(m1, Decl(moduledecl.ts, 45, 1))
export function f1() {
>f1 : Symbol(f1, Decl(moduledecl.ts, 47, 11))
}
export function f2(s: string);
>f2 : Symbol(f2, Decl(moduledecl.ts, 49, 5), Decl(moduledecl.ts, 51, 34), Decl(moduledecl.ts, 52, 34))
>s : Symbol(s, Decl(moduledecl.ts, 51, 23))
export function f2(n: number);
>f2 : Symbol(f2, Decl(moduledecl.ts, 49, 5), Decl(moduledecl.ts, 51, 34), Decl(moduledecl.ts, 52, 34))
>n : Symbol(n, Decl(moduledecl.ts, 52, 23))
export function f2(ns: any) {
>f2 : Symbol(f2, Decl(moduledecl.ts, 49, 5), Decl(moduledecl.ts, 51, 34), Decl(moduledecl.ts, 52, 34))
>ns : Symbol(ns, Decl(moduledecl.ts, 53, 23))
}
export class c1 {
>c1 : Symbol(c1, Decl(moduledecl.ts, 54, 5))
public a: () =>string;
>a : Symbol(a, Decl(moduledecl.ts, 56, 21))
private b: () =>number;
>b : Symbol(b, Decl(moduledecl.ts, 57, 30))
private static s1;
>s1 : Symbol(c1.s1, Decl(moduledecl.ts, 58, 31))
public static s2;
>s2 : Symbol(c1.s2, Decl(moduledecl.ts, 59, 26))
public d() {
>d : Symbol(d, Decl(moduledecl.ts, 60, 25))
return "Hello";
}
public e: { x: number; y: string; };
>e : Symbol(e, Decl(moduledecl.ts, 64, 9))
>x : Symbol(x, Decl(moduledecl.ts, 66, 19))
>y : Symbol(y, Decl(moduledecl.ts, 66, 30))
constructor (public n, public n2: number, private n3, private n4: string) {
>n : Symbol(n, Decl(moduledecl.ts, 67, 21))
>n2 : Symbol(n2, Decl(moduledecl.ts, 67, 30))
>n3 : Symbol(n3, Decl(moduledecl.ts, 67, 49))
>n4 : Symbol(n4, Decl(moduledecl.ts, 67, 61))
}
}
export interface i1 {
>i1 : Symbol(i1, Decl(moduledecl.ts, 69, 5))
() : Object;
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
[n: number]: c1;
>n : Symbol(n, Decl(moduledecl.ts, 73, 9))
>c1 : Symbol(c1, Decl(moduledecl.ts, 54, 5))
}
import m2 = a;
>m2 : Symbol(m2, Decl(moduledecl.ts, 74, 5))
>a : Symbol(m2, Decl(moduledecl.ts, 0, 0))
import m3 = b;
>m3 : Symbol(m3, Decl(moduledecl.ts, 76, 18))
>b : Symbol(m3, Decl(moduledecl.ts, 2, 1))
import m4 = b.a;
>m4 : Symbol(m4, Decl(moduledecl.ts, 77, 18))
>b : Symbol(m3, Decl(moduledecl.ts, 2, 1))
>a : Symbol(m3.a, Decl(moduledecl.ts, 4, 9))
import m5 = c;
>m5 : Symbol(m5, Decl(moduledecl.ts, 78, 20))
>c : Symbol(m5, Decl(moduledecl.ts, 5, 1))
import m6 = c.a;
>m6 : Symbol(m6, Decl(moduledecl.ts, 79, 18))
>c : Symbol(m5, Decl(moduledecl.ts, 5, 1))
>a : Symbol(m5.a, Decl(moduledecl.ts, 7, 9))
import m7 = c.a.b;
>m7 : Symbol(m7, Decl(moduledecl.ts, 80, 20))
>c : Symbol(m5, Decl(moduledecl.ts, 5, 1))
>a : Symbol(m5.a, Decl(moduledecl.ts, 7, 9))
>b : Symbol(m6.b, Decl(moduledecl.ts, 7, 11))
}
module m {
>m : Symbol(m, Decl(moduledecl.ts, 82, 1), Decl(moduledecl.ts, 93, 1))
export module m2 {
>m2 : Symbol(m2, Decl(moduledecl.ts, 84, 10))
var a = 10;
>a : Symbol(a, Decl(moduledecl.ts, 86, 11))
export var b: number;
>b : Symbol(b, Decl(moduledecl.ts, 87, 18))
}
export module m3 {
>m3 : Symbol(m3, Decl(moduledecl.ts, 88, 5))
export var c: number;
>c : Symbol(c, Decl(moduledecl.ts, 91, 18))
}
}
module m {
>m : Symbol(m, Decl(moduledecl.ts, 82, 1), Decl(moduledecl.ts, 93, 1))
export module m25 {
>m25 : Symbol(m25, Decl(moduledecl.ts, 95, 10))
export module m5 {
>m5 : Symbol(m5, Decl(moduledecl.ts, 97, 23))
export var c: number;
>c : Symbol(c, Decl(moduledecl.ts, 99, 22))
}
}
}
module m13 {
>m13 : Symbol(m13, Decl(moduledecl.ts, 102, 1))
export module m4 {
>m4 : Symbol(m4, Decl(moduledecl.ts, 104, 12))
export module m2 {
>m2 : Symbol(m2, Decl(moduledecl.ts, 105, 22))
export module m3 {
>m3 : Symbol(m3, Decl(moduledecl.ts, 106, 26))
export var c: number;
>c : Symbol(c, Decl(moduledecl.ts, 108, 26))
}
}
export function f() {
>f : Symbol(f, Decl(moduledecl.ts, 110, 9))
return 20;
}
}
}
declare module m4 {
>m4 : Symbol(m4, Decl(moduledecl.ts, 116, 1))
export var b;
>b : Symbol(b, Decl(moduledecl.ts, 119, 14))
}
declare module m5 {
>m5 : Symbol(m5, Decl(moduledecl.ts, 120, 1))
export var c;
>c : Symbol(c, Decl(moduledecl.ts, 123, 14))
}
declare module m43 {
>m43 : Symbol(m43, Decl(moduledecl.ts, 124, 1))
export var b;
>b : Symbol(b, Decl(moduledecl.ts, 127, 14))
}
declare module m55 {
>m55 : Symbol(m55, Decl(moduledecl.ts, 128, 1))
export var c;
>c : Symbol(c, Decl(moduledecl.ts, 131, 14))
}
declare module "m3" {
export var b: number;
>b : Symbol(b, Decl(moduledecl.ts, 135, 14))
}
module exportTests {
>exportTests : Symbol(exportTests, Decl(moduledecl.ts, 136, 1))
export class C1_public {
>C1_public : Symbol(C1_public, Decl(moduledecl.ts, 138, 20))
private f2() {
>f2 : Symbol(f2, Decl(moduledecl.ts, 139, 28))
return 30;
}
public f3() {
>f3 : Symbol(f3, Decl(moduledecl.ts, 142, 9))
return "string";
}
}
class C2_private {
>C2_private : Symbol(C2_private, Decl(moduledecl.ts, 147, 5))
private f2() {
>f2 : Symbol(f2, Decl(moduledecl.ts, 148, 22))
return 30;
}
public f3() {
>f3 : Symbol(f3, Decl(moduledecl.ts, 151, 9))
return "string";
}
}
export class C3_public {
>C3_public : Symbol(C3_public, Decl(moduledecl.ts, 156, 5))
private getC2_private() {
>getC2_private : Symbol(getC2_private, Decl(moduledecl.ts, 158, 28))
return new C2_private();
>C2_private : Symbol(C2_private, Decl(moduledecl.ts, 147, 5))
}
private setC2_private(arg: C2_private) {
>setC2_private : Symbol(setC2_private, Decl(moduledecl.ts, 161, 9))
>arg : Symbol(arg, Decl(moduledecl.ts, 162, 30))
>C2_private : Symbol(C2_private, Decl(moduledecl.ts, 147, 5))
}
private get c2() {
>c2 : Symbol(c2, Decl(moduledecl.ts, 163, 9))
return new C2_private();
>C2_private : Symbol(C2_private, Decl(moduledecl.ts, 147, 5))
}
public getC1_public() {
>getC1_public : Symbol(getC1_public, Decl(moduledecl.ts, 166, 9))
return new C1_public();
>C1_public : Symbol(C1_public, Decl(moduledecl.ts, 138, 20))
}
public setC1_public(arg: C1_public) {
>setC1_public : Symbol(setC1_public, Decl(moduledecl.ts, 169, 9))
>arg : Symbol(arg, Decl(moduledecl.ts, 170, 28))
>C1_public : Symbol(C1_public, Decl(moduledecl.ts, 138, 20))
}
public get c1() {
>c1 : Symbol(c1, Decl(moduledecl.ts, 171, 9))
return new C1_public();
>C1_public : Symbol(C1_public, Decl(moduledecl.ts, 138, 20))
}
}
}
declare module mAmbient {
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
class C {
>C : Symbol(C, Decl(moduledecl.ts, 178, 25))
public myProp: number;
>myProp : Symbol(myProp, Decl(moduledecl.ts, 179, 13))
}
function foo() : C;
>foo : Symbol(foo, Decl(moduledecl.ts, 181, 5))
>C : Symbol(C, Decl(moduledecl.ts, 178, 25))
var aVar: C;
>aVar : Symbol(aVar, Decl(moduledecl.ts, 184, 7))
>C : Symbol(C, Decl(moduledecl.ts, 178, 25))
interface B {
>B : Symbol(B, Decl(moduledecl.ts, 184, 16))
x: number;
>x : Symbol(x, Decl(moduledecl.ts, 185, 17))
y: C;
>y : Symbol(y, Decl(moduledecl.ts, 186, 18))
>C : Symbol(C, Decl(moduledecl.ts, 178, 25))
}
enum e {
>e : Symbol(e, Decl(moduledecl.ts, 188, 5))
x,
>x : Symbol(e.x, Decl(moduledecl.ts, 189, 12))
y,
>y : Symbol(e.y, Decl(moduledecl.ts, 190, 10))
z
>z : Symbol(e.z, Decl(moduledecl.ts, 191, 10))
}
module m3 {
>m3 : Symbol(m3, Decl(moduledecl.ts, 193, 5))
class C {
>C : Symbol(C, Decl(moduledecl.ts, 195, 15))
public myProp: number;
>myProp : Symbol(myProp, Decl(moduledecl.ts, 196, 17))
}
function foo(): C;
>foo : Symbol(foo, Decl(moduledecl.ts, 198, 9))
>C : Symbol(C, Decl(moduledecl.ts, 195, 15))
var aVar: C;
>aVar : Symbol(aVar, Decl(moduledecl.ts, 201, 11))
>C : Symbol(C, Decl(moduledecl.ts, 195, 15))
interface B {
>B : Symbol(B, Decl(moduledecl.ts, 201, 20))
x: number;
>x : Symbol(x, Decl(moduledecl.ts, 202, 21))
y: C;
>y : Symbol(y, Decl(moduledecl.ts, 203, 22))
>C : Symbol(C, Decl(moduledecl.ts, 195, 15))
}
enum e {
>e : Symbol(e, Decl(moduledecl.ts, 205, 9))
x,
>x : Symbol(e.x, Decl(moduledecl.ts, 206, 16))
y,
>y : Symbol(e.y, Decl(moduledecl.ts, 207, 14))
z
>z : Symbol(e.z, Decl(moduledecl.ts, 208, 14))
}
}
}
function foo() {
>foo : Symbol(foo, Decl(moduledecl.ts, 212, 1))
return mAmbient.foo();
>mAmbient.foo : Symbol(mAmbient.foo, Decl(moduledecl.ts, 181, 5))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>foo : Symbol(mAmbient.foo, Decl(moduledecl.ts, 181, 5))
}
var cVar = new mAmbient.C();
>cVar : Symbol(cVar, Decl(moduledecl.ts, 218, 3))
>mAmbient.C : Symbol(mAmbient.C, Decl(moduledecl.ts, 178, 25))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>C : Symbol(mAmbient.C, Decl(moduledecl.ts, 178, 25))
var aVar = mAmbient.aVar;
>aVar : Symbol(aVar, Decl(moduledecl.ts, 219, 3))
>mAmbient.aVar : Symbol(mAmbient.aVar, Decl(moduledecl.ts, 184, 7))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>aVar : Symbol(mAmbient.aVar, Decl(moduledecl.ts, 184, 7))
var bB: mAmbient.B;
>bB : Symbol(bB, Decl(moduledecl.ts, 220, 3))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>B : Symbol(mAmbient.B, Decl(moduledecl.ts, 184, 16))
var eVar: mAmbient.e;
>eVar : Symbol(eVar, Decl(moduledecl.ts, 221, 3))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>e : Symbol(mAmbient.e, Decl(moduledecl.ts, 188, 5))
function m3foo() {
>m3foo : Symbol(m3foo, Decl(moduledecl.ts, 221, 21))
return mAmbient.m3.foo();
>mAmbient.m3.foo : Symbol(mAmbient.m3.foo, Decl(moduledecl.ts, 198, 9))
>mAmbient.m3 : Symbol(mAmbient.m3, Decl(moduledecl.ts, 193, 5))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>m3 : Symbol(mAmbient.m3, Decl(moduledecl.ts, 193, 5))
>foo : Symbol(mAmbient.m3.foo, Decl(moduledecl.ts, 198, 9))
}
var m3cVar = new mAmbient.m3.C();
>m3cVar : Symbol(m3cVar, Decl(moduledecl.ts, 227, 3))
>mAmbient.m3.C : Symbol(mAmbient.m3.C, Decl(moduledecl.ts, 195, 15))
>mAmbient.m3 : Symbol(mAmbient.m3, Decl(moduledecl.ts, 193, 5))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>m3 : Symbol(mAmbient.m3, Decl(moduledecl.ts, 193, 5))
>C : Symbol(mAmbient.m3.C, Decl(moduledecl.ts, 195, 15))
var m3aVar = mAmbient.m3.aVar;
>m3aVar : Symbol(m3aVar, Decl(moduledecl.ts, 228, 3))
>mAmbient.m3.aVar : Symbol(mAmbient.m3.aVar, Decl(moduledecl.ts, 201, 11))
>mAmbient.m3 : Symbol(mAmbient.m3, Decl(moduledecl.ts, 193, 5))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>m3 : Symbol(mAmbient.m3, Decl(moduledecl.ts, 193, 5))
>aVar : Symbol(mAmbient.m3.aVar, Decl(moduledecl.ts, 201, 11))
var m3bB: mAmbient.m3.B;
>m3bB : Symbol(m3bB, Decl(moduledecl.ts, 229, 3))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>m3 : Symbol(mAmbient.m3, Decl(moduledecl.ts, 193, 5))
>B : Symbol(mAmbient.m3.B, Decl(moduledecl.ts, 201, 20))
var m3eVar: mAmbient.m3.e;
>m3eVar : Symbol(m3eVar, Decl(moduledecl.ts, 230, 3))
>mAmbient : Symbol(mAmbient, Decl(moduledecl.ts, 176, 1))
>m3 : Symbol(mAmbient.m3, Decl(moduledecl.ts, 193, 5))
>e : Symbol(mAmbient.m3.e, Decl(moduledecl.ts, 205, 9))
+551
View File
@@ -0,0 +1,551 @@
=== tests/cases/compiler/moduledecl.ts ===
module a {
>a : any
}
module b.a {
>b : any
>a : any
}
module c.a.b {
>c : any
>a : any
>b : any
import ma = a;
>ma : any
>a : any
}
module mImport {
>mImport : any
import d = a;
>d : any
>a : any
import e = b.a;
>e : any
>b : any
>a : any
import d1 = a;
>d1 : any
>a : any
import e1 = b.a;
>e1 : any
>b : any
>a : any
}
module m0 {
>m0 : typeof m0
function f1() {
>f1 : () => void
}
function f2(s: string);
>f2 : { (s: string): any; (n: number): any; }
>s : string
function f2(n: number);
>f2 : { (s: string): any; (n: number): any; }
>n : number
function f2(ns: any) {
>f2 : { (s: string): any; (n: number): any; }
>ns : any
}
class c1 {
>c1 : c1
public a : ()=>string;
>a : () => string
private b: ()=>number;
>b : () => number
private static s1;
>s1 : any
public static s2;
>s2 : any
}
interface i1 {
>i1 : i1
() : Object;
>Object : Object
[n: number]: c1;
>n : number
>c1 : c1
}
import m2 = a;
>m2 : any
>a : any
import m3 = b;
>m3 : any
>b : any
import m4 = b.a;
>m4 : any
>b : any
>a : any
import m5 = c;
>m5 : any
>c : any
import m6 = c.a;
>m6 : any
>c : any
>a : any
import m7 = c.a.b;
>m7 : any
>c : any
>a : any
>b : any
}
module m1 {
>m1 : typeof m1
export function f1() {
>f1 : () => void
}
export function f2(s: string);
>f2 : { (s: string): any; (n: number): any; }
>s : string
export function f2(n: number);
>f2 : { (s: string): any; (n: number): any; }
>n : number
export function f2(ns: any) {
>f2 : { (s: string): any; (n: number): any; }
>ns : any
}
export class c1 {
>c1 : c1
public a: () =>string;
>a : () => string
private b: () =>number;
>b : () => number
private static s1;
>s1 : any
public static s2;
>s2 : any
public d() {
>d : () => string
return "Hello";
>"Hello" : string
}
public e: { x: number; y: string; };
>e : { x: number; y: string; }
>x : number
>y : string
constructor (public n, public n2: number, private n3, private n4: string) {
>n : any
>n2 : number
>n3 : any
>n4 : string
}
}
export interface i1 {
>i1 : i1
() : Object;
>Object : Object
[n: number]: c1;
>n : number
>c1 : c1
}
import m2 = a;
>m2 : any
>a : any
import m3 = b;
>m3 : any
>b : any
import m4 = b.a;
>m4 : any
>b : any
>a : any
import m5 = c;
>m5 : any
>c : any
import m6 = c.a;
>m6 : any
>c : any
>a : any
import m7 = c.a.b;
>m7 : any
>c : any
>a : any
>b : any
}
module m {
>m : typeof m
export module m2 {
>m2 : typeof m2
var a = 10;
>a : number
>10 : number
export var b: number;
>b : number
}
export module m3 {
>m3 : typeof m3
export var c: number;
>c : number
}
}
module m {
>m : typeof m
export module m25 {
>m25 : typeof m25
export module m5 {
>m5 : typeof m5
export var c: number;
>c : number
}
}
}
module m13 {
>m13 : typeof m13
export module m4 {
>m4 : typeof m4
export module m2 {
>m2 : typeof m2
export module m3 {
>m3 : typeof m3
export var c: number;
>c : number
}
}
export function f() {
>f : () => number
return 20;
>20 : number
}
}
}
declare module m4 {
>m4 : typeof m4
export var b;
>b : any
}
declare module m5 {
>m5 : typeof m5
export var c;
>c : any
}
declare module m43 {
>m43 : typeof m43
export var b;
>b : any
}
declare module m55 {
>m55 : typeof m55
export var c;
>c : any
}
declare module "m3" {
export var b: number;
>b : number
}
module exportTests {
>exportTests : typeof exportTests
export class C1_public {
>C1_public : C1_public
private f2() {
>f2 : () => number
return 30;
>30 : number
}
public f3() {
>f3 : () => string
return "string";
>"string" : string
}
}
class C2_private {
>C2_private : C2_private
private f2() {
>f2 : () => number
return 30;
>30 : number
}
public f3() {
>f3 : () => string
return "string";
>"string" : string
}
}
export class C3_public {
>C3_public : C3_public
private getC2_private() {
>getC2_private : () => C2_private
return new C2_private();
>new C2_private() : C2_private
>C2_private : typeof C2_private
}
private setC2_private(arg: C2_private) {
>setC2_private : (arg: C2_private) => void
>arg : C2_private
>C2_private : C2_private
}
private get c2() {
>c2 : C2_private
return new C2_private();
>new C2_private() : C2_private
>C2_private : typeof C2_private
}
public getC1_public() {
>getC1_public : () => C1_public
return new C1_public();
>new C1_public() : C1_public
>C1_public : typeof C1_public
}
public setC1_public(arg: C1_public) {
>setC1_public : (arg: C1_public) => void
>arg : C1_public
>C1_public : C1_public
}
public get c1() {
>c1 : C1_public
return new C1_public();
>new C1_public() : C1_public
>C1_public : typeof C1_public
}
}
}
declare module mAmbient {
>mAmbient : typeof mAmbient
class C {
>C : C
public myProp: number;
>myProp : number
}
function foo() : C;
>foo : () => C
>C : C
var aVar: C;
>aVar : C
>C : C
interface B {
>B : B
x: number;
>x : number
y: C;
>y : C
>C : C
}
enum e {
>e : e
x,
>x : e
y,
>y : e
z
>z : e
}
module m3 {
>m3 : typeof m3
class C {
>C : C
public myProp: number;
>myProp : number
}
function foo(): C;
>foo : () => C
>C : C
var aVar: C;
>aVar : C
>C : C
interface B {
>B : B
x: number;
>x : number
y: C;
>y : C
>C : C
}
enum e {
>e : e
x,
>x : e
y,
>y : e
z
>z : e
}
}
}
function foo() {
>foo : () => mAmbient.C
return mAmbient.foo();
>mAmbient.foo() : mAmbient.C
>mAmbient.foo : () => mAmbient.C
>mAmbient : typeof mAmbient
>foo : () => mAmbient.C
}
var cVar = new mAmbient.C();
>cVar : mAmbient.C
>new mAmbient.C() : mAmbient.C
>mAmbient.C : typeof mAmbient.C
>mAmbient : typeof mAmbient
>C : typeof mAmbient.C
var aVar = mAmbient.aVar;
>aVar : mAmbient.C
>mAmbient.aVar : mAmbient.C
>mAmbient : typeof mAmbient
>aVar : mAmbient.C
var bB: mAmbient.B;
>bB : mAmbient.B
>mAmbient : any
>B : mAmbient.B
var eVar: mAmbient.e;
>eVar : mAmbient.e
>mAmbient : any
>e : mAmbient.e
function m3foo() {
>m3foo : () => mAmbient.m3.C
return mAmbient.m3.foo();
>mAmbient.m3.foo() : mAmbient.m3.C
>mAmbient.m3.foo : () => mAmbient.m3.C
>mAmbient.m3 : typeof mAmbient.m3
>mAmbient : typeof mAmbient
>m3 : typeof mAmbient.m3
>foo : () => mAmbient.m3.C
}
var m3cVar = new mAmbient.m3.C();
>m3cVar : mAmbient.m3.C
>new mAmbient.m3.C() : mAmbient.m3.C
>mAmbient.m3.C : typeof mAmbient.m3.C
>mAmbient.m3 : typeof mAmbient.m3
>mAmbient : typeof mAmbient
>m3 : typeof mAmbient.m3
>C : typeof mAmbient.m3.C
var m3aVar = mAmbient.m3.aVar;
>m3aVar : mAmbient.m3.C
>mAmbient.m3.aVar : mAmbient.m3.C
>mAmbient.m3 : typeof mAmbient.m3
>mAmbient : typeof mAmbient
>m3 : typeof mAmbient.m3
>aVar : mAmbient.m3.C
var m3bB: mAmbient.m3.B;
>m3bB : mAmbient.m3.B
>mAmbient : any
>m3 : any
>B : mAmbient.m3.B
var m3eVar: mAmbient.m3.e;
>m3eVar : mAmbient.m3.e
>mAmbient : any
>m3 : any
>e : mAmbient.m3.e
+1 -7
View File
@@ -21,10 +21,4 @@ var B = (function () {
}
return B;
})();
//# sourceMappingURL=c.js.map
//// [c.d.ts]
declare class A {
}
declare class B {
}
//# sourceMappingURL=c.js.map
@@ -9,7 +9,6 @@
"DifferentNamesSpecified/a.ts"
],
"emittedFiles": [
"test.js",
"test.d.ts"
"test.js"
]
}
@@ -1 +0,0 @@
declare var test: number;
@@ -9,7 +9,6 @@
"DifferentNamesSpecified/a.ts"
],
"emittedFiles": [
"test.js",
"test.d.ts"
"test.js"
]
}
@@ -1 +0,0 @@
declare var test: number;
@@ -1,2 +0,0 @@
declare class C {
}
@@ -1,4 +0,0 @@
/// <reference path="FolderC/fileC.d.ts" />
declare class B {
c: C;
}
@@ -15,8 +15,6 @@
],
"emittedFiles": [
"outdir/simple/FolderC/fileC.js",
"outdir/simple/FolderC/fileC.d.ts",
"outdir/simple/fileB.js",
"outdir/simple/fileB.d.ts"
"outdir/simple/fileB.js"
]
}
@@ -1,2 +0,0 @@
declare class C {
}
@@ -1,4 +0,0 @@
/// <reference path="FolderC/fileC.d.ts" />
declare class B {
c: C;
}
@@ -15,8 +15,6 @@
],
"emittedFiles": [
"outdir/simple/FolderC/fileC.js",
"outdir/simple/FolderC/fileC.d.ts",
"outdir/simple/fileB.js",
"outdir/simple/fileB.d.ts"
"outdir/simple/fileB.js"
]
}
-14
View File
@@ -41,17 +41,3 @@ var ob = { x: "" };
// Highlights the difference between array literals and object literals
var arr = [3, null]; // not assignable because null is not widened. BCT is {}
var obj = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any
//// [widenedTypes.d.ts]
declare var t: number[];
declare var x: typeof undefined;
declare var y: any;
declare var u: number[];
declare var ob: {
x: typeof undefined;
};
declare var arr: string[];
declare var obj: {
[x: string]: string;
};
@@ -1,64 +0,0 @@
tests/cases/compiler/withExportDecl.ts(43,9): error TS1029: 'export' modifier must precede 'declare' modifier.
==== tests/cases/compiler/withExportDecl.ts (1 errors) ====
var simpleVar;
export var exportedSimpleVar;
var anotherVar: any;
var varWithSimpleType: number;
var varWithArrayType: number[];
var varWithInitialValue = 30;
export var exportedVarWithInitialValue = 70;
var withComplicatedValue = { x: 30, y: 70, desc: "position" };
export var exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" };
declare var declaredVar;
declare var declareVar2
declare var declaredVar;
declare var deckareVarWithType: number;
export declare var exportedDeclaredVar: number;
var arrayVar: string[] = ['a', 'b'];
export var exportedArrayVar: { x: number; y: string; }[] ;
exportedArrayVar.push({ x: 30, y : 'hello world' });
function simpleFunction() {
return {
x: "Hello",
y: "word",
n: 2
};
}
export function exportedFunction() {
return simpleFunction();
}
module m1 {
export function foo() {
return "Hello";
}
}
declare export module m2 {
~~~~~~
!!! error TS1029: 'export' modifier must precede 'declare' modifier.
export var a: number;
}
export module m3 {
export function foo() {
return m1.foo();
}
}
export var eVar1, eVar2 = 10;
var eVar22;
export var eVar3 = 10, eVar4, eVar5;
+1 -1
View File
@@ -41,7 +41,7 @@ module m1 {
return "Hello";
}
}
declare export module m2 {
export declare module m2 {
export var a: number;
}
@@ -0,0 +1,129 @@
=== tests/cases/compiler/withExportDecl.ts ===
var simpleVar;
>simpleVar : Symbol(simpleVar, Decl(withExportDecl.ts, 0, 3))
export var exportedSimpleVar;
>exportedSimpleVar : Symbol(exportedSimpleVar, Decl(withExportDecl.ts, 1, 10))
var anotherVar: any;
>anotherVar : Symbol(anotherVar, Decl(withExportDecl.ts, 3, 3))
var varWithSimpleType: number;
>varWithSimpleType : Symbol(varWithSimpleType, Decl(withExportDecl.ts, 4, 3))
var varWithArrayType: number[];
>varWithArrayType : Symbol(varWithArrayType, Decl(withExportDecl.ts, 5, 3))
var varWithInitialValue = 30;
>varWithInitialValue : Symbol(varWithInitialValue, Decl(withExportDecl.ts, 7, 3))
export var exportedVarWithInitialValue = 70;
>exportedVarWithInitialValue : Symbol(exportedVarWithInitialValue, Decl(withExportDecl.ts, 8, 10))
var withComplicatedValue = { x: 30, y: 70, desc: "position" };
>withComplicatedValue : Symbol(withComplicatedValue, Decl(withExportDecl.ts, 10, 3))
>x : Symbol(x, Decl(withExportDecl.ts, 10, 28))
>y : Symbol(y, Decl(withExportDecl.ts, 10, 35))
>desc : Symbol(desc, Decl(withExportDecl.ts, 10, 42))
export var exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" };
>exportedWithComplicatedValue : Symbol(exportedWithComplicatedValue, Decl(withExportDecl.ts, 11, 10))
>x : Symbol(x, Decl(withExportDecl.ts, 11, 43))
>y : Symbol(y, Decl(withExportDecl.ts, 11, 50))
>desc : Symbol(desc, Decl(withExportDecl.ts, 11, 57))
declare var declaredVar;
>declaredVar : Symbol(declaredVar, Decl(withExportDecl.ts, 13, 11), Decl(withExportDecl.ts, 16, 11))
declare var declareVar2
>declareVar2 : Symbol(declareVar2, Decl(withExportDecl.ts, 14, 11))
declare var declaredVar;
>declaredVar : Symbol(declaredVar, Decl(withExportDecl.ts, 13, 11), Decl(withExportDecl.ts, 16, 11))
declare var deckareVarWithType: number;
>deckareVarWithType : Symbol(deckareVarWithType, Decl(withExportDecl.ts, 17, 11))
export declare var exportedDeclaredVar: number;
>exportedDeclaredVar : Symbol(exportedDeclaredVar, Decl(withExportDecl.ts, 18, 18))
var arrayVar: string[] = ['a', 'b'];
>arrayVar : Symbol(arrayVar, Decl(withExportDecl.ts, 20, 3))
export var exportedArrayVar: { x: number; y: string; }[] ;
>exportedArrayVar : Symbol(exportedArrayVar, Decl(withExportDecl.ts, 22, 10))
>x : Symbol(x, Decl(withExportDecl.ts, 22, 30))
>y : Symbol(y, Decl(withExportDecl.ts, 22, 41))
exportedArrayVar.push({ x: 30, y : 'hello world' });
>exportedArrayVar.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>exportedArrayVar : Symbol(exportedArrayVar, Decl(withExportDecl.ts, 22, 10))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(withExportDecl.ts, 23, 23))
>y : Symbol(y, Decl(withExportDecl.ts, 23, 30))
function simpleFunction() {
>simpleFunction : Symbol(simpleFunction, Decl(withExportDecl.ts, 23, 52))
return {
x: "Hello",
>x : Symbol(x, Decl(withExportDecl.ts, 26, 12))
y: "word",
>y : Symbol(y, Decl(withExportDecl.ts, 27, 19))
n: 2
>n : Symbol(n, Decl(withExportDecl.ts, 28, 18))
};
}
export function exportedFunction() {
>exportedFunction : Symbol(exportedFunction, Decl(withExportDecl.ts, 31, 1))
return simpleFunction();
>simpleFunction : Symbol(simpleFunction, Decl(withExportDecl.ts, 23, 52))
}
module m1 {
>m1 : Symbol(m1, Decl(withExportDecl.ts, 35, 1))
export function foo() {
>foo : Symbol(foo, Decl(withExportDecl.ts, 37, 11))
return "Hello";
}
}
export declare module m2 {
>m2 : Symbol(m2, Decl(withExportDecl.ts, 41, 1))
export var a: number;
>a : Symbol(a, Decl(withExportDecl.ts, 44, 14))
}
export module m3 {
>m3 : Symbol(m3, Decl(withExportDecl.ts, 45, 1))
export function foo() {
>foo : Symbol(foo, Decl(withExportDecl.ts, 48, 18))
return m1.foo();
>m1.foo : Symbol(m1.foo, Decl(withExportDecl.ts, 37, 11))
>m1 : Symbol(m1, Decl(withExportDecl.ts, 35, 1))
>foo : Symbol(m1.foo, Decl(withExportDecl.ts, 37, 11))
}
}
export var eVar1, eVar2 = 10;
>eVar1 : Symbol(eVar1, Decl(withExportDecl.ts, 55, 10))
>eVar2 : Symbol(eVar2, Decl(withExportDecl.ts, 55, 17))
var eVar22;
>eVar22 : Symbol(eVar22, Decl(withExportDecl.ts, 56, 3))
export var eVar3 = 10, eVar4, eVar5;
>eVar3 : Symbol(eVar3, Decl(withExportDecl.ts, 57, 10))
>eVar4 : Symbol(eVar4, Decl(withExportDecl.ts, 57, 22))
>eVar5 : Symbol(eVar5, Decl(withExportDecl.ts, 57, 29))
@@ -0,0 +1,156 @@
=== tests/cases/compiler/withExportDecl.ts ===
var simpleVar;
>simpleVar : any
export var exportedSimpleVar;
>exportedSimpleVar : any
var anotherVar: any;
>anotherVar : any
var varWithSimpleType: number;
>varWithSimpleType : number
var varWithArrayType: number[];
>varWithArrayType : number[]
var varWithInitialValue = 30;
>varWithInitialValue : number
>30 : number
export var exportedVarWithInitialValue = 70;
>exportedVarWithInitialValue : number
>70 : number
var withComplicatedValue = { x: 30, y: 70, desc: "position" };
>withComplicatedValue : { x: number; y: number; desc: string; }
>{ x: 30, y: 70, desc: "position" } : { x: number; y: number; desc: string; }
>x : number
>30 : number
>y : number
>70 : number
>desc : string
>"position" : string
export var exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" };
>exportedWithComplicatedValue : { x: number; y: number; desc: string; }
>{ x: 30, y: 70, desc: "position" } : { x: number; y: number; desc: string; }
>x : number
>30 : number
>y : number
>70 : number
>desc : string
>"position" : string
declare var declaredVar;
>declaredVar : any
declare var declareVar2
>declareVar2 : any
declare var declaredVar;
>declaredVar : any
declare var deckareVarWithType: number;
>deckareVarWithType : number
export declare var exportedDeclaredVar: number;
>exportedDeclaredVar : number
var arrayVar: string[] = ['a', 'b'];
>arrayVar : string[]
>['a', 'b'] : string[]
>'a' : string
>'b' : string
export var exportedArrayVar: { x: number; y: string; }[] ;
>exportedArrayVar : { x: number; y: string; }[]
>x : number
>y : string
exportedArrayVar.push({ x: 30, y : 'hello world' });
>exportedArrayVar.push({ x: 30, y : 'hello world' }) : number
>exportedArrayVar.push : (...items: { x: number; y: string; }[]) => number
>exportedArrayVar : { x: number; y: string; }[]
>push : (...items: { x: number; y: string; }[]) => number
>{ x: 30, y : 'hello world' } : { x: number; y: string; }
>x : number
>30 : number
>y : string
>'hello world' : string
function simpleFunction() {
>simpleFunction : () => { x: string; y: string; n: number; }
return {
>{ x: "Hello", y: "word", n: 2 } : { x: string; y: string; n: number; }
x: "Hello",
>x : string
>"Hello" : string
y: "word",
>y : string
>"word" : string
n: 2
>n : number
>2 : number
};
}
export function exportedFunction() {
>exportedFunction : () => { x: string; y: string; n: number; }
return simpleFunction();
>simpleFunction() : { x: string; y: string; n: number; }
>simpleFunction : () => { x: string; y: string; n: number; }
}
module m1 {
>m1 : typeof m1
export function foo() {
>foo : () => string
return "Hello";
>"Hello" : string
}
}
export declare module m2 {
>m2 : typeof m2
export var a: number;
>a : number
}
export module m3 {
>m3 : typeof m3
export function foo() {
>foo : () => string
return m1.foo();
>m1.foo() : string
>m1.foo : () => string
>m1 : typeof m1
>foo : () => string
}
}
export var eVar1, eVar2 = 10;
>eVar1 : any
>eVar2 : number
>10 : number
var eVar22;
>eVar22 : any
export var eVar3 = 10, eVar4, eVar5;
>eVar3 : number
>10 : number
>eVar4 : any
>eVar5 : any
+2 -1
View File
@@ -1,4 +1,5 @@
// @declaration: true
// @target: es5
class a {
//constructor ();
constructor (n: number);
@@ -13,7 +14,7 @@ class a {
public get d() {
return 30;
}
public set d() {
public set d(a: number) {
}
public static get p2() {
@@ -1,4 +1,5 @@
// @declaration: true
// @target: es5
function /*1*/makePoint(x: number) {
return {
@@ -1,4 +1,5 @@
// @declaration: true
// @target: es5
function /*1*/makePoint(x: number) {
return {
@@ -1,4 +1,5 @@
// @declaration: true
// @target: es5
function /*1*/makePoint(x: number) {
return {
@@ -1,4 +1,5 @@
// @declaration: true
// @target: es5
class C {
private static x = 1;
+2
View File
@@ -1,4 +1,6 @@
// @declaration: true
// @target: es5
module a {
}
+1 -1
View File
@@ -42,7 +42,7 @@ module m1 {
return "Hello";
}
}
declare export module m2 {
export declare module m2 {
export var a: number;
}
@@ -13,10 +13,18 @@
//// x : string;
//// y : number
//// }
//// /*1*/
// @Filename: inputFile2.tsx
// @emitThisFile: true
//// declare var React: any;
//// var y = "my div";
//// var x = <div name= {y} />
//// /*2*/
goTo.marker("1");
verify.numberOfErrorsInCurrentFile(0);
goTo.marker("2");
verify.numberOfErrorsInCurrentFile(0);
verify.baselineGetEmitOutput();
@@ -16,8 +16,7 @@ verify.getSemanticDiagnostics('[]');
goTo.marker("2");
verify.getSemanticDiagnostics('[\n {\n "message": "Duplicate function implementation.",\n "start": 9,\n "length": 3,\n "category": "error",\n "code": 2393\n }\n]');
verify.verifyGetEmitOutputContentsForCurrentFile([
{ fileName: "out.js", content: "function foo() { return 10; }\r\nfunction foo() { return 30; }\r\n" },
{ fileName: "out.d.ts", content: "" }]);
{ fileName: "out.js", content: "function foo() { return 10; }\r\nfunction foo() { return 30; }\r\n" }]);
goTo.marker("2");
verify.getSemanticDiagnostics('[\n {\n "message": "Duplicate function implementation.",\n "start": 9,\n "length": 3,\n "category": "error",\n "code": 2393\n }\n]');
goTo.marker("1");