TypeScript/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.errors.txt

65 lines
3.2 KiB
Plaintext
Raw Normal View History

tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(11,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(21,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(25,16): error TS2339: Property 'notHere' does not exist on type 'B'.
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(29,6): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(32,22): error TS2339: Property 'notHere' does not exist on type '{}'.
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(36,11): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts (6 errors) ====
class A {
foo(): string { return ''; }
}
class B extends A {
bar(): string {
return '';
}
}
class C<U extends T, T extends A> {
~~~~~~~~~~~
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
f() {
var x: U;
var a = x['foo'](); // should be string
return a + x.foo() + x.notHere();
}
}
var r = (new C<B, A>()).f();
interface I<U extends T, T extends A> {
~~~~~~~~~~~
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
foo: U;
}
var i: I<B, A>;
var r2 = i.foo.notHere();
~~~~~~~
!!! error TS2339: Property 'notHere' does not exist on type 'B'.
2014-07-13 01:04:16 +02:00
var r2b = i.foo['foo']();
var a: {
<U extends T, T extends A>(): U;
~~~~~~~~~~~
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
}
// BUG 794164
var r3: string = a().notHere();
~~~~~~~
!!! error TS2339: Property 'notHere' does not exist on type '{}'.
2014-07-13 01:04:16 +02:00
var r3b: string = a()['foo']();
var b = {
foo: <U extends T, T extends A>(x: U): U => {
~~~~~~~~~~~
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
2014-07-13 01:04:16 +02:00
var a = x['foo'](); // should be string
return a + x.notHere();
},
// BUG 794164
bar: b.foo(1).notHere()
}
var r4 = b.foo(new B()); // error after constraints above made illegal, doesn't matter