Baseline updates now that we no longer have early errors.

This commit is contained in:
Cyrus Najmabadi
2015-02-02 15:15:54 -08:00
parent dd8d3535ff
commit 5343336763
584 changed files with 20993 additions and 16 deletions
@@ -0,0 +1,8 @@
//// [ArrowFunction2.ts]
var v = (a: b,) => {
};
//// [ArrowFunction2.js]
var v = function (a) {
};
@@ -0,0 +1,8 @@
//// [FunctionDeclaration10_es6.ts]
function * foo(a = yield => yield) {
}
//// [FunctionDeclaration10_es6.js]
function foo(a) {
if (a === void 0) { a = function (yield) { return yield; }; }
}
@@ -0,0 +1,7 @@
//// [FunctionDeclaration11_es6.ts]
function * yield() {
}
//// [FunctionDeclaration11_es6.js]
function yield() {
}
@@ -0,0 +1,12 @@
//// [FunctionDeclaration13_es6.ts]
function * foo() {
// Legal to use 'yield' in a type context.
var v: yield;
}
//// [FunctionDeclaration13_es6.js]
function foo() {
// Legal to use 'yield' in a type context.
var v;
}
@@ -0,0 +1,7 @@
//// [FunctionDeclaration1_es6.ts]
function * foo() {
}
//// [FunctionDeclaration1_es6.js]
function foo() {
}
@@ -0,0 +1,8 @@
//// [FunctionDeclaration6_es6.ts]
function*foo(a = yield) {
}
//// [FunctionDeclaration6_es6.js]
function foo(a) {
if (a === void 0) { a = yield; }
}
@@ -0,0 +1,14 @@
//// [FunctionDeclaration7_es6.ts]
function*bar() {
// 'yield' here is an identifier, and not a yield expression.
function*foo(a = yield) {
}
}
//// [FunctionDeclaration7_es6.js]
function bar() {
// 'yield' here is an identifier, and not a yield expression.
function foo(a) {
if (a === void 0) { a = yield; }
}
}
@@ -0,0 +1,5 @@
//// [FunctionDeclaration8_es6.ts]
var v = { [yield]: foo }
//// [FunctionDeclaration8_es6.js]
var v = { [yield]: foo };
@@ -0,0 +1,9 @@
//// [FunctionDeclaration9_es6.ts]
function * foo() {
var v = { [yield]: foo }
}
//// [FunctionDeclaration9_es6.js]
function foo() {
var v = { []: foo };
}
@@ -0,0 +1,6 @@
//// [FunctionExpression1_es6.ts]
var v = function * () { }
//// [FunctionExpression1_es6.js]
var v = function () {
};
@@ -0,0 +1,6 @@
//// [FunctionExpression2_es6.ts]
var v = function * foo() { }
//// [FunctionExpression2_es6.js]
var v = function foo() {
};
@@ -0,0 +1,6 @@
//// [FunctionPropertyAssignments1_es6.ts]
var v = { *foo() { } }
//// [FunctionPropertyAssignments1_es6.js]
var v = { foo: function () {
} };
@@ -0,0 +1,6 @@
//// [FunctionPropertyAssignments5_es6.ts]
var v = { *[foo()]() { } }
//// [FunctionPropertyAssignments5_es6.js]
var v = { [foo()]: function () {
} };
@@ -0,0 +1,17 @@
//// [MemberAccessorDeclaration15.ts]
class C {
set Foo(public a: number) { }
}
//// [MemberAccessorDeclaration15.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "Foo", {
set: function (a) {
},
enumerable: true,
configurable: true
});
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration1_es6.ts]
class C {
*foo() { }
}
//// [MemberFunctionDeclaration1_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration2_es6.ts]
class C {
public * foo() { }
}
//// [MemberFunctionDeclaration2_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration3_es6.ts]
class C {
*[foo]() { }
}
//// [MemberFunctionDeclaration3_es6.js]
var C = (function () {
function C() {
}
C.prototype[foo] = function () {
};
return C;
})();
@@ -0,0 +1,13 @@
//// [MemberFunctionDeclaration7_es6.ts]
class C {
*foo<T>() { }
}
//// [MemberFunctionDeclaration7_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
};
return C;
})();
+10
View File
@@ -0,0 +1,10 @@
//// [Protected1.ts]
protected class C {
}
//// [Protected1.js]
var C = (function () {
function C() {
}
return C;
})();
+5
View File
@@ -0,0 +1,5 @@
//// [Protected2.ts]
protected module M {
}
//// [Protected2.js]
+11
View File
@@ -0,0 +1,11 @@
//// [Protected3.ts]
class C {
protected constructor() { }
}
//// [Protected3.js]
var C = (function () {
function C() {
}
return C;
})();
+13
View File
@@ -0,0 +1,13 @@
//// [Protected4.ts]
class C {
protected public m() { }
}
//// [Protected4.js]
var C = (function () {
function C() {
}
C.prototype.m = function () {
};
return C;
})();
+13
View File
@@ -0,0 +1,13 @@
//// [Protected6.ts]
class C {
static protected m() { }
}
//// [Protected6.js]
var C = (function () {
function C() {
}
C.m = function () {
};
return C;
})();
+13
View File
@@ -0,0 +1,13 @@
//// [Protected7.ts]
class C {
protected private m() { }
}
//// [Protected7.js]
var C = (function () {
function C() {
}
C.prototype.m = function () {
};
return C;
})();
+5
View File
@@ -0,0 +1,5 @@
//// [TupleType3.ts]
var v: []
//// [TupleType3.js]
var v;
+5
View File
@@ -0,0 +1,5 @@
//// [TupleType5.ts]
var v: [number,]
//// [TupleType5.js]
var v;
@@ -0,0 +1,5 @@
//// [VariableDeclaration10_es6.ts]
let a: number = 1
//// [VariableDeclaration10_es6.js]
let a = 1;
@@ -0,0 +1,7 @@
//// [VariableDeclaration11_es6.ts]
"use strict";
let
//// [VariableDeclaration11_es6.js]
"use strict";
let ;
@@ -0,0 +1,5 @@
//// [VariableDeclaration1_es6.ts]
const
//// [VariableDeclaration1_es6.js]
const ;
@@ -0,0 +1,5 @@
//// [VariableDeclaration2_es6.ts]
const a
//// [VariableDeclaration2_es6.js]
const a;
@@ -0,0 +1,5 @@
//// [VariableDeclaration3_es6.ts]
const a = 1
//// [VariableDeclaration3_es6.js]
const a = 1;
@@ -0,0 +1,5 @@
//// [VariableDeclaration4_es6.ts]
const a: number
//// [VariableDeclaration4_es6.js]
const a;
@@ -0,0 +1,5 @@
//// [VariableDeclaration5_es6.ts]
const a: number = 1
//// [VariableDeclaration5_es6.js]
const a = 1;
@@ -0,0 +1,5 @@
//// [VariableDeclaration7_es6.ts]
let a
//// [VariableDeclaration7_es6.js]
let a;
@@ -0,0 +1,5 @@
//// [VariableDeclaration8_es6.ts]
let a = 1
//// [VariableDeclaration8_es6.js]
let a = 1;
@@ -0,0 +1,5 @@
//// [VariableDeclaration9_es6.ts]
let a: number
//// [VariableDeclaration9_es6.js]
let a;
@@ -0,0 +1,11 @@
//// [YieldExpression10_es6.ts]
var v = { * foo() {
yield(foo);
}
}
//// [YieldExpression10_es6.js]
var v = { foo: function () {
;
} };
@@ -0,0 +1,16 @@
//// [YieldExpression11_es6.ts]
class C {
*foo() {
yield(foo);
}
}
//// [YieldExpression11_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
;
};
return C;
})();
@@ -0,0 +1,14 @@
//// [YieldExpression12_es6.ts]
class C {
constructor() {
yield foo
}
}
//// [YieldExpression12_es6.js]
var C = (function () {
function C() {
;
}
return C;
})();
@@ -0,0 +1,7 @@
//// [YieldExpression13_es6.ts]
function* foo() { yield }
//// [YieldExpression13_es6.js]
function foo() {
;
}
@@ -0,0 +1,16 @@
//// [YieldExpression14_es6.ts]
class C {
foo() {
yield foo
}
}
//// [YieldExpression14_es6.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
;
};
return C;
})();
@@ -0,0 +1,9 @@
//// [YieldExpression15_es6.ts]
var v = () => {
yield foo
}
//// [YieldExpression15_es6.js]
var v = function () {
;
};
@@ -0,0 +1,13 @@
//// [YieldExpression16_es6.ts]
function* foo() {
function bar() {
yield foo;
}
}
//// [YieldExpression16_es6.js]
function foo() {
function bar() {
;
}
}
@@ -0,0 +1,7 @@
//// [YieldExpression17_es6.ts]
var v = { get foo() { yield foo; } }
//// [YieldExpression17_es6.js]
var v = { get foo() {
;
} };
@@ -0,0 +1,7 @@
//// [YieldExpression18_es6.ts]
"use strict";
yield(foo);
//// [YieldExpression18_es6.js]
"use strict";
;
@@ -0,0 +1,17 @@
//// [YieldExpression19_es6.ts]
function*foo() {
function bar() {
function* quux() {
yield(foo);
}
}
}
//// [YieldExpression19_es6.js]
function foo() {
function bar() {
function quux() {
;
}
}
}
@@ -0,0 +1,5 @@
//// [YieldExpression2_es6.ts]
yield foo;
//// [YieldExpression2_es6.js]
;
@@ -0,0 +1,11 @@
//// [YieldExpression3_es6.ts]
function* foo() {
yield
yield
}
//// [YieldExpression3_es6.js]
function foo() {
;
;
}
@@ -0,0 +1,11 @@
//// [YieldExpression4_es6.ts]
function* foo() {
yield;
yield;
}
//// [YieldExpression4_es6.js]
function foo() {
;
;
}
@@ -0,0 +1,9 @@
//// [YieldExpression6_es6.ts]
function* foo() {
yield*foo
}
//// [YieldExpression6_es6.js]
function foo() {
;
}
@@ -0,0 +1,9 @@
//// [YieldExpression7_es6.ts]
function* foo() {
yield foo
}
//// [YieldExpression7_es6.js]
function foo() {
;
}
@@ -0,0 +1,11 @@
//// [YieldExpression8_es6.ts]
yield(foo);
function* foo() {
yield(foo);
}
//// [YieldExpression8_es6.js]
yield(foo);
function foo() {
;
}
@@ -0,0 +1,9 @@
//// [YieldExpression9_es6.ts]
var v = function*() {
yield(foo);
}
//// [YieldExpression9_es6.js]
var v = function () {
;
};
@@ -0,0 +1,171 @@
//// [accessibilityModifiers.ts]
// No errors
class C {
private static privateProperty;
private static privateMethod() { }
private static get privateGetter() { return 0; }
private static set privateSetter(a: number) { }
protected static protectedProperty;
protected static protectedMethod() { }
protected static get protectedGetter() { return 0; }
protected static set protectedSetter(a: number) { }
public static publicProperty;
public static publicMethod() { }
public static get publicGetter() { return 0; }
public static set publicSetter(a: number) { }
}
// Errors, accessibility modifiers must precede static
class D {
static private privateProperty;
static private privateMethod() { }
static private get privateGetter() { return 0; }
static private set privateSetter(a: number) { }
static protected protectedProperty;
static protected protectedMethod() { }
static protected get protectedGetter() { return 0; }
static protected set protectedSetter(a: number) { }
static public publicProperty;
static public publicMethod() { }
static public get publicGetter() { return 0; }
static public set publicSetter(a: number) { }
}
// Errors, multiple accessibility modifier
class E {
private public protected property;
public protected method() { }
private protected get getter() { return 0; }
public public set setter(a: number) { }
}
//// [accessibilityModifiers.js]
// No errors
var C = (function () {
function C() {
}
C.privateMethod = function () {
};
Object.defineProperty(C, "privateGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "privateSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
C.protectedMethod = function () {
};
Object.defineProperty(C, "protectedGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "protectedSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
C.publicMethod = function () {
};
Object.defineProperty(C, "publicGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "publicSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
return C;
})();
// Errors, accessibility modifiers must precede static
var D = (function () {
function D() {
}
D.privateMethod = function () {
};
Object.defineProperty(D, "privateGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(D, "privateSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
D.protectedMethod = function () {
};
Object.defineProperty(D, "protectedGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(D, "protectedSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
D.publicMethod = function () {
};
Object.defineProperty(D, "publicGetter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(D, "publicSetter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
return D;
})();
// Errors, multiple accessibility modifier
var E = (function () {
function E() {
}
E.prototype.method = function () {
};
Object.defineProperty(E.prototype, "getter", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(E.prototype, "setter", {
set: function (a) {
},
enumerable: true,
configurable: true
});
return E;
})();
@@ -0,0 +1,57 @@
//// [accessorWithES3.ts]
// error to use accessors in ES3 mode
class C {
get x() {
return 1;
}
}
class D {
set x(v) {
}
}
var x = {
get a() { return 1 }
}
var y = {
set b(v) { }
}
//// [accessorWithES3.js]
// error to use accessors in ES3 mode
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return 1;
},
enumerable: true,
configurable: true
});
return C;
})();
var D = (function () {
function D() {
}
Object.defineProperty(D.prototype, "x", {
set: function (v) {
},
enumerable: true,
configurable: true
});
return D;
})();
var x = {
get a() {
return 1;
}
};
var y = {
set b(v) {
}
};
@@ -0,0 +1,27 @@
//// [accessorWithInitializer.ts]
class C {
set X(v = 0) { }
static set X(v2 = 0) { }
}
//// [accessorWithInitializer.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
set: function (v) {
if (v === void 0) { v = 0; }
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "X", {
set: function (v2) {
if (v2 === void 0) { v2 = 0; }
},
enumerable: true,
configurable: true
});
return C;
})();
@@ -0,0 +1,33 @@
//// [accessorWithRestParam.ts]
class C {
set X(...v) { }
static set X(...v2) { }
}
//// [accessorWithRestParam.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
set: function () {
var v = [];
for (var _i = 0; _i < arguments.length; _i++) {
v[_i - 0] = arguments[_i];
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "X", {
set: function () {
var v2 = [];
for (var _i = 0; _i < arguments.length; _i++) {
v2[_i - 0] = arguments[_i];
}
},
enumerable: true,
configurable: true
});
return C;
})();
@@ -0,0 +1,6 @@
//// [accessorWithoutBody1.ts]
var v = { get foo() }
//// [accessorWithoutBody1.js]
var v = { get foo() {
} };
@@ -0,0 +1,6 @@
//// [accessorWithoutBody2.ts]
var v = { set foo(a) }
//// [accessorWithoutBody2.js]
var v = { set foo(a) {
} };
@@ -0,0 +1,33 @@
//// [accessorsAreNotContextuallyTyped.ts]
// accessors are not contextually typed
class C {
set x(v: (a: string) => string) {
}
get x() {
return (x: string) => "";
}
}
var c: C;
var r = c.x(''); // string
//// [accessorsAreNotContextuallyTyped.js]
// accessors are not contextually typed
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return function (x) { return ""; };
},
set: function (v) {
},
enumerable: true,
configurable: true
});
return C;
})();
var c;
var r = c.x(''); // string
@@ -0,0 +1,49 @@
//// [accessorsEmit.ts]
class Result { }
class Test {
get Property(): Result {
var x = 1;
return null;
}
}
class Test2 {
get Property() {
var x = 1;
return null;
}
}
//// [accessorsEmit.js]
var Result = (function () {
function Result() {
}
return Result;
})();
var Test = (function () {
function Test() {
}
Object.defineProperty(Test.prototype, "Property", {
get: function () {
var x = 1;
return null;
},
enumerable: true,
configurable: true
});
return Test;
})();
var Test2 = (function () {
function Test2() {
}
Object.defineProperty(Test2.prototype, "Property", {
get: function () {
var x = 1;
return null;
},
enumerable: true,
configurable: true
});
return Test2;
})();
@@ -0,0 +1,21 @@
//// [accessorsInAmbientContext.ts]
declare module M {
class C {
get X() { return 1; }
set X(v) { }
static get Y() { return 1; }
static set Y(v) { }
}
}
declare class C {
get X() { return 1; }
set X(v) { }
static get Y() { return 1; }
static set Y(v) { }
}
//// [accessorsInAmbientContext.js]
@@ -0,0 +1,24 @@
//// [accessorsNotAllowedInES3.ts]
class C {
get x(): number { return 1; }
}
var y = { get foo() { return 3; } };
//// [accessorsNotAllowedInES3.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return 1;
},
enumerable: true,
configurable: true
});
return C;
})();
var y = { get foo() {
return 3;
} };
@@ -0,0 +1,59 @@
//// [accessors_spec_section-4.5_error-cases.ts]
class LanguageSpec_section_4_5_error_cases {
public set AnnotatedSetter_SetterFirst(a: number) { }
public get AnnotatedSetter_SetterFirst() { return ""; }
public get AnnotatedSetter_SetterLast() { return ""; }
public set AnnotatedSetter_SetterLast(a: number) { }
public get AnnotatedGetter_GetterFirst(): string { return ""; }
public set AnnotatedGetter_GetterFirst(aStr) { aStr = 0; }
public set AnnotatedGetter_GetterLast(aStr) { aStr = 0; }
public get AnnotatedGetter_GetterLast(): string { return ""; }
}
//// [accessors_spec_section-4.5_error-cases.js]
var LanguageSpec_section_4_5_error_cases = (function () {
function LanguageSpec_section_4_5_error_cases() {
}
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", {
get: function () {
return "";
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", {
get: function () {
return "";
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", {
get: function () {
return "";
},
set: function (aStr) {
aStr = 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", {
get: function () {
return "";
},
set: function (aStr) {
aStr = 0;
},
enumerable: true,
configurable: true
});
return LanguageSpec_section_4_5_error_cases;
})();
@@ -0,0 +1,104 @@
//// [accessors_spec_section-4.5_inference.ts]
class A { }
class B extends A { }
class LanguageSpec_section_4_5_inference {
public set InferredGetterFromSetterAnnotation(a: A) { }
public get InferredGetterFromSetterAnnotation() { return new B(); }
public get InferredGetterFromSetterAnnotation_GetterFirst() { return new B(); }
public set InferredGetterFromSetterAnnotation_GetterFirst(a: A) { }
public get InferredFromGetter() { return new B(); }
public set InferredFromGetter(a) { }
public set InferredFromGetter_SetterFirst(a) { }
public get InferredFromGetter_SetterFirst() { return new B(); }
public set InferredSetterFromGetterAnnotation(a) { }
public get InferredSetterFromGetterAnnotation() : A { return new B(); }
public get InferredSetterFromGetterAnnotation_GetterFirst() : A { return new B(); }
public set InferredSetterFromGetterAnnotation_GetterFirst(a) { }
}
//// [accessors_spec_section-4.5_inference.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var A = (function () {
function A() {
}
return A;
})();
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
})(A);
var LanguageSpec_section_4_5_inference = (function () {
function LanguageSpec_section_4_5_inference() {
}
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", {
get: function () {
return new B();
},
set: function (a) {
},
enumerable: true,
configurable: true
});
return LanguageSpec_section_4_5_inference;
})();
+11
View File
@@ -0,0 +1,11 @@
//// [ambientEnum1.ts]
declare enum E1 {
y = 4.23
}
// Ambient enum with computer member
declare enum E2 {
x = 'foo'.length
}
//// [ambientEnum1.js]
@@ -0,0 +1,6 @@
//// [ambientEnumElementInitializer3.ts]
declare enum E {
e = 3.3 // Decimal
}
//// [ambientEnumElementInitializer3.js]
@@ -0,0 +1,63 @@
//// [ambientErrors.ts]
// Ambient variable with an initializer
declare var x = 4;
// Ambient functions with invalid overloads
declare function fn(x: number): string;
declare function fn(x: 'foo'): number;
// Ambient functions with duplicate signatures
declare function fn1(x: number): string;
declare function fn1(x: number): string;
// Ambient function overloads that differ only by return type
declare function fn2(x: number): string;
declare function fn2(x: number): number;
// Ambient function with default parameter values
declare function fn3(x = 3);
// Ambient function with function body
declare function fn4() { };
// Ambient enum with non - integer literal constant member
declare enum E1 {
y = 4.23
}
// Ambient enum with computer member
declare enum E2 {
x = 'foo'.length
}
// Ambient module with initializers for values, bodies for functions / classes
declare module M1 {
var x = 3;
function fn() { }
class C {
static x = 3;
y = 4;
constructor() { }
fn() { }
static sfn() { }
}
}
// Ambient external module not in the global module
module M2 {
declare module 'nope' { }
}
// Ambient external module with a string literal name that isn't a top level external module name
declare module '../foo' { }
// Ambient external module with export assignment and other exported members
declare module 'bar' {
var n;
export var q;
export = n;
}
//// [ambientErrors.js]
;
@@ -0,0 +1,4 @@
//// [ambientErrors1.ts]
declare var x = 4;
//// [ambientErrors1.js]
@@ -0,0 +1,11 @@
//// [ambientGetters.ts]
declare class A {
get length() : number;
}
declare class B {
get length() { return 0; }
}
//// [ambientGetters.js]
@@ -0,0 +1,8 @@
//// [ambientStatement1.ts]
declare module M1 {
while(true);
export var v1 = () => false;
}
//// [ambientStatement1.js]
@@ -0,0 +1,30 @@
//// [ambientWithStatements.ts]
declare module M {
break;
continue;
debugger;
do { } while (true);
var x;
for (x in null) { }
if (true) { } else { }
1;
L: var y;
return;
switch (x) {
case 1:
break;
default:
break;
}
throw "nooo";
try {
}
catch (e) {
}
finally {
}
with (x) {
}
}
//// [ambientWithStatements.js]
@@ -0,0 +1,32 @@
//// [anyIdenticalToItself.ts]
function foo(x: any);
function foo(x: any);
function foo(x: any, y: number) { }
class C {
get X(): any {
var y: any;
return y;
}
set X(v: any) {
}
}
//// [anyIdenticalToItself.js]
function foo(x, y) {
}
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "X", {
get: function () {
var y;
return y;
},
set: function (v) {
},
enumerable: true,
configurable: true
});
return C;
})();
@@ -0,0 +1,46 @@
//// [arraySigChecking.ts]
declare module M {
interface iBar { t: any; }
interface iFoo extends iBar {
s: any;
}
class cFoo {
t: any;
}
var foo: { [index: any]; }; // expect an error here
}
interface myInt {
voidFn(): void;
}
var myVar: myInt;
var strArray: string[] = [myVar.voidFn()];
var myArray: number[][][];
myArray = [[1, 2]];
function isEmpty(l: { length: number }) {
return l.length === 0;
}
isEmpty([]);
isEmpty(new Array(3));
isEmpty(new Array<string>(3));
isEmpty(['a']);
//// [arraySigChecking.js]
var myVar;
var strArray = [myVar.voidFn()];
var myArray;
myArray = [[1, 2]];
function isEmpty(l) {
return l.length === 0;
}
isEmpty([]);
isEmpty(new Array(3));
isEmpty(new Array(3));
isEmpty(['a']);
+7
View File
@@ -0,0 +1,7 @@
//// [asiReturn.ts]
// This should be an error for using a return outside a function, but ASI should work properly
return
//// [asiReturn.js]
// This should be an error for using a return outside a function, but ASI should work properly
return;
@@ -0,0 +1,61 @@
//// [assignmentCompatBug3.ts]
function makePoint(x: number, y: number) {
return {
get x() { return x;}, // shouldn't be "void"
get y() { return y;}, // shouldn't be "void"
//x: "yo",
//y: "boo",
dist: function () {
return Math.sqrt(x*x+y*y); // shouldn't be picking up "x" and "y" from the object lit
}
}
}
class C {
get x() {
return 0;
}
}
function foo(test: string) { }
var x: any;
var y: any;
foo(x);
foo(x + y);
//// [assignmentCompatBug3.js]
function makePoint(x, y) {
return {
get x() {
return x;
},
get y() {
return y;
},
//x: "yo",
//y: "boo",
dist: function () {
return Math.sqrt(x * x + y * y); // shouldn't be picking up "x" and "y" from the object lit
}
};
}
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return 0;
},
enumerable: true,
configurable: true
});
return C;
})();
function foo(test) {
}
var x;
var y;
foo(x);
foo(x + y);
@@ -0,0 +1,5 @@
//// [badArrayIndex.ts]
var results = number[];
//// [badArrayIndex.js]
var results = number[];
@@ -0,0 +1,26 @@
//// [badArraySyntax.ts]
class Z {
public x = "";
}
var a1: Z[] = [];
var a2 = new Z[];
var a3 = new Z[]();
var a4: Z[] = new Z[];
var a5: Z[] = new Z[]();
var a6: Z[][] = new Z [ ] [ ];
//// [badArraySyntax.js]
var Z = (function () {
function Z() {
this.x = "";
}
return Z;
})();
var a1 = [];
var a2 = new Z[];
var a3 = new Z[]();
var a4 = new Z[];
var a5 = new Z[]();
var a6 = new Z[][];
@@ -0,0 +1,5 @@
//// [breakNotInIterationOrSwitchStatement1.ts]
break;
//// [breakNotInIterationOrSwitchStatement1.js]
break;
@@ -0,0 +1,13 @@
//// [breakNotInIterationOrSwitchStatement2.ts]
while (true) {
function f() {
break;
}
}
//// [breakNotInIterationOrSwitchStatement2.js]
while (true) {
function f() {
break;
}
}
+18
View File
@@ -0,0 +1,18 @@
//// [breakTarget5.ts]
target:
while (true) {
function f() {
while (true) {
break target;
}
}
}
//// [breakTarget5.js]
target: while (true) {
function f() {
while (true) {
break target;
}
}
}
@@ -0,0 +1,9 @@
//// [breakTarget6.ts]
while (true) {
break target;
}
//// [breakTarget6.js]
while (true) {
break target;
}
@@ -0,0 +1,112 @@
//// [callSignatureWithOptionalParameterAndInitializer.ts]
// Optional parameters cannot also have initializer expressions, these are all errors
function foo(x?: number = 1) { }
var f = function foo(x?: number = 1) { }
var f2 = (x: number, y? = 1) => { }
foo(1);
foo();
f(1);
f();
f2(1);
f2(1, 2);
class C {
foo(x?: number = 1) { }
}
var c: C;
c.foo();
c.foo(1);
interface I {
(x? = 1);
foo(x: number, y?: number = 1);
}
var i: I;
i();
i(1);
i.foo(1);
i.foo(1, 2);
var a: {
(x?: number = 1);
foo(x? = 1);
}
a();
a(1);
a.foo();
a.foo(1);
var b = {
foo(x?: number = 1) { },
a: function foo(x: number, y?: number = '') { },
b: (x?: any = '') => { }
}
b.foo();
b.foo(1);
b.a(1);
b.a(1, 2);
b.b();
b.b(1);
//// [callSignatureWithOptionalParameterAndInitializer.js]
// Optional parameters cannot also have initializer expressions, these are all errors
function foo(x) {
if (x === void 0) { x = 1; }
}
var f = function foo(x) {
if (x === void 0) { x = 1; }
};
var f2 = function (x, y) {
if (y === void 0) { y = 1; }
};
foo(1);
foo();
f(1);
f();
f2(1);
f2(1, 2);
var C = (function () {
function C() {
}
C.prototype.foo = function (x) {
if (x === void 0) { x = 1; }
};
return C;
})();
var c;
c.foo();
c.foo(1);
var i;
i();
i(1);
i.foo(1);
i.foo(1, 2);
var a;
a();
a(1);
a.foo();
a.foo(1);
var b = {
foo: function (x) {
if (x === void 0) { x = 1; }
},
a: function foo(x, y) {
if (y === void 0) { y = ''; }
},
b: function (x) {
if (x === void 0) { x = ''; }
}
};
b.foo();
b.foo(1);
b.a(1);
b.a(1, 2);
b.b();
b.b(1);
@@ -0,0 +1,17 @@
//// [cannotInvokeNewOnErrorExpression.ts]
module M
{
class ClassA {}
}
var t = new M.ClassA[];
//// [cannotInvokeNewOnErrorExpression.js]
var M;
(function (M) {
var ClassA = (function () {
function ClassA() {
}
return ClassA;
})();
})(M || (M = {}));
var t = new M.ClassA[];
@@ -0,0 +1,10 @@
//// [catchClauseWithTypeAnnotation.ts]
try {
} catch (e: any) {
}
//// [catchClauseWithTypeAnnotation.js]
try {
}
catch (e) {
}
@@ -0,0 +1,82 @@
//// [classConstructorAccessibility.ts]
class C {
public constructor(public x: number) { }
}
class D {
private constructor(public x: number) { } // error
}
class E {
protected constructor(public x: number) { } // error
}
var c = new C(1);
var d = new D(1);
var e = new E(1);
module Generic {
class C<T> {
public constructor(public x: T) { }
}
class D<T> {
private constructor(public x: T) { } // error
}
class E<T> {
protected constructor(public x: T) { } // error
}
var c = new C(1);
var d = new D(1);
var e = new E(1);
}
//// [classConstructorAccessibility.js]
var C = (function () {
function C(x) {
this.x = x;
}
return C;
})();
var D = (function () {
function D(x) {
this.x = x;
} // error
return D;
})();
var E = (function () {
function E(x) {
this.x = x;
} // error
return E;
})();
var c = new C(1);
var d = new D(1);
var e = new E(1);
var Generic;
(function (Generic) {
var C = (function () {
function C(x) {
this.x = x;
}
return C;
})();
var D = (function () {
function D(x) {
this.x = x;
} // error
return D;
})();
var E = (function () {
function E(x) {
this.x = x;
} // error
return E;
})();
var c = new C(1);
var d = new D(1);
var e = new E(1);
})(Generic || (Generic = {}));
@@ -0,0 +1,29 @@
//// [classExtendsMultipleBaseClasses.ts]
class A { }
class B { }
class C extends A,B { }
//// [classExtendsMultipleBaseClasses.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var A = (function () {
function A() {
}
return A;
})();
var B = (function () {
function B() {
}
return B;
})();
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
}
return C;
})(A);
@@ -0,0 +1,24 @@
//// [classHeritageWithTrailingSeparator.ts]
class C { foo: number }
class D extends C, {
}
//// [classHeritageWithTrailingSeparator.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var C = (function () {
function C() {
}
return C;
})();
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
}
return D;
})(C);
@@ -0,0 +1,63 @@
//// [classPropertyAsPrivate.ts]
class C {
private x: string;
private get y() { return null; }
private set y(x) { }
private foo() { }
private static a: string;
private static get b() { return null; }
private static set b(x) { }
private static foo() { }
}
var c: C;
// all errors
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo();
//// [classPropertyAsPrivate.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "y", {
get: function () {
return null;
},
set: function (x) {
},
enumerable: true,
configurable: true
});
C.prototype.foo = function () {
};
Object.defineProperty(C, "b", {
get: function () {
return null;
},
set: function (x) {
},
enumerable: true,
configurable: true
});
C.foo = function () {
};
return C;
})();
var c;
// all errors
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo();
@@ -0,0 +1,63 @@
//// [classPropertyAsProtected.ts]
class C {
protected x: string;
protected get y() { return null; }
protected set y(x) { }
protected foo() { }
protected static a: string;
protected static get b() { return null; }
protected static set b(x) { }
protected static foo() { }
}
var c: C;
// all errors
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo();
//// [classPropertyAsProtected.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "y", {
get: function () {
return null;
},
set: function (x) {
},
enumerable: true,
configurable: true
});
C.prototype.foo = function () {
};
Object.defineProperty(C, "b", {
get: function () {
return null;
},
set: function (x) {
},
enumerable: true,
configurable: true
});
C.foo = function () {
};
return C;
})();
var c;
// all errors
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo();
@@ -0,0 +1,61 @@
//// [classPropertyIsPublicByDefault.ts]
class C {
x: string;
get y() { return null; }
set y(x) { }
foo() { }
static a: string;
static get b() { return null; }
static set b(x) { }
static foo() { }
}
var c: C;
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo();
//// [classPropertyIsPublicByDefault.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "y", {
get: function () {
return null;
},
set: function (x) {
},
enumerable: true,
configurable: true
});
C.prototype.foo = function () {
};
Object.defineProperty(C, "b", {
get: function () {
return null;
},
set: function (x) {
},
enumerable: true,
configurable: true
});
C.foo = function () {
};
return C;
})();
var c;
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo();
@@ -0,0 +1,29 @@
//// [classWithOptionalParameter.ts]
// classes do not permit optional parameters, these are errors
class C {
x?: string;
f?() {}
}
class C2<T> {
x?: T;
f?(x: T) {}
}
//// [classWithOptionalParameter.js]
// classes do not permit optional parameters, these are errors
var C = (function () {
function C() {
}
C.prototype.f = function () {
};
return C;
})();
var C2 = (function () {
function C2() {
}
C2.prototype.f = function (x) {
};
return C2;
})();
@@ -0,0 +1,60 @@
//// [classWithStaticMembers.ts]
class C {
static fn() { return this; }
static get x() { return 1; }
static set x(v) { }
constructor(public a: number, private b: number) { }
static foo: string;
}
var r = C.fn();
var r2 = r.x;
var r3 = r.foo;
class D extends C {
bar: string;
}
var r = D.fn();
var r2 = r.x;
var r3 = r.foo;
//// [classWithStaticMembers.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var C = (function () {
function C(a, b) {
this.a = a;
this.b = b;
}
C.fn = function () {
return this;
};
Object.defineProperty(C, "x", {
get: function () {
return 1;
},
set: function (v) {
},
enumerable: true,
configurable: true
});
return C;
})();
var r = C.fn();
var r2 = r.x;
var r3 = r.foo;
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
}
return D;
})(C);
var r = D.fn();
var r2 = r.x;
var r3 = r.foo;
+206
View File
@@ -0,0 +1,206 @@
//// [classdecl.ts]
class a {
//constructor ();
constructor (n: number);
constructor (s: string);
constructor (ns: any) {
}
public pgF() { }
public pv;
public get d() {
return 30;
}
public set d() {
}
public static get p2() {
return { x: 30, y: 40 };
}
private static d2() {
}
private static get p3() {
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();
}
}
//// [classdecl.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var a = (function () {
function a(ns) {
}
a.prototype.pgF = function () {
};
Object.defineProperty(a.prototype, "d", {
get: function () {
return 30;
},
set: function () {
},
enumerable: true,
configurable: true
});
Object.defineProperty(a, "p2", {
get: function () {
return { x: 30, y: 40 };
},
enumerable: true,
configurable: true
});
a.d2 = function () {
};
Object.defineProperty(a, "p3", {
get: function () {
return "string";
},
enumerable: true,
configurable: true
});
a.prototype.foo = function (ns) {
return ns.toString();
};
return a;
})();
var b = (function (_super) {
__extends(b, _super);
function b() {
_super.apply(this, arguments);
}
return b;
})(a);
var m1;
(function (m1) {
var b = (function () {
function b() {
}
return b;
})();
m1.b = b;
var d = (function () {
function d() {
}
return d;
})();
})(m1 || (m1 = {}));
var m2;
(function (m2) {
var m3;
(function (m3) {
var c = (function (_super) {
__extends(c, _super);
function c() {
_super.apply(this, arguments);
}
return c;
})(b);
m3.c = c;
var ib2 = (function () {
function ib2() {
}
return ib2;
})();
m3.ib2 = ib2;
})(m3 = m2.m3 || (m2.m3 = {}));
})(m2 || (m2 = {}));
var c = (function (_super) {
__extends(c, _super);
function c() {
_super.apply(this, arguments);
}
return c;
})(m1.b);
var ib2 = (function () {
function ib2() {
}
return ib2;
})();
var d = (function () {
function d() {
}
d.prototype.foo = function (ns) {
return ns.toString();
};
return d;
})();
var e = (function () {
function e() {
}
e.prototype.foo = function (ns) {
return ns.toString();
};
return e;
})();
@@ -0,0 +1,52 @@
//// [cloduleWithDuplicateMember1.ts]
class C {
get x() { return 1; }
static get x() {
return '';
}
static foo() { }
}
module C {
export var x = 1;
}
module C {
export function foo() { }
export function x() { }
}
//// [cloduleWithDuplicateMember1.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
get: function () {
return 1;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "x", {
get: function () {
return '';
},
enumerable: true,
configurable: true
});
C.foo = function () {
};
return C;
})();
var C;
(function (C) {
C.x = 1;
})(C || (C = {}));
var C;
(function (C) {
function foo() {
}
C.foo = foo;
function x() {
}
C.x = x;
})(C || (C = {}));
@@ -0,0 +1,41 @@
//// [cloduleWithDuplicateMember2.ts]
class C {
set x(y) { }
static set y(z) { }
}
module C {
export var x = 1;
}
module C {
export function x() { }
}
//// [cloduleWithDuplicateMember2.js]
var C = (function () {
function C() {
}
Object.defineProperty(C.prototype, "x", {
set: function (y) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "y", {
set: function (z) {
},
enumerable: true,
configurable: true
});
return C;
})();
var C;
(function (C) {
C.x = 1;
})(C || (C = {}));
var C;
(function (C) {
function x() {
}
C.x = x;
})(C || (C = {}));
@@ -0,0 +1,126 @@
//// [collisionCodeGenModuleWithAccessorChildren.ts]
module M {
export var x = 3;
class c {
private y;
set Z(M) {
this.y = x;
}
}
}
module M {
class d {
private y;
set Z(p) {
var M = 10;
this.y = x;
}
}
}
module M { // Shouldnt be _M
class e {
private y;
set M(p) {
this.y = x;
}
}
}
module M {
class f {
get Z() {
var M = 10;
return x;
}
}
}
module M { // Shouldnt be _M
class e {
get M() {
return x;
}
}
}
//// [collisionCodeGenModuleWithAccessorChildren.js]
var M;
(function (_M) {
_M.x = 3;
var c = (function () {
function c() {
}
Object.defineProperty(c.prototype, "Z", {
set: function (M) {
this.y = _M.x;
},
enumerable: true,
configurable: true
});
return c;
})();
})(M || (M = {}));
var M;
(function (_M) {
var d = (function () {
function d() {
}
Object.defineProperty(d.prototype, "Z", {
set: function (p) {
var M = 10;
this.y = _M.x;
},
enumerable: true,
configurable: true
});
return d;
})();
})(M || (M = {}));
var M;
(function (M) {
var e = (function () {
function e() {
}
Object.defineProperty(e.prototype, "M", {
set: function (p) {
this.y = M.x;
},
enumerable: true,
configurable: true
});
return e;
})();
})(M || (M = {}));
var M;
(function (_M) {
var f = (function () {
function f() {
}
Object.defineProperty(f.prototype, "Z", {
get: function () {
var M = 10;
return _M.x;
},
enumerable: true,
configurable: true
});
return f;
})();
})(M || (M = {}));
var M;
(function (M) {
var e = (function () {
function e() {
}
Object.defineProperty(e.prototype, "M", {
get: function () {
return M.x;
},
enumerable: true,
configurable: true
});
return e;
})();
})(M || (M = {}));
@@ -0,0 +1,112 @@
//// [collisionSuperAndLocalFunctionInAccessors.ts]
function _super() { // No error
}
class Foo {
get prop1(): number {
function _super() { // No error
}
return 10;
}
set prop1(val: number) {
function _super() { // No error
}
}
}
class b extends Foo {
get prop2(): number {
function _super() { // Should be error
}
return 10;
}
set prop2(val: number) {
function _super() { // Should be error
}
}
}
class c extends Foo {
get prop2(): number {
var x = () => {
function _super() { // Should be error
}
}
return 10;
}
set prop2(val: number) {
var x = () => {
function _super() { // Should be error
}
}
}
}
//// [collisionSuperAndLocalFunctionInAccessors.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
function _super() {
}
var Foo = (function () {
function Foo() {
}
Object.defineProperty(Foo.prototype, "prop1", {
get: function () {
function _super() {
}
return 10;
},
set: function (val) {
function _super() {
}
},
enumerable: true,
configurable: true
});
return Foo;
})();
var b = (function (_super) {
__extends(b, _super);
function b() {
_super.apply(this, arguments);
}
Object.defineProperty(b.prototype, "prop2", {
get: function () {
function _super() {
}
return 10;
},
set: function (val) {
function _super() {
}
},
enumerable: true,
configurable: true
});
return b;
})(Foo);
var c = (function (_super) {
__extends(c, _super);
function c() {
_super.apply(this, arguments);
}
Object.defineProperty(c.prototype, "prop2", {
get: function () {
var x = function () {
function _super() {
}
};
return 10;
},
set: function (val) {
var x = function () {
function _super() {
}
};
},
enumerable: true,
configurable: true
});
return c;
})(Foo);
@@ -0,0 +1,98 @@
//// [collisionSuperAndLocalVarInAccessors.ts]
var _super = 10; // No Error
class Foo {
get prop1(): number {
var _super = 10; // No error
return 10;
}
set prop1(val: number) {
var _super = 10; // No error
}
}
class b extends Foo {
get prop2(): number {
var _super = 10; // Should be error
return 10;
}
set prop2(val: number) {
var _super = 10; // Should be error
}
}
class c extends Foo {
get prop2(): number {
var x = () => {
var _super = 10; // Should be error
}
return 10;
}
set prop2(val: number) {
var x = () => {
var _super = 10; // Should be error
}
}
}
//// [collisionSuperAndLocalVarInAccessors.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var _super = 10; // No Error
var Foo = (function () {
function Foo() {
}
Object.defineProperty(Foo.prototype, "prop1", {
get: function () {
var _super = 10; // No error
return 10;
},
set: function (val) {
var _super = 10; // No error
},
enumerable: true,
configurable: true
});
return Foo;
})();
var b = (function (_super) {
__extends(b, _super);
function b() {
_super.apply(this, arguments);
}
Object.defineProperty(b.prototype, "prop2", {
get: function () {
var _super = 10; // Should be error
return 10;
},
set: function (val) {
var _super = 10; // Should be error
},
enumerable: true,
configurable: true
});
return b;
})(Foo);
var c = (function (_super) {
__extends(c, _super);
function c() {
_super.apply(this, arguments);
}
Object.defineProperty(c.prototype, "prop2", {
get: function () {
var x = function () {
var _super = 10; // Should be error
};
return 10;
},
set: function (val) {
var x = function () {
var _super = 10; // Should be error
};
},
enumerable: true,
configurable: true
});
return c;
})(Foo);
@@ -0,0 +1,136 @@
//// [collisionSuperAndParameter.ts]
class Foo {
a() {
var lamda = (_super: number) => { // No Error
return x => this; // New scope. So should inject new _this capture
}
}
b(_super: number) { // No Error
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
set c(_super: number) { // No error
}
}
class Foo2 extends Foo {
x() {
var lamda = (_super: number) => { // Error
return x => this; // New scope. So should inject new _this capture
}
}
y(_super: number) { // Error
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
set z(_super: number) { // Error
}
public prop3: {
doStuff: (_super: number) => void; // no error - no code gen
}
public prop4 = {
doStuff: (_super: number) => { // should be error
}
}
constructor(_super: number) { // should be error
super();
}
}
declare class Foo3 extends Foo {
x();
y(_super: number); // No error - no code gen
constructor(_super: number); // No error - no code gen
public prop2: {
doStuff: (_super: number) => void; // no error - no code gen
};
public _super: number; // No error
}
class Foo4 extends Foo {
constructor(_super: number); // no code gen - no error
constructor(_super: string);// no code gen - no error
constructor(_super: any) { // should be error
super();
}
y(_super: number); // no code gen - no error
y(_super: string); // no code gen - no error
y(_super: any) { // Error
var lambda = () => {
return x => this; // New scope. So should inject new _this capture
}
}
}
//// [collisionSuperAndParameter.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var Foo = (function () {
function Foo() {
}
Foo.prototype.a = function () {
var _this = this;
var lamda = function (_super) {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
Foo.prototype.b = function (_super) {
var _this = this;
var lambda = function () {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
Object.defineProperty(Foo.prototype, "c", {
set: function (_super) {
},
enumerable: true,
configurable: true
});
return Foo;
})();
var Foo2 = (function (_super) {
__extends(Foo2, _super);
function Foo2(_super) {
_super.call(this);
this.prop4 = {
doStuff: function (_super) {
}
};
}
Foo2.prototype.x = function () {
var _this = this;
var lamda = function (_super) {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
Foo2.prototype.y = function (_super) {
var _this = this;
var lambda = function () {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
Object.defineProperty(Foo2.prototype, "z", {
set: function (_super) {
},
enumerable: true,
configurable: true
});
return Foo2;
})(Foo);
var Foo4 = (function (_super) {
__extends(Foo4, _super);
function Foo4(_super) {
_super.call(this);
}
Foo4.prototype.y = function (_super) {
var _this = this;
var lambda = function () {
return function (x) { return _this; }; // New scope. So should inject new _this capture
};
};
return Foo4;
})(Foo);

Some files were not shown because too many files have changed in this diff Show More