1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
=== tests/cases/compiler/classTypeParametersInStatics.ts ===
module Editor {
>Editor : typeof Editor
export class List<T> {
>List : List<T>
public next: List<T>;
>next : List<T>
public prev: List<T>;
>prev : List<T>
constructor(public isHead: boolean, public data: T) {
>isHead : boolean
>data : T
}
public static MakeHead(): List<T> { // should error
>MakeHead : () => List<any>
var entry: List<T> = new List<T>(true, null);
>entry : List<any>
>new List<T>(true, null) : List<any>
>List : typeof List
>true : true
>null : null
entry.prev = entry;
>entry.prev = entry : List<any>
>entry.prev : List<any>
>entry : List<any>
>prev : List<any>
>entry : List<any>
entry.next = entry;
>entry.next = entry : List<any>
>entry.next : List<any>
>entry : List<any>
>next : List<any>
>entry : List<any>
return entry;
>entry : List<any>
}
public static MakeHead2<T>(): List<T> { // should not error
>MakeHead2 : <T>() => List<T>
var entry: List<T> = new List<T>(true, null);
>entry : List<T>
>new List<T>(true, null) : List<T>
>List : typeof List
>true : true
>null : null
entry.prev = entry;
>entry.prev = entry : List<T>
>entry.prev : List<T>
>entry : List<T>
>prev : List<T>
>entry : List<T>
entry.next = entry;
>entry.next = entry : List<T>
>entry.next : List<T>
>entry : List<T>
>next : List<T>
>entry : List<T>
return entry;
>entry : List<T>
}
public static MakeHead3<U>(): List<U> { // should not error
>MakeHead3 : <U>() => List<U>
var entry: List<U> = new List<U>(true, null);
>entry : List<U>
>new List<U>(true, null) : List<U>
>List : typeof List
>true : true
>null : null
entry.prev = entry;
>entry.prev = entry : List<U>
>entry.prev : List<U>
>entry : List<U>
>prev : List<U>
>entry : List<U>
entry.next = entry;
>entry.next = entry : List<U>
>entry.next : List<U>
>entry : List<U>
>next : List<U>
>entry : List<U>
return entry;
>entry : List<U>
}
}
}
|