Commit graph

14996 commits

Author SHA1 Message Date
Sheetal Nandi 0232d4ae8e
Fixes issues with reload because of output emit (#39030)
* If there is no changes to folder structure when watching directories recursively, send the updates to fileNames only
Fixes #37994

* Ignore excluded directories from wild card watching

* Testcase showing that renaming file with non sync directory watcher displays correct error in the end
Testcase for #38684
2020-06-16 16:39:48 -07:00
Andrew Branch 540c219980
Make debug mode work with new VS Code JS debugger (#39098) 2020-06-16 16:06:13 -07:00
Wenlu Wang 6c11ceb8db
Assignment operator is definite assignment (#39087)
Co-authored-by: Orta Therox <orta.therox@gmail.com>
2020-06-16 16:44:01 -04:00
Sheetal Nandi 25f6232d45
Syntax only server creates inferred project with all the open files w… (#38561)
* Syntax only server creates inferred project with all the open files with noResolve and can handle semantic operations

* No Watching

* Disable tests

* Add and fix tests

* Only support selected commands

* Revert "Disable tests"

This reverts commit 90d8a966eb.

* Dont log request details for unsupported commands
2020-06-16 13:39:20 -07:00
Wesley Wigham 4bda7ce8e5
Include reexported names in list of exported names (#38809) 2020-06-15 15:17:08 -07:00
Wesley Wigham 6a777ff6b3
Fix crash when serializing the return type of a generic call to Array.prototype.flat (#38904)
* Add declaration emit error and checking for circularly referential unions produced by recursive conditionals

* Allow indexed accesses to produce alias symbols on types

* Add test that still triggers the declaration emit error

* Fix spelling
2020-06-15 11:46:10 -07:00
Eli Barzilay 0432954f2d Small fix in getIsContextSensitiveAssignmentOrContextType
Test that `parentSymbol.valueDeclaration` exists.

Fixes #38532
2020-06-13 07:10:04 -04:00
Eli Barzilay 8231519b85 Simplify visitObjectLiteralExpression
I ran into it and the comment at the top tripped me, then I proceeded to
simplify the code.  Patched a bit more of the function to make sure that
the indentation doesn't change, and added tests.
2020-06-13 07:05:21 -04:00
Eli Barzilay f447838f95 Fix handling of aruments in the emitter
Two problems are fixed:

* `isArgumentsLocalBinding` did only `PropertyAccessExpression`, now
  it's also doing `PropertyAssignment` (doesn't affect other files,
  since it's only used in the emitter).

* `visitShorthandPropertyAssignment` should call `visitIdentifier` on
  the synthesized id.  (For completion it might be better to make it
  visit the the original?)

Fixes #38594.
2020-06-13 07:05:21 -04:00
Andrew Branch b63ea4b6df
Fix declaration emit for property references of imported object literal types (#39055)
* Fix declaration emit for property references of imported object literal types

* Add declaration file to test
2020-06-12 17:48:19 -07:00
Sheetal Nandi f628bf8e24
Fix casing for wild card keys for implicit globs to get wild card directories to watch (#39049)
* Test showing how wild card directory is not watched because of mismatch in key case

* Fix casing for wild card keys for implicit globs
Fixes #36532
2020-06-12 14:21:51 -07:00
Nathan Shively-Sanders a26e60eb2c skip implements types with no symbols 2020-06-11 16:34:32 -07:00
Nathan Shively-Sanders 9f872c01e1 Merge branch 'master' into fix-implements-tag-emit 2020-06-11 16:05:21 -07:00
Nathan Shively-Sanders a64166de14 isDynamicName skips parentheses for element access
Neither `x[0]` nor `x[(0)]` should be dynamic names. Previously, the
latter was because `isDynamicName` didn't skip parentheses.

Since the binder treats dynamic names in property assignments as
assignment declarations, this incorrectly tried to create a binding for
expressions like `x[(0)] = 1`.

This caused an assert because `x[(0)]` would not take the dynamic name
code path during binding (`hasDynamicName` returned false), but the
normal code path for static names.
2020-06-11 09:08:51 -07:00
Eli Barzilay ffa35d3272 Allow e: unknown in catch arguments
In addition, allow an explicit `any`; anything else throws an error.

Also adjust and reorganize existing tests.

Fixes #36775.
2020-06-10 18:24:20 -04:00
Wesley Wigham 08cb0b23e8
Serialize (noncontextual) keyword named namespace members with export declarations in both declaration emitters (#38982)
* fix(38750): create unique names for keywords and re-export them with original names

* Serialize (noncontextual) keyword named namespace members with export declarations in both declaration emitters

* Add exhaustive keyword emit test for js declaration emitter and fix it up

Co-authored-by: Alexander T <alexander.tarasyuk@outlook.com>
2020-06-10 14:42:49 -07:00
Wesley Wigham 2287dbc7e2
Handle missing return type nodes and nested type references missing type arguments in existing jsdoc node serialization (#39011)
* Handle missing return type nodes and nested type references missing type arguments in existing jsdoc node serialization

* Accept updated baselines
2020-06-10 12:42:38 -07:00
Andrew Branch 852e7a0b60
Add containerName to CallHierarchyItem (#38997)
* Add containerName to CallHierarchyItem

* Update public APIs

* Update test to demonstrate nested namespace working
2020-06-10 11:56:03 -07:00
Andrew Branch 0d6ae004d7
Fix isSameEntityName (#38999)
* Fix isSameEntityName

* Add baseline

* Fix baseline
2020-06-10 10:53:02 -07:00
Daniel Rosenwasser e832e04fa7
Merge pull request #37727 from Kingwl/logical_assignment
Add logical assignment operator
2020-06-09 14:44:08 -07:00
Wesley Wigham f41398e100
Make isEntityNameVisible duplicate the node builder logic to always consider type parameters as visible if they are the resolution result (#38921) 2020-06-09 13:40:17 -07:00
Sheetal Nandi a72ed0a2f5
Schedule failed lookup updates (#38560)
* Schedule failed lookup updates

* Tests
2020-06-09 12:00:37 -07:00
Sheetal Nandi 83f41deff2
Remove non null assertion on oldSourceFile.resolvedModules (#38984)
Fixes #37938
2020-06-09 11:52:39 -07:00
Eli Barzilay 3151e2a365 Make hasCorrectArity handle tuples properly
This completes the work that started in PR #33069, and fixes #32835.

There are probably two additional related changes that are needed to
make this more complete:

* Fix the code that composes the error message (see the first two
  `FIXME`s in `callWithSpread3.ts`).

* Fix the code that checks the argument types (second two `FIXME`s).

* There is also an error in `genericRestParameters1.ts` which changed
  but should not be an error in the first place.  Added a `FIXME` there
  too.  (Probably will work if the previous iterm is done.)

In addition, `getEffectiveCallArguments` munges the arguments in case of
a spread in the last argument which might be better to avoid.  (I think
that there are cases where it wouldn't work anyway, such as a spread of
an array followed by a spread of an empty array.)
2020-06-04 23:46:56 -04:00
rchaser53 261386d48b fix error when use spread arguments twice 2020-06-04 23:46:56 -04:00
Eli Barzilay 4ee013d1a7 Fix merging of JS value & TS type decl
Fixes #38383
2020-06-04 19:28:33 -04:00
Sheetal Nandi 9fbcb99a33
Emit build info even on noEmitOnError or tsc --build (#38853)
* Emit buildinfo when there are errors with noEmitOnError?
TODO: --build mode

* Always emit tsbuild info even if there are non syntax errors in tsc --build mode

* Sort affectedFilesPendingEmit for consistent build info text
2020-06-02 12:38:40 -07:00
Sheetal Nandi f0da6d1203
Some changes to tsc baselines for clarity (#38850)
* Baseline programs in tsc -b and tsc -incremental mode as well

* Refactor outFile

* Tests

* Distinct input and output

* Add helper to baseline serialized invocations of tsc on incremental edits

* Input and output in watch mode

* Update src/testRunner/unittests/tsbuild/helpers.ts

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
2020-06-02 11:49:21 -07:00
Jesse Trinity 1d1c1673bf
add support to convert lambda to function and vice-versa (#28250)
* add skeleton

* add getAvailableActions

* add working getEditsForAction

* add multi vardecl

* fix multi decl bug

* change refactor name

* add tests for ToAnon, ToArrow and available arrow

* add tests for ToNamed and available anon

* add tests for ReturnType and available Arrow as FnParam

* fix bug modifiers by toNamed

* add tests for modifiers

* fix for tslint error

* adapt one test case

* refactor getInfo getAvailableActions

* refactor small progress

* extract creation of block

* extract creation of funcDeclaration

* make guideline compliant

* apply feedback from pr

* add testcase and apply feedback from pr

* apply feedback from pr

* add newline

* rename testcases

* Make conditions more expressive

* fix for unnecessary duplication of comment

* apply feedback from pr

* update getAvailableActions

* check if functionExpression name is used

* add more testcases

* do not provide refactoring when it contains this
because this behaves differently in arrow than in function

* exclude nested functions and classes at containingThis check

* fix linting error

* fix line endings

Co-authored-by: BigAru <arooran@indikon.ch>
Co-authored-by: bigaru <bigaru@users.noreply.github.com>
Co-authored-by: Jesse Trinity <42591254+jessetrinity@users.noreply.github.com>
Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>
2020-06-01 15:26:45 -07:00
Wesley Wigham b36b803cdd
Skip default when initially iterating exports in __importStar, same as __exportStar (#38808)
* Skip default when iterating exports in __importStar, same as __exportStar

* Accept baselines
2020-06-01 14:52:24 -07:00
Jesse Trinity fb3a84c4f1 fix line endings 2020-06-01 14:15:02 -07:00
Jesse Trinity 52dad733db
Merge branch 'master' into m-lambda-to-fn 2020-06-01 13:53:19 -07:00
Jack Works 8e290e5aae
Improve error range for ts2657 (jsx expr must have parent element), add code fix for it (#37917)
* fix: range of ts2657 (jsx expr must have parent) and remove 2695 (LHS expr of comma has no side effects)

* feat: add code fix for 2657

* fix: resolve review

* chore: hoist a var

* chore: add test for skipTrivia

* fix: rebase error

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* Update src/services/codefixes/wrapJsxInFragment.ts

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

Co-authored-by: Andrew Branch <andrew@wheream.io>
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-06-01 12:22:44 -07:00
BigAru e6dc8f6c69 Merge remote-tracking branch 'upstream/master' into m-lambda-to-fn 2020-05-27 20:33:27 +02:00
Daniel Rosenwasser f2d6eda60e
Merge pull request #38049 from JoshuaKGoldberg/literal-to-primitive-relation-reporting
Report primitive type in literal-to-primitive relation complaints
2020-05-26 13:18:14 -07:00
Alexander T 6214bd29f3
fix(38722): change error message for use-before-declaration on const enum (#38728) 2020-05-26 11:53:18 -07:00
Nathan Shively-Sanders bfa1744586
Merge pull request #37894 from microsoft/always-error-on-property-override-accessor
Always error on property override accessor
2020-05-26 10:37:07 -07:00
Anders Hejlsberg c5b8f4fcd4
Fix relation between generic mapped types and types with index signatures (#38761)
* Fix relation between generic mapped type and type with index signature(s)

* Add tests
2020-05-25 09:55:41 -07:00
Nathan Shively-Sanders 82d9576d9b Merge branch 'master' into always-error-on-property-override-accessor 2020-05-22 07:41:28 -07:00
Daniel d3d282cb45 Less code 2020-05-22 01:49:26 +00:00
Daniel afe90f1314 Feed generalized source type to elaboration. 2020-05-22 01:02:27 +00:00
Daniel a04ecb592c Check constraints deeply on singleton types. 2020-05-22 00:40:28 +00:00
Daniel 8cf2466110 Merge remote-tracking branch 'origin/master' into literal-to-primitive-relation-reporting 2020-05-22 00:09:52 +00:00
Nathan Shively-Sanders 79f1ec32bd Revert "Wrap classes with decorators or static properties in an IIFE, even for ES2015+ (#32011)"
This reverts commit 7cc4a8df94.
2020-05-21 16:23:04 -07:00
Nathan Shively-Sanders 802e87b1eb Merge branch 'master' into always-error-on-property-override-accessor 2020-05-21 16:08:09 -07:00
Wesley Wigham 0018b8f988
Preserve module marker in es2015+ module emit for tool compatability (#38712) 2020-05-21 14:44:23 -07:00
Nathan Shively-Sanders 38715c7b48 remove errant tab 2020-05-21 09:26:42 -07:00
Nathan Shively-Sanders 66f48e303f Switch to isSymbolAccessible for both.
1. Switch to isSymbolAccessible for both types and values, then unify to
a single function.
2. Remove inaccesible base error. We can put it back after making
@implements type reference lookup looser (which may or may not happen).
2020-05-21 09:20:56 -07:00
Nathan Shively-Sanders 9b4a83e8df Merge branch 'master' into fix-implements-tag-emit 2020-05-21 08:21:16 -07:00
kingwl 2997860c2e fix names 2020-05-21 10:23:00 +08:00