Commit Graph

9609 Commits

Author SHA1 Message Date
Daniel Rosenwasser b845800bdf Add option to configure automatic optional chain completions (#34552)
Add option to configure automatic optional chain completions
2019-10-18 17:35:59 -07:00
Andrew Branch 91196fc53f Ensure functions that have prototype properties assigned by Object.defineProperty get marked as classes (#34577)
* Ensure functions that have prototype properties assigned by Object.defineProperty get marked as classes

* Revert unneeded change
2019-10-18 16:31:43 -07:00
Nathan Shively-Sanders cdf1ab2dec Bind @class in the right place -- bindWorker not bindChildrenWorker (#34575)
Also add an assert to make future mismatches fail in an obvious place
instead of in a while loop.
2019-10-18 14:13:14 -07:00
Nathan Shively-Sanders fa1884ed1b Fix crash in expando assignment to alias (#34566)
* Fix crash in expando assignment to alias

This PR disallows expando assignments

Fixes #34493, but disallows the prototype assignment nonetheless.

* Revert mistaken changes
2019-10-18 13:31:44 -07:00
Nathan Shively-Sanders 1d5add528d Emit computed property temps even w/o init w/useDefineForClassFields (#34406)
Fixes #33857
2019-10-18 13:23:38 -07:00
Nathan Shively-Sanders 82f927f8dd Fix stack overflow in circular assignment declaration (#34543)
* Fix stack overflow in circular assignment declaration

It also needs to have multiple assignments so that it has a ValueModule
flag.

Fixes #33006

* remove errant comment

* Remove other possible circularity

* Restore fallback with additional condition
2019-10-18 09:01:21 -07:00
Tim Suchanek 9ff9c41a9a Add completion test for partial generic object (#34559) 2019-10-18 08:59:49 -07:00
Daniel Rosenwasser d2fab65df6 Added test. 2019-10-17 17:04:45 -07:00
Andrew Branch 454a3a0b0f Fix auto-imports from auto type acquisition definitions (#33766)
* Fix auto-imports from ATA typings

* Compare canonical filenames in isImportablePath
2019-10-17 13:59:09 -07:00
Nathan Shively-Sanders f5dbcb78af Resolve more jsdoc value references as types (#34515)
* Resolve more jsdoc value references as types

* add test
2019-10-17 11:21:34 -07:00
Andrew Branch f41b7b59ce Fix quick info for methods whose contextual type is a mapped type property (#33930) 2019-10-17 10:54:01 -07:00
Andrew Branch a95a25b9a7 Fix completions of optional properties in generic positions (#33937)
* fixes #30507

* Add test case for generic Partial type

* Fixes #28470

* Simplify contextFlags binary check

* Add string literal completion test

* Fix ContextFlags typings

* Speed up inference expression for completion

* Fix baseline merge

* Make contextFlags internal

* Reapply readonly array changes

* accept baselines

* Fix generic completion tests

* Re-merge ContextFlags

* Don’t change type during inference

* Fix typos and superfluous undefined arguments

* Add test for completions in unconstrained generic object literal
2019-10-17 10:45:40 -07:00
Klaus Meinhardt 45d0ef9441 factory: parenthesize for-of expression when necessary (#34229)
Fixes: #33856
2019-10-17 10:17:33 -07:00
Orta 5d20c573a6 Merge pull request #34524 from orta/fix_32675
Does not add a duplicate completion when offering an export which was re-declared as a global
2019-10-17 13:08:32 -04:00
Orta Therox 85010fa6fe Make sure that global module re-exports are short-cutted to be added to completions 2019-10-17 12:33:01 -04:00
Nathan Shively-Sanders f3a234caac Dedupe inherited jsdoc comments (#34522)
JSDoc on own properties was already deduped, but inherited jsdoc was
incorrectly not deduped.

Fixes #32708
2019-10-16 15:56:01 -07:00
Orta Therox c40ddb183e Does not add a duplicate completion when offering an export which was re-declared as a global - fixes #32675 2019-10-16 17:02:35 -04:00
Klaus Meinhardt 178417f431 factory: correctly parenthesize conditional head (#34227)
Fixes: #34109
2019-10-16 10:41:52 -07:00
Nathan Shively-Sanders 29f9493d87 Fix crash when exporting+aliasing globalThis inside declare global (#34408)
* global module:Fix crash when exporting+aliasing globalThis

* Fix another globalThis crash

find-all-refs assumed that an export inside a `declare x` was always an
ambient module, but it is not -- `declare global` does not allow
`export`, so find-all-refs shouldn't return any refs for this error case.
2019-10-15 14:05:39 -07:00
Anders Hejlsberg a685ac426c Merge pull request #34212 from microsoft/fix34021
Fix control flow analysis for --noFallthroughCasesInSwitch
2019-10-15 12:10:53 -07:00
Andrew Branch e146f0d13d Allow inferFromUsage to do auto-imports (#33915)
* Add test

* Auto-import instead of using ImportTypeNodes

* Write more tests and fix namespace case

* Remove unused enum memmber

* Update API baselines

* Lint

* Style nits and util consolidation
2019-10-14 10:33:00 -07:00
Anders Hejlsberg cc817bc63e Add tests 2019-10-13 09:45:56 -07:00
Sheetal Nandi 57d7edb7bd Merge pull request #33883 from microsoft/revert-32887-incrementalNoEmit
Revert "Disallow incremental with noEmit"
2019-10-10 13:08:35 -07:00
Wesley Wigham 114329ade8 Handle when import alias has to parent (therefore is synthetic module symbol) (#33813) 2019-10-10 04:29:33 -07:00
Andrew Casey 87c905f423 Handle string literals in merge conflict regions
Check for undefined, like the other code paths in the same function.
2019-10-09 14:46:19 -07:00
Anders Hejlsberg 6104f746ad Merge pull request #33831 from microsoft/falseAssertions
Code following truthiness assertion with false argument is unreachable
2019-10-09 13:23:05 -07:00
Klaus Meinhardt e48cd3a101 Fix noImplicitAny check on ambient private getters (#33896) 2019-10-09 10:05:26 -07:00
Sheetal Nandi 8032984de2 Revert "Disallow incremental with noEmit" 2019-10-08 13:41:40 -07:00
Wenlu Wang 3d8252c70e avoid space before dot question (#33840) 2019-10-07 17:11:54 -07:00
Anders Hejlsberg e0bd810176 Update tests 2019-10-05 18:58:51 -07:00
Anders Hejlsberg eeaa752833 Add tests 2019-10-05 18:33:00 -07:00
Anders Hejlsberg afe6f4c95c Merge pull request #33821 from microsoft/fix33806
Reflect control flow effects of optional chains in equality checks
2019-10-05 17:48:53 -07:00
Anders Hejlsberg f88518187b Add tests 2019-10-05 13:08:31 -07:00
Anders Hejlsberg 42500d0606 Add tests 2019-10-04 16:12:44 -07:00
Anders Hejlsberg 2447bd775f Update tests 2019-10-04 16:01:09 -07:00
Ron Buckton a47ac63738 Fix for incorrect 'this' type for optional call (#33799) 2019-10-04 13:39:42 -07:00
Andrew Branch e2b4c12596 Detect unbindable exports before setting CommonJS module indicator (#33784)
* Detect unbindable exports before setting CommonJS module indicator

* Fix comment

* Fix unrelated lint?
2019-10-04 11:52:38 -05:00
Ron Buckton c774762723 Fix crash in transformations (#33768) 2019-10-02 16:13:32 -07:00
Daniel Rosenwasser a3a55cab2c Improve error message when reserved word is used as identifier (#33702)
Improve error message when reserved word is used as identifier
2019-10-01 16:20:28 -04:00
Wesley Wigham 410ff90c54 Fix the third crash in the chrome user suite test by remembering to pass excludeThisKeyword (#33711) 2019-10-01 13:14:23 -07:00
Sergey Tychinin ab879939df Improve error message when reserved word is used as identifier
Signed-off-by: Sergey Tychinin <stychinin@bloomberg.net>
2019-10-01 10:48:17 -04:00
Andrew Branch 7be7cba050 Fixes binding well known symbol assignment via element access (#33687)
* Fix binding well-known symbols by element access

* Add navigationBar test

* Revert settings.json change

* Accept baselines

* Actually make it bind

* Accept API baselines

* Dont use internal name in API
2019-09-30 16:14:07 -07:00
Wenlu Wang 7c50bccec2 nullish coalescing commit (#32883)
* migrate nullish coalescing commit

* add more test case

* add branch type check test

* add more tests

* fix nullish precedence

* update public api

* add rescan question question token to fix regression

* update public api baseline

* Added tests that emit for nullish coalescing operator conforming with grammar restrictions when assertions are used.

* Fixed emit to hoist temporary variables (they previously went undeclared).
Added tests to ensure calls and property accesses are only called once.

* use not equal to null

* rename factory

* add grammar check

* fix more cases

* Fix handling of nullish coalescing oprator in expando objects.

* Fixed classifier to support ?? operator.

* update baseline

* accept baseline

* fix review

* update emitter and more testcase

* update control flow

* make linter happy

* update libs

* avoid unnecessary assert

* fix typooo

* Fixes for control-flow analysis
2019-09-30 15:33:50 -07:00
Wesley Wigham 9a7fdade07 Fix crash in contextual typing of defaulted element access declarations (#33686) 2019-09-30 14:42:55 -07:00
Wesley Wigham 98cf317005 Add error message for set accessor vsibility issues (#33683) 2019-09-30 13:12:40 -07:00
Andrew Branch f89de95955 Allow special element access assignments to create declarations (#33537)
* Start enabling element access special assignment

* Treat element access assignment as special assignment in JS

* Make declarations for bindable element access expressions

* Fix navigationBar crash

* Add multi-level test for JS

* Propagate element access expressions to more code paths

* Fix property access on `this`

* Add quick info test

* Uhhh I guess this is fine

* Fix module["exports"] and property access chained off element access

* Add test for this property assignment

* Add test for and fix prototype property assignment

* Fix teeeest???

* Update APIs

* Fix element access declarations on `this`

* Fix go-to-definition

* Add declaration emit to tests

* Reconcile with late-bound symbol element access assignment

* Fix baselines

* Add JS declaration back to tests

* Fix JS declaration emit of non-late-bound string literal property names

* Revert accidental auto-format

* Use `isAccessExpression`

* Add underscore escaping member to test

* Fix and test navBar changes
2019-09-30 15:08:44 -05:00
Ron Buckton fcd9334f57 Add support for Optional Chaining (#33294)
* Add support for Optional Chaining

* Add grammar error for invalid tagged template, more tests

* Prototype

* PR feedback

* Add errors for invalid assignments and a trailing '?.'

* Add additional signature help test, fix lint warnings

* Fix to insert text for completions

* Add initial control-flow analysis for optional chains

* PR Feedback and more tests

* Update to control flow

* Remove mangled smart quotes in comments

* Fix lint, PR feedback

* Updates to control flow

* Switch to FlowCondition for CFA of optional chains

* Fix ?. insertion for completions on type variables

* Accept API baseline change

* Clean up types

* improve control-flow debug output

* Revert Debug.formatControlFlowGraph helper
2019-09-30 12:33:28 -07:00
Anders Hejlsberg 7ce793c5b8 Merge pull request #33678 from microsoft/fix33617
Property handle recursive type references in type inference
2019-09-30 11:15:27 -07:00
Wesley Wigham 7f3c03d441 Implement declaration emit for accessors in the js declaration emitter (#33649)
* Implement declaration emit for accessors in the js declaration emitter

* Use `or`
2019-09-30 11:09:35 -07:00
Anders Hejlsberg ff5d38a94b Merge pull request #33622 from microsoft/fix33580
Error when assertion function calls aren't CFA'd
2019-09-30 10:57:26 -07:00