117 lines
No EOL
3.7 KiB
Text
117 lines
No EOL
3.7 KiB
Text
==== tests/cases/compiler/errorsInGenericTypeReference.ts (22 errors) ====
|
|
|
|
interface IFoo<T> { }
|
|
|
|
class Foo<T> { }
|
|
|
|
|
|
// in call type arguments
|
|
class testClass1 {
|
|
method<T>(): void { }
|
|
}
|
|
var tc1 = new testClass1();
|
|
tc1.method<{ x: V }>(); // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
|
|
// in constructor type arguments
|
|
class testClass2<T> {
|
|
}
|
|
var tc2 = new testClass2<{ x: V }>(); // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
|
|
// in method return type annotation
|
|
class testClass3 {
|
|
testMethod1(): Foo<{ x: V }> { return null; } // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
static testMethod2(): Foo<{ x: V }> { return null } // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
set a(value: Foo<{ x: V }>) { } // error: could not find symbol V
|
|
~
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
property: Foo<{ x: V }>; // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
}
|
|
|
|
|
|
// in function return type annotation
|
|
function testFunction1(): Foo<{ x: V }> { return null; } // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
|
|
// in paramter types
|
|
function testFunction2(p: Foo<{ x: V }>) { }// error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
|
|
// in var type annotation
|
|
var f: Foo<{ x: V }>; // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
|
|
// in constraints
|
|
class testClass4<T extends { x: V }> { } // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
interface testClass5<T extends Foo<{ x: V }>> { } // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
class testClass6<T> {
|
|
method<M extends { x: V }>(): void { } // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
}
|
|
|
|
interface testInterface1 {
|
|
new <M extends { x: V }>(a: M); // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
}
|
|
|
|
|
|
// in extends clause
|
|
class testClass7 extends Foo<{ x: V }> { } // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
|
|
// in implements clause
|
|
class testClass8 implements IFoo<{ x: V }> { } // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
|
|
|
|
// in signatures
|
|
interface testInterface2 {
|
|
new (a: Foo<{ x: V }>): Foo<{ x: V }>; //2x: error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
[x: string]: Foo<{ x: V }>; // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
method(a: Foo<{ x: V }>): Foo<{ x: V }>; //2x: error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
property: Foo<{ x: V }>; // error: could not find symbol V
|
|
~
|
|
!!! Cannot find name 'V'.
|
|
}
|
|
|
|
|