More test cases and accept baselines

This commit is contained in:
Nathan Shively-Sanders 2015-11-09 10:21:54 -08:00
parent 81c2cb90e8
commit a6068e1c08
4 changed files with 313 additions and 4 deletions

View file

@ -0,0 +1,104 @@
//// [genericClassExpressionInFunction.ts]
class A<T> {
genericVar: T
}
function B1<U>() {
// class expression can use T
return class extends A<U> { }
}
class B2<V> {
anon = class extends A<V> { }
}
function B3<W>() {
return class Inner<TInner> extends A<W> { }
}
// extends can call B
class K extends B1<number>() {
namae: string;
}
class C extends (new B2<number>().anon) {
name: string;
}
let b3Number = B3<number>();
class S extends b3Number<string> {
nom: string;
}
var c = new C();
var k = new K();
var s = new S();
c.genericVar = 12;
k.genericVar = 12;
s.genericVar = 12;
//// [genericClassExpressionInFunction.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A() {
}
return A;
})();
function B1() {
// class expression can use T
return (function (_super) {
__extends(class_1, _super);
function class_1() {
_super.apply(this, arguments);
}
return class_1;
})(A);
}
var B2 = (function () {
function B2() {
this.anon = (function (_super) {
__extends(class_2, _super);
function class_2() {
_super.apply(this, arguments);
}
return class_2;
})(A);
}
return B2;
})();
function B3() {
return (function (_super) {
__extends(Inner, _super);
function Inner() {
_super.apply(this, arguments);
}
return Inner;
})(A);
}
// extends can call B
var K = (function (_super) {
__extends(K, _super);
function K() {
_super.apply(this, arguments);
}
return K;
})(B1());
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
}
return C;
})((new B2().anon));
var b3Number = B3();
var S = (function (_super) {
__extends(S, _super);
function S() {
_super.apply(this, arguments);
}
return S;
})(b3Number);
var c = new C();
var k = new K();
var s = new S();
c.genericVar = 12;
k.genericVar = 12;
s.genericVar = 12;

View file

@ -0,0 +1,92 @@
=== tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts ===
class A<T> {
>A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0))
>T : Symbol(T, Decl(genericClassExpressionInFunction.ts, 0, 8))
genericVar: T
>genericVar : Symbol(genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12))
>T : Symbol(T, Decl(genericClassExpressionInFunction.ts, 0, 8))
}
function B1<U>() {
>B1 : Symbol(B1, Decl(genericClassExpressionInFunction.ts, 2, 1))
>U : Symbol(U, Decl(genericClassExpressionInFunction.ts, 3, 12))
// class expression can use T
return class extends A<U> { }
>A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0))
>U : Symbol(U, Decl(genericClassExpressionInFunction.ts, 3, 12))
}
class B2<V> {
>B2 : Symbol(B2, Decl(genericClassExpressionInFunction.ts, 6, 1))
>V : Symbol(V, Decl(genericClassExpressionInFunction.ts, 7, 9))
anon = class extends A<V> { }
>anon : Symbol(anon, Decl(genericClassExpressionInFunction.ts, 7, 13))
>A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0))
>V : Symbol(V, Decl(genericClassExpressionInFunction.ts, 7, 9))
}
function B3<W>() {
>B3 : Symbol(B3, Decl(genericClassExpressionInFunction.ts, 9, 1))
>W : Symbol(W, Decl(genericClassExpressionInFunction.ts, 10, 12))
return class Inner<TInner> extends A<W> { }
>Inner : Symbol(Inner, Decl(genericClassExpressionInFunction.ts, 11, 10))
>TInner : Symbol(TInner, Decl(genericClassExpressionInFunction.ts, 11, 23))
>A : Symbol(A, Decl(genericClassExpressionInFunction.ts, 0, 0))
>W : Symbol(W, Decl(genericClassExpressionInFunction.ts, 10, 12))
}
// extends can call B
class K extends B1<number>() {
>K : Symbol(K, Decl(genericClassExpressionInFunction.ts, 12, 1))
>B1 : Symbol(B1, Decl(genericClassExpressionInFunction.ts, 2, 1))
namae: string;
>namae : Symbol(namae, Decl(genericClassExpressionInFunction.ts, 14, 30))
}
class C extends (new B2<number>().anon) {
>C : Symbol(C, Decl(genericClassExpressionInFunction.ts, 16, 1))
>new B2<number>().anon : Symbol(B2.anon, Decl(genericClassExpressionInFunction.ts, 7, 13))
>B2 : Symbol(B2, Decl(genericClassExpressionInFunction.ts, 6, 1))
>anon : Symbol(B2.anon, Decl(genericClassExpressionInFunction.ts, 7, 13))
name: string;
>name : Symbol(name, Decl(genericClassExpressionInFunction.ts, 17, 41))
}
let b3Number = B3<number>();
>b3Number : Symbol(b3Number, Decl(genericClassExpressionInFunction.ts, 20, 3))
>B3 : Symbol(B3, Decl(genericClassExpressionInFunction.ts, 9, 1))
class S extends b3Number<string> {
>S : Symbol(S, Decl(genericClassExpressionInFunction.ts, 20, 28))
>b3Number : Symbol(b3Number, Decl(genericClassExpressionInFunction.ts, 20, 3))
nom: string;
>nom : Symbol(nom, Decl(genericClassExpressionInFunction.ts, 21, 34))
}
var c = new C();
>c : Symbol(c, Decl(genericClassExpressionInFunction.ts, 24, 3))
>C : Symbol(C, Decl(genericClassExpressionInFunction.ts, 16, 1))
var k = new K();
>k : Symbol(k, Decl(genericClassExpressionInFunction.ts, 25, 3))
>K : Symbol(K, Decl(genericClassExpressionInFunction.ts, 12, 1))
var s = new S();
>s : Symbol(s, Decl(genericClassExpressionInFunction.ts, 26, 3))
>S : Symbol(S, Decl(genericClassExpressionInFunction.ts, 20, 28))
c.genericVar = 12;
>c.genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12))
>c : Symbol(c, Decl(genericClassExpressionInFunction.ts, 24, 3))
>genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12))
k.genericVar = 12;
>k.genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12))
>k : Symbol(k, Decl(genericClassExpressionInFunction.ts, 25, 3))
>genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12))
s.genericVar = 12;
>s.genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12))
>s : Symbol(s, Decl(genericClassExpressionInFunction.ts, 26, 3))
>genericVar : Symbol(A.genericVar, Decl(genericClassExpressionInFunction.ts, 0, 12))

View file

@ -0,0 +1,108 @@
=== tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts ===
class A<T> {
>A : A<T>
>T : T
genericVar: T
>genericVar : T
>T : T
}
function B1<U>() {
>B1 : <U>() => typeof (Anonymous class)
>U : U
// class expression can use T
return class extends A<U> { }
>class extends A<U> { } : typeof (Anonymous class)
>A : A<U>
>U : U
}
class B2<V> {
>B2 : B2<V>
>V : V
anon = class extends A<V> { }
>anon : typeof (Anonymous class)
>class extends A<V> { } : typeof (Anonymous class)
>A : A<V>
>V : V
}
function B3<W>() {
>B3 : <W>() => typeof Inner
>W : W
return class Inner<TInner> extends A<W> { }
>class Inner<TInner> extends A<W> { } : typeof Inner
>Inner : typeof Inner
>TInner : TInner
>A : A<W>
>W : W
}
// extends can call B
class K extends B1<number>() {
>K : K
>B1<number>() : B1<number>.(Anonymous class)
>B1 : <U>() => typeof (Anonymous class)
namae: string;
>namae : string
}
class C extends (new B2<number>().anon) {
>C : C
>(new B2<number>().anon) : B2<number>.(Anonymous class)
>new B2<number>().anon : typeof (Anonymous class)
>new B2<number>() : B2<number>
>B2 : typeof B2
>anon : typeof (Anonymous class)
name: string;
>name : string
}
let b3Number = B3<number>();
>b3Number : typeof Inner
>B3<number>() : typeof Inner
>B3 : <W>() => typeof Inner
class S extends b3Number<string> {
>S : S
>b3Number : B3<number>.Inner<string>
nom: string;
>nom : string
}
var c = new C();
>c : C
>new C() : C
>C : typeof C
var k = new K();
>k : K
>new K() : K
>K : typeof K
var s = new S();
>s : S
>new S() : S
>S : typeof S
c.genericVar = 12;
>c.genericVar = 12 : number
>c.genericVar : number
>c : C
>genericVar : number
>12 : number
k.genericVar = 12;
>k.genericVar = 12 : number
>k.genericVar : number
>k : K
>genericVar : number
>12 : number
s.genericVar = 12;
>s.genericVar = 12 : number
>s.genericVar : number
>s : S
>genericVar : number
>12 : number

View file

@ -1,8 +1,6 @@
class A<T> {
genericVar: T
}
class B3 extends A<number> {
}
function B1<U>() {
// class expression can use T
return class extends A<U> { }
@ -10,6 +8,9 @@ function B1<U>() {
class B2<V> {
anon = class extends A<V> { }
}
function B3<W>() {
return class Inner<TInner> extends A<W> { }
}
// extends can call B
class K extends B1<number>() {
namae: string;
@ -17,9 +18,13 @@ class K extends B1<number>() {
class C extends (new B2<number>().anon) {
name: string;
}
let b3Number = B3<number>();
class S extends b3Number<string> {
nom: string;
}
var c = new C();
var k = new K();
var b3 = new B3();
var s = new S();
c.genericVar = 12;
k.genericVar = 12;
b3.genericVar = 12
s.genericVar = 12;