TypeScript/tests/cases/conformance/classes/propertyMemberDeclarations
Nathan Shively-Sanders 500a0df6f3
Add useDefineForClassFields flag for Set -> Define property declaration (#33509)
* Disallow property/accessor overrides

Unless the base property or accessor is abstract

* Disallow uninitialised property overrides

This causes quite a few test breaks. We'll probably want to revert many
of them by switching to the upcoming `declare x: number` syntax.

* Updates from design review + fix ancient bug

1. Don't error when overriding properties from interfaces.
2. Fix error when overriding methods with other things. This had no
tests so I assume that the code was always dead and never worked.

* Need to add a couple of errors and squash one

Will update after checking out other branch for a minute

* Everything works so far

Need to test properties initialised in constructor

* Check for constructor initialisation

* change error wording

* Improve error wording

* Add codefix to add missing 'declare'

* Always emit accessors in .d.ts files

* Allow 'declare' on any uninitialised property decl

* Undo code moves

* Let sleeping dogs lie

* Correctly set NodeFlags.Ambient

And simplify redundant parts of check.

* Remove more unneeded code

* Update baselines

* Update baselines

* Update baselines

* Ignore this-property assignments

* Fix base-in-interface check

* Do not error when base parent is interface

* Fix base interface check

* Add missed baselines

* Fix check

* Fix new errors in services

* Fix new errors in services

* Fix errors in testRunner

* Add flag and turn off errors when on

* Structure of new emit is correct, fake content

It is 'hi'.

* Basically right emit

* Fix one last unitialised property declaration

* Haha no I missed another one

* Fix whitespace back to CRLF

* Minor fix and code cleanup

* New test case

* Fix bug in isInitializedProperty

* Updates from design meeting.

1. Change flag name to useDefineForClassFields (and flip polarity).
2. Forbid ES3 + useDefineForClassFields (since there is no
defineProperty).
3. Forbid overriding an abstract property-with-initializer with an
accessor.

* Update baselines

* Object.defineProperty for methods too

Using code from Ron from his upcoming refactor of the factory functions.

* Update slow baselines

* Improve error message

* Update src/compiler/transformers/utilities.ts

Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>

* Add test of computed properties

* Remove done TODO
2019-09-26 13:25:05 -07:00
..
memberAccessorDeclarations Allow accessors in ambient class declarations (#32787) 2019-08-09 16:11:25 -07:00
memberFunctionDeclarations
accessibilityModifiers.ts
accessorsOverrideMethod.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty2.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty3.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty4.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty5.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty6.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
accessorsOverrideProperty7.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
constructorParameterShadowsOuterScopes.ts
definePropertyES5.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
definePropertyOutputES3.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
derivedUninitializedPropertyDeclaration.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
initializerReferencingConstructorLocals.ts
initializerReferencingConstructorParameters.ts
instanceMemberInitialization.ts Move class property transform (#31848) 2019-06-17 14:26:42 -07:00
instanceMemberWithComputedPropertyName.ts Fix visitLexicalEnvironment to properly merge hoisted declarations (#33219) 2019-09-03 15:29:41 -07:00
overrideInterfaceProperty.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyAndAccessorWithSameName.ts
propertyAndFunctionWithSameName.ts
propertyNamedConstructor.ts Emit error on class fields named "constructor" 2019-04-25 17:30:41 -07:00
propertyNamedPrototype.ts
propertyOverridesAccessors.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesAccessors2.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesAccessors3.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesAccessors4.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesAccessors5.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
propertyOverridesMethod.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
staticAndNonStaticPropertiesSameName.ts
staticMemberInitialization.ts
staticPropertyAndFunctionWithSameName.ts
staticPropertyNameConflicts.ts
staticPropertyNameConflictsInAmbientContext.ts Add tests 2017-01-21 17:09:09 +01:00
strictPropertyInitialization.ts Add regression test 2019-02-05 13:08:18 -08:00
thisInInstanceMemberInitializer.ts
thisPropertyOverridesAccessors.ts Add useDefineForClassFields flag for Set -> Define property declaration (#33509) 2019-09-26 13:25:05 -07:00
twoAccessorsWithSameName.ts
twoAccessorsWithSameName2.ts