TypeScript/tests/cases/conformance/classes
Nathan Shively-Sanders 368db997ed
ESNext+[[Define]]: reference to param props illegal (#36425)
* ESNext+[[Define]]: reference to param props illegal

When target: "esnext" and useDefineForClassFields: true, property
declaration initialisers should not be able to reference parameter
properties; class fields are initialised before the constructor runs,
but parameter properties are not:

```ts
class C {
  foo = this.bar
  constructor(public bar: string) { }
}
```

emits code that looks like this:

```js
class C {
  bar
  foo = this.bar
  constructor(bar) {
    this.bar = bar
  }
}
new C('x').foo.length // crashes; foo is undefined
```

This PR adds an error on foo's declaration with ESNext+[[Define]].

* improve test
2020-01-24 14:53:28 -08:00
..
classDeclarations Fix emit for classes with both fields and 'extends null' 2017-10-09 13:14:49 -07:00
classExpressions Added test for immediately invoked class expression. 2015-12-08 17:54:33 -08:00
constructorDeclarations Emit statements before super (#36417) 2020-01-24 14:52:48 -08:00
indexMemberDeclarations Add snapshot of compiler sources 2014-07-12 17:30:19 -07:00
members Disallow 'declare' modifier on private named properties (#36381) 2020-01-23 13:18:10 -08:00
methodDeclarations More tests for super.method call chain, improve vary-by (#35013) 2019-11-18 18:03:37 -08:00
propertyMemberDeclarations ESNext+[[Define]]: reference to param props illegal (#36425) 2020-01-24 14:53:28 -08:00
awaitAndYieldInProperty.ts disallow 'await' and 'yield' in property and enum member initializer (#34892) 2019-11-14 17:44:48 -08:00
classExpression.ts Add snapshot of compiler sources 2014-07-12 17:30:19 -07:00
mixinAccessModifiers.ts #27716: fix protected methods for intersection fo generic classes 2018-10-12 18:23:07 +03:00
mixinClassesAnnotated.ts Add tests 2017-01-29 12:39:15 -08:00
mixinClassesAnonymous.ts Add regression test 2017-02-01 11:37:24 -08:00
mixinClassesMembers.ts Add tests 2017-01-29 12:39:15 -08:00
nestedClassDeclaration.ts Add snapshot of compiler sources 2014-07-12 17:30:19 -07:00