Commit Graph

10223 Commits

Author SHA1 Message Date
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
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
Nathan Shively-Sanders
d841971347 Merge pull request #38358 from a-tarasyuk/bug/38081
fix(38081): 'Debug Failure. Invalid cast.' for convert import quick fix
2020-06-09 08:50:56 -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
Eli Barzilay
a4c14a2cdc getSymbolDisplayPartsDocumentationAndSymbolKind: use actual symbol.flags for getAliasedSymbol
Fixes #35347.
2020-06-04 13:50:33 -04:00
Jesse Trinity
3b15b35b37 Merge pull request #38378 from jessetrinity/refactorTriggerReason
Add RefactorTriggerReason
2020-06-03 11:18:08 -07:00
Eli Barzilay
073fb308bf Fix two tests
* `docCommentTemplateInSingleLineComment`: Accidentally dropped space, fixes #38651

* `codeFixCorrectReturnValue13`: Bogus test code copied
2020-06-03 12:59:16 -04:00
Jesse Trinity
d88ea4e1f8 address PR comments 2020-06-02 19:06:12 -07:00
Jesse Trinity
463f8e10b9 Merge pull request #38734 from a-tarasyuk/bug/34934
fix(34934): Completions for private members appear in JavaScript files
2020-06-02 12:47:17 -07:00
Alexander T
bc502c8c3c fix(38081): allow transforming object binding to named imports 2020-06-02 11:23:56 +03: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
Alexander T
4f0b81d415 fix(32341): add prefix name for module exports properties (#38541) 2020-06-01 11:45:05 -07:00
Alexander T
fa49ac0b78 fix(19385): add space after brace in the multiline string template (#38742) 2020-06-01 10:30:52 -07:00
Alexander T
68d2ee055c fix(38815): dive in arrow functions to check only this usage instead of checking all statements (#38865) 2020-06-01 10:27:11 -07:00
Jesse Trinity
a86a2fa703 polish tests 2020-05-29 13:03:14 -07:00
Jesse Trinity
2db0054444 remove outdated tests 2020-05-29 13:03:11 -07:00
Jesse Trinity
f479279217 convert import trigger reason test 2020-05-29 13:03:08 -07:00
Jesse Trinity
c20908a3e7 convert export trigger reason test 2020-05-29 13:03:01 -07:00
Jesse Trinity
4971c7d546 remove declaration 2020-05-29 13:02:55 -07:00
Jesse Trinity
3e1e61470b Revert "update refactorConvertImport_partialSelection"
This reverts commit e28d8a0895f118321c37016a6dad4751a7c13673.
2020-05-29 13:02:52 -07:00
Jesse Trinity
86122c412f convert get set test 2020-05-29 12:55:52 -07:00
Jesse Trinity
673a86833a update test names 2020-05-29 12:55:48 -07:00
Jesse Trinity
3825d193f6 extract symbol test 2020-05-29 12:55:43 -07:00
Jesse Trinity
df8ff659c5 extract type test 2020-05-29 12:55:39 -07:00
Jesse Trinity
85e0d8b14a add refactorNotAvailableForTriggerReason 2020-05-29 12:55:35 -07:00
Jesse Trinity
dc363f10fc fix some indices 2020-05-29 12:55:32 -07:00
Jesse Trinity
fbf6737ae2 use verify trigger reason for import export 2020-05-29 12:55:28 -07:00
Jesse Trinity
96f210c1c8 arrow function refactor test 2020-05-29 12:55:24 -07:00
Jesse Trinity
f3751fbdf3 change type of RefactorTriggerReason 2020-05-29 12:54:59 -07:00
Jesse Trinity
665e434832 convert import tests 2020-05-29 12:50:18 -07:00
Jesse Trinity
57e856b0b4 convert export tests 2020-05-29 12:50:14 -07:00
Jesse Trinity
c5343f1d4e update refactorConvertImport_partialSelection 2020-05-29 12:46:03 -07:00
Daniel Rosenwasser
6128f30c3b Merge pull request #38821 from a-tarasyuk/bug/23716
fix(23716): signature help of tagged template doesn't show instantiated signature
2020-05-28 17:19:23 -07:00
BigAru
e6dc8f6c69 Merge remote-tracking branch 'upstream/master' into m-lambda-to-fn 2020-05-27 20:33:27 +02: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