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

72 lines
3.2 KiB
Plaintext
Raw Normal View History

tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS2332: 'this' cannot be referenced in current location.
2015-04-27 03:31:47 +02:00
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(28,13): error TS2331: 'this' cannot be referenced in a module or namespace body.
2015-04-01 02:23:52 +02:00
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(44,9): error TS2332: 'this' cannot be referenced in current location.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(45,9): error TS2332: 'this' cannot be referenced in current location.
2015-04-27 03:31:47 +02:00
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (7 errors) ====
2014-07-13 01:04:16 +02:00
//'this' in static member initializer
class ErrClass1 {
static t = this; // Error
~~~~
!!! error TS2334: 'this' cannot be referenced in a static property initializer.
2014-07-13 01:04:16 +02:00
}
class BaseErrClass {
constructor(t: any) { }
}
class ClassWithNoInitializer extends BaseErrClass {
t;
//'this' in optional super call
constructor() {
super(this); // OK
}
}
class ClassWithInitializer extends BaseErrClass {
t = 4;
//'this' in required super call
constructor() {
super(this); // Error
~~~~
!!! error TS2332: 'this' cannot be referenced in current location.
2014-07-13 01:04:16 +02:00
}
}
module M {
//'this' in module variable
var x = this; // Error
~~~~
2015-04-27 03:31:47 +02:00
!!! error TS2331: 'this' cannot be referenced in a module or namespace body.
2014-07-13 01:04:16 +02:00
}
//'this' as type parameter constraint
// function fn<T extends this >() { } // Error
//'this' as a type argument
function genericFunc<T>(x: T) { }
genericFunc<this>(undefined); // Should be an error
class ErrClass3 extends this {
~~~~
2015-04-01 02:23:52 +02:00
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
2014-07-13 01:04:16 +02:00
}
//'this' as a computed enum value
enum SomeEnum {
A = this, // Should not be allowed
~~~~
!!! error TS2332: 'this' cannot be referenced in current location.
2014-07-13 01:04:16 +02:00
B = this.spaaaace // Also should not be allowed
~~~~
!!! error TS2332: 'this' cannot be referenced in current location.
2014-07-13 01:04:16 +02:00
}
export = this; // Should be an error
2015-02-26 01:03:51 +01:00
~~~~~~~~~~~~~~
2015-04-27 03:31:47 +02:00
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.