TypeScript/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt
Josh Goldberg 541e553163
Specific diagnostic suggestions for unexpected keyword or identifier (#43005)
Error message improvement for unexpected tokens in the following situations:

* A word was parsed that seems to have a low edit distance from a known common keyword
* A word was parsed that seems to be a known common keyword and a name _without_ a space in-between
* Parsing in a particular type of node (mostly a class property declaration) got a different word or token than expected

___

* Specific diagnostic suggestions for unexpected keywords or identifier

* Don't reach into there, that's not allowed

* Improved error when there is already an initializer

* Specific module error message for invalid template literal strings

* Skip 'unexpected keyword or identifier' diagnostics for declare nodes

* Improve error for function calls in type positions

* Switch class properties to old diagnostic

* Corrected errors in class members and reused existing textToKeywordObj map

* Corrected more baselines from the merge

* Update src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Mostly addressed feedback

* Clarified function call type message

* Split up and clarified parsing vs error functions

* Swap interface name complaints back, and skip new errors on unknown (invalid) tokens

* Used tokenToString, not a raw semicolon

* Inline getExpressionText helper

* Remove remarks in src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-07-14 13:50:55 -07:00

70 lines
4.5 KiB
Plaintext

tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS2304: Cannot find name 'super'.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,13): error TS1441: Cannot start a function call in a type annotation.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,14): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(10,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(13,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(17,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS2304: Cannot find name 'super'.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,20): error TS1441: Cannot start a function call in a type annotation.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,21): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(22,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(25,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(29,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts (12 errors) ====
// error to use super calls outside a constructor
class Base {
x: string;
}
class Derived extends Base {
a: super();
~~~~~
!!! error TS2304: Cannot find name 'super'.
~
!!! error TS1441: Cannot start a function call in a type annotation.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
b() {
super();
~~~~~
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
}
get C() {
super();
~~~~~
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
return 1;
}
set C(v) {
super();
~~~~~
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
}
static a: super();
~~~~~
!!! error TS2304: Cannot find name 'super'.
~
!!! error TS1441: Cannot start a function call in a type annotation.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
static b() {
super();
~~~~~
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
}
static get C() {
super();
~~~~~
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
return 1;
}
static set C(v) {
super();
~~~~~
!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors.
}
}