Commit graph

23884 commits

Author SHA1 Message Date
Gerrit Birkeland e263fcebf8
Expose getTypePredicateOfSignature (#44863) 2021-08-16 17:17:42 -07:00
Oleksandr T 55ed742574
fix(45294): show parameter inlay hints for template strings (#45305) 2021-08-16 14:11:02 -07:00
Ryan Cavanaugh e00b5ecd40
Enable max-statements-per-line lint rule (#45475)
* Enable the rule

* Fix all the violations
2021-08-16 13:53:51 -07:00
csigs d50c91da17
LEGO: Merge pull request 45456
LEGO: Merge pull request 45456
2021-08-14 10:13:55 -07:00
csigs 3c957efd4a
LEGO: Merge pull request 45453
LEGO: Merge pull request 45453
2021-08-14 04:24:59 -07:00
Oleksandr T 5b3072f687
fix(45233): allow type assertion in ExportAssignment with JSDoc type definition (#45342) 2021-08-13 16:32:23 -07:00
Oleksandr T dfd84ec0b2
fix(45417): show inlay hints for null and literal-like identifiers (#45426) 2021-08-13 11:31:47 -07:00
csigs fe7962af3d
LEGO: Merge pull request 45444
LEGO: Merge pull request 45444
2021-08-13 10:13:50 -07:00
csigs 6cdbf98a6f
LEGO: Merge pull request 45442
LEGO: Merge pull request 45442
2021-08-13 04:13:56 -07:00
Jm 7139f37201
fix: nodeWillIndentChild judge for BinaryExpression with JsxElement child (#44695) 2021-08-12 14:01:52 -07:00
Nathan Shively-Sanders 8d4fe5a0fb
Fix unassignable properties by adding undefined with exactOptionalPropertyTypes (#45032)
* Simple first version

Doesn't cover or test any complicated variations.

* Lots of cases work

Destructuring does not. But

- skipping node_modules and lib.* does.
- call expressions does
- property access, including with private identifiers, does

* Support variable declarations, property assignments, destructuring

As long as it's not nested

* More cleanup

* skip all d.ts, not just node_modules/lib

* Offer a codefix for a lot more cases

* remove incorrect tuple check

* Use getSymbolId instead of converting to string

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

* add test + switch to tracking number symbol ids

* Address PR comments

* Exclude tuples from suggestion

* Better way to get error node

Plus add a check that errorNode is an argument to the call, not the
call's expression.

* fix semicolon lint

* fix another crash

* Simplify: add undefined to all optional propertie

whether or not somebody tried to assign undefined to them in the
erroneous assignment

* remove fix-all

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2021-08-10 16:57:38 -07:00
Nathan Shively-Sanders 92e7fb521f
Update tsc-instrumented for project build (#45383)
* Update tsc-instrumented for project build

loggedIO has a weird build that never got updated for the project build
system. This PR just adds a project for it in a straightforward way. It
might be less efficient than the old way, but that's not a big concern
for recording RWC test cases.

However, I may have done things wrong. If anybody knows
tsc-instrumented, please comment.

* Create a second loggedIO tsconfig for tsc-instrumented

The normal tsconfig should not have `prepend`; the standalone one for
tsc-instrumented should.

* fix semicolon lint
2021-08-10 14:53:17 -07:00
Oleksandr T 6c42d7949b
fix(45393): show parameter name hints for unary literal expressions (#45399) 2021-08-10 11:51:00 -07:00
Oleksandr T ad894f74b3
fix(45345): throw an error on overridden member that is defined in multiple interfaces (#45352) 2021-08-10 11:50:22 -07:00
Wesley Wigham 68eb1a551f
Use getFileAndProject in session provideInlayHints to ensure language service updates are applied (#45394) 2021-08-10 11:48:35 -07:00
Ron Buckton d8e830d132
Fix __spreadArray for non-concat-spreadables (#45386) 2021-08-09 17:08:07 -07:00
Ikko Ashimine 5e496d52e1
Fix typo in helpers.ts (#45365)
funtions
2021-08-09 08:40:54 -07:00
csigs 75cb8b2393
LEGO: Merge pull request 45375
LEGO: Merge pull request 45375
2021-08-08 22:13:50 -07:00
csigs 5c66c12124
LEGO: Merge pull request 45374
LEGO: Merge pull request 45374
2021-08-08 16:13:45 -07:00
csigs cf74363397
LEGO: Merge pull request 45368
LEGO: Merge pull request 45368
2021-08-08 10:13:44 -07:00
csigs 99622fc2ef
LEGO: Merge pull request 45362
LEGO: Merge pull request 45362
2021-08-08 04:14:17 -07:00
csigs c9788712a7
LEGO: Merge pull request 45359
LEGO: Merge pull request 45359
2021-08-07 22:13:31 -07:00
csigs 9960edef51
LEGO: Merge pull request 45357
LEGO: Merge pull request 45357
2021-08-07 16:13:42 -07:00
csigs ce9366d6f7
LEGO: Merge pull request 45356
LEGO: Merge pull request 45356
2021-08-07 10:13:41 -07:00
csigs bea0ee8c59
LEGO: Merge pull request 45351
LEGO: Merge pull request 45351
2021-08-06 22:14:03 -07:00
Daniel Rosenwasser 66980fc8dc Bump version to 4.5. 2021-08-06 23:28:17 +00:00
Andrew Casey 792e6d652a
Fix symbol display exception when handling incomplete class (#44936)
When a class declaration lacks a name, don't throw an exception when
producing the display parts (e.g. for QuickInfo).

Remaining issues:
 1. The name shows as "__missing", the name of the underlying symbol,
    rather than "(Missing)", as it is for the corresponding function
    declaration case (because the parse constructs a missing identifier
    node for the function declaration).
 2. "(Missing)" is hard-coded, rather than being a localizable resource
    string.
 3. When an anonymous class declaration is a default export, the
    corresponding symbol is named "default", resulting in the confusing
    display string "class default".

Since display parts are built using existing `symbolToString`
functionality, it wasn't clear whether detecting special symbol names
and replacing them with user-friendly strings could be done without
breaking other functionality.

Similarly, changing the shape of the parse tree seemed riskier than the
problem justified (the user experience is just not getting QuickInfo for
the incomplete declaration, which seems acceptable).
2021-08-06 15:05:54 -07:00
Henrique Inonhe 7753efae79
Improve error message TS1210 (#44892) 2021-08-06 15:00:26 -07:00
Oleksandr T cce2e926de
feat(45163): add QF to declare missing jsx attributes (#45179) 2021-08-06 12:38:22 -07:00
csigs abfe5f0be7
LEGO: Merge pull request 45346
LEGO: Merge pull request 45346
2021-08-06 10:13:49 -07:00
Anders Hejlsberg 409be37bf5
Fix index signature assignability from optional properties in --exactOptionalPropertyTypes mode (#45185)
* Explicit undefined not assignable to non-undefined index signature in exactOptionalPropertyTypes mode

* Add tests
2021-08-06 08:54:00 +02:00
Anders Hejlsberg 3bd5079f1c
Fix check for generic types in control flow analysis (#45148)
* Fix check in hasNonBindingPatternContextualTypeWithNoGenericTypes

* Add regression tests

* Accept new baselines

* Compute both ObjectFlags.IsGenericXXXType flags in one go
2021-08-06 08:53:30 +02:00
Ron Buckton 4fc4c18299
Fix completions in return when in function with contextual 'this' (#45340) 2021-08-05 22:40:20 -07:00
Matt Bierner c0796c1dfb
Enable events on web server (#45313)
Fixes #45293
2021-08-05 16:10:01 -07:00
Orta Therox 1f85123821
Revisions for the new --help (#44800)
* WIP on refining the new --help

* Fix types in the boolean trivial lint rule

* Update baselines

* More work

* Updates the color logic

* Simplifies the CLI color code

* Use cyan instead of blue for win powershell/command prompt

* Use bright white when blue is probably going to look off

* Fix NO_COLOR

* Adds a test to cover NO_COLOR

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update compiler diagnostic text

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-08-05 16:41:01 +01:00
Eli Barzilay 635f5bdf8c Some tweaks for backtick strings
1. `getRawLiteral()`: barf if `currentSourceFile` is missing, since if
   it is, then the following `getSourceTextOfNodeFromSourceFile` will
   return a bogus `""`.

2. One `||` -> `??` change.

3. `backtickQuoteEscapedCharsRegExp`: escape the usual control
   characters except for a simple LF.  This code does get used to
   generate backtick strings when `rawText` is not given, and not
   escaping things like TAB characters can get mangled by editor
   settings.  Worse, not escaping a CRLF and putting it verbatim in sthe
   string source will interpret it as LF, so add a special case for
   escaping these as `\r\n`.
   Added test.

Related to #44313 and #40625.
2021-08-05 05:45:34 -04:00
Orta Therox b9e952be1d
Migrate over 4.4 lib dom and webworker (#45324)
* Brings across 4.4 DOM + Web Worker changes

* Adds tests

* Incorporate #1092 and #1093 from TypeScript-DOM-lib-generator

* update baselines

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-08-04 17:14:24 -07:00
Andrew Branch f80bc3f5f0
Store symbol table map key in CachedSymbolExportInfo (#45289)
* Store symbol table map key in CachedSymbolExportInfo

* Remove debug assertion

* Filter out known symbols (again) and private identifiers
2021-08-04 16:31:47 -07:00
Eli Barzilay 2bae169306 convertStringOrTemplateLiteral.ts: Re-fix escapeStringForTemplate
Make it backslash-escape backticks too.  While I was there, remove the
use of this function for the text (which was the earlier confused
version that used only `text`), and rename it as
`escapeRawStringForTemplate` to clarify.

Added a test to the preivious pile of tests.

Fixes #45278.
2021-08-04 18:37:31 -04:00
David Sherret 03dff41c9f
Fix getting completion details for meta properties (#45031)
* Fix getting completion details for meta properties.

* Move inside the worker.

* Move ImportMeta handling to completions.ts

* Fix property type name for new.target.

* Use symbols for ImportMeta completions.

* Accept baselines.

* Revert lib change.

* Revert needless parser change.

* Missed these reverts.

* Remove now unused `isMetaPropertyExpression`

* Move up meta property keyword check to be done in `getSymbolAtLocation` and `getTypeOfNode`

* Call `checkNewTargetMetaProperty` directly and handle when it's an error type.

* Make meta property expression types synthetic.

* Make event.target and import.meta properties readonly

* Add a test for go to definition (I think?)

* Copy built-in types/values test for go to definition.

* Add tests for go to definition when not a module.

* Fix "go to definition" for new.target
2021-08-04 09:41:04 -07:00
Oleksandr T 318930b9e3
fix(45221): suggest unknown symbols in type positions (#45323) 2021-08-04 09:37:06 -07:00
Nathan Shively-Sanders f1ce0f5528
Visit children of jsdoc type aliases in the binder (#45312)
* Visit children of jsdoc type aliases in the binder

This sets up parent pointers.

Fixes #45254 and almost certainly #45248, though I haven't figured out
to repro the second case.

* move incorrect parenthesis

* manually set comment parent instead

* Bind children of typedef where possible

* add explanatory comment to binding
2021-08-04 07:05:11 -07:00
Jean Pierre 1cbb0bd4d3
Do not classify Infinity and NaN (#44778)
* Do not classify Infinity and NaN. Fixes #42022

* Internally expose so that the classifier can use it

* Increase the test complexity, and revert the type-checker

* Drop the -Infinity

Co-authored-by: Orta <git@orta.io>
2021-08-04 10:00:39 +01:00
Oleksandr T 5971b68231
fix(45224): show inlay hints for setter parameter (#45229) 2021-08-03 11:33:26 -07:00
Oleksandr T c4080437b2
fix(45102): do not suggest refactoring for functions contains arguments reference (#45116) 2021-08-03 11:31:56 -07:00
Martin Johns 5a2153a729
Fix position of keyword in "Add 'override' modifier" code fix (#45274)
fixes #45270
2021-08-03 11:01:30 -07:00
Orta Therox ceef6f7cfd
Dev: Have a clickable link for a new baseline created (#44552)
* Have a clickable link for a new baseline created

* Use joinPath instead:
2021-08-03 16:18:39 +01:00
Oleksandr T 39c653cd83
fix: omit inlay hints for setters (#45228) 2021-08-02 16:27:22 -07:00
Daniel Rosenwasser 975aabe788
Ensure all SortText entries have the same length (#45292)
* Ensure all `SortText` entries have the same length.

* Update Baselines and/or Applied Lint Fixes

* Update the exact same enum to the exact same values in fourslash. 🙄

* Make `SortTextId` a const enum, switch to use an explicit offset in `SortTextId`.

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-08-02 16:27:01 -07:00
csigs f30ba36a2b
LEGO: Merge pull request 45299
LEGO: Merge pull request 45299
2021-08-02 16:13:44 -07:00
Kubilay Kahveci 9cc3070938
expose getImmediateAliasedSymbol() publicly (#44644)
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
2021-08-02 15:57:54 -07:00
Armando Aguirre 642060db6f
Replace non-null assertion with optional chain on assert nodes (#43788) 2021-08-02 15:26:48 -07:00
Oleksandr T c23abc8957
fix(45192): show implement interface QF for re-exported types (#45245) 2021-08-02 15:19:19 -07:00
Andrew Branch bfd5b2f7f0
Fix decorator metadata references to type-only-imported namespaces (#44915)
* Add test

* Fix metadata references to type-only-imported namespaces

* Use `!!` instead of `|| false`
2021-08-02 14:18:15 -07:00
Wesley Wigham 7669bfba15
Actually instantiate the type of the annotation used for contextual types (#45285) 2021-08-02 12:44:56 -07:00
Oleksandr T fcf7bafd57
fix(44812): add outlining spans for comments inside blocks (#44847) 2021-07-30 15:56:32 -07:00
Armando Aguirre 76d754329e
Fix bigInt completions (#45059)
* Fix bigInt completions

* Added regresion test
2021-07-30 14:40:50 -07:00
Andrew Casey bbd9c3a6e6
Use arrow functions to bind globals correctly in web scenarios (#45242)
* Use arrow functions to bind globals correctly in web scenarios

https://github.com/microsoft/vscode/issues/127700#issuecomment-889443607

* Add missing spread operators
2021-07-30 14:22:30 -07:00
Wenlu Wang 8cdcec4454
Avoid provide hints for binding patterns (#44961)
* Avoid provide hints for binding patterns

* Rename as 56
2021-07-30 09:43:20 -07:00
Andrew Casey 0f6e6efde0
Avoid no-op export map updates (#45238)
* Add id and version to ManyToManyPathMap

...so that unchanged maps can be recognized without having to examine
their contents.

* Track cache version on BuilderState

In practice, `updateExportedFilesMapFromCache` is called repeatedly
without the cache changing in between.  When this occurs, there's no
need to update the `BuilderState` (this was already the net effect, but
it took a long time to determine that no work was required).

* Fix typo in comment
2021-07-30 09:27:32 -07:00
tjjfvi 9d957c64c5
Fix getChildCount/At methods in EndOfFileTokens (#44991)
* Fix getChildCount/At methods in EndOfFileTokens

Before, they were hardcoded to return `0` and `undefined!`, respectively, but that is inaccurate for `EndOfFileToken`s with attached jsdoc.

* Add tests for getChild* methods on EndOfFileTokens
2021-07-30 09:03:19 -07:00
Gabriela Araujo Britto db0f7938dd
Allow narrowing for any left-hand in operand (#45152)
* allow narrowing for any left-hand in operand
2021-07-29 14:06:45 -07:00
Gabriela Araujo Britto 366e9de264
Fix compiler crash on property symbols without declarations (#45190)
* don't track computed name if symbol has no declaration

* add compiler test

* add non serializable property declaration emit error

* don't track computed name if symbol has no declaration

* fix small stuff

* rebase: add non serializable property declaration emit error

* use symbolToString instead of symbolName
2021-07-29 12:42:54 -07:00
Andrew Branch 62773051e7
Fix import statement completions for export= in JS files (#45128) 2021-07-29 10:28:47 -07:00
Oleksandr T c79ec7bfbb
fix(45225): do not show add missing member QF for libraries files (#45231) 2021-07-29 10:22:27 -07:00
Eli Barzilay 7e8bba6908 Fix template string refactoring and nodeFactory bug
Instead of letting `createTemplate*` generate a broken raw string from
the cooked one, grab the source code for it.

Also, add a missing bit to `\`-quote `$`s.  As the comment in the code
says, it could just `\`-quote `${` since other `$`s are valid, but I
think that it's less confusing to always quote $s (but the change is in
the comment if minimalism is preferred).

Also, a small-but-confusing bug in `getCookedText()`.

Many tests for all of this.

Fixes #40625
2021-07-29 04:23:06 -04:00
Oleksandr T 7c197becb6
feat(45210): add inlay hints for getters and setters (#45214) 2021-07-28 14:52:37 -07:00
Oleksandr T b81eb6cfe1
fix(45182): allow property access in arrow function (#45193) 2021-07-27 09:46:17 -07:00
Oleksandr T 85e0e5ad07
fix(44837): add graceful recovery for require completions (#45151) 2021-07-26 15:26:43 -07:00
Wenlu Wang 9665bc6199
Supress hints for access expr too (#45121) 2021-07-26 11:59:14 -07:00
Oleksandr T 11c7daef62
fix(45114): throw an error when using '#' as an identifier (#45124) 2021-07-26 11:39:17 -07:00
Oleksandr T ba226167bc
fix(45157): omit error after property declaration without semicolon (#45165) 2021-07-26 09:57:58 -07:00
Andrew Branch 48aecfa5a5
Consider module augmentations in files referenced by imports in watch/incremental (#45156)
* Consider module augmentations in files referenced by importsin watch/incremental

* Accept baselines

* Accept other baseline

* Hooray optional chaining

* Delete outdated and unuseful comment
2021-07-23 16:32:52 -07:00
Andrew Branch f029a8266c
Filter auto imports by symbol flags before resolving module specifiers (#45168)
* Filter auto imports by symbol flags before resolving module specifiers

* Don’t filter types out of import statement completions
2021-07-23 15:56:34 -07:00
Andrew Branch 9c8a90d685
Check cancellation token during exportInfoMap generation (#45138) 2021-07-21 14:17:34 -07:00
Oleksandr T e064817371
feat(42639): allow narrowing type in 'in' operator with the identifier on the left side (#44893) 2021-07-21 09:10:32 -07:00
Andrew Branch 31d98ec44a
Don’t try to create auto import provider when host program doesn’t exist (#45126)
* Guard against creating auto import provider without host program

* Also don’t pre-seed auto import provider if updateGraph didn’t produce a program

* Rename `isFirstLoad`
2021-07-20 11:16:58 -07:00
Ron Buckton 365b25693c
Fix and validate post-increment/decrement in module emit (#44968) 2021-07-19 13:34:42 -07:00
Andrew Branch 476054ea57
Fix auto import crashes caused by unrelocatable symbols (#45055)
* Add failing test

* Fix auto import crashes caused by unrelocatable symbols

* Use util for testing if symbol is an external module
2021-07-19 10:32:47 -07:00
Andrew Branch 36225c3260
Detect preference for Unode:-prefixed node core modules (#45080) 2021-07-19 09:56:24 -07:00
csigs ddbd829ea1
LEGO: Merge pull request 45092
LEGO: Merge pull request 45092
2021-07-18 16:17:56 -07:00
csigs a84ca309e0
LEGO: Merge pull request 45088
LEGO: Merge pull request 45088
2021-07-17 22:14:11 -07:00
csigs 64e19ffc3f
LEGO: Merge pull request 45087
LEGO: Merge pull request 45087
2021-07-17 16:17:42 -07:00
csigs 7ad76171f7
LEGO: Merge pull request 45085
LEGO: Merge pull request 45085
2021-07-17 10:13:32 -07:00
csigs 5e55501ac6
LEGO: Merge pull request 45083
LEGO: Merge pull request 45083
2021-07-16 22:14:50 -07:00
csigs cf8217fc29
LEGO: Merge pull request 45081
LEGO: Merge pull request 45081
2021-07-16 16:13:58 -07:00
Andrew Branch b300ef4bc7
Check for watched directories before clearing map (#44947) 2021-07-16 15:35:38 -07:00
Oleksandr T 1aac3555f7
fix(45049): fix diagnostic for missing property initializer (#45052) 2021-07-16 15:10:42 -07:00
Oleksandr T ba2e2600c8
fix(44701): allow renaming string literal in rhs/lhs of equality (#44708) 2021-07-16 14:45:06 -07:00
Anders Hejlsberg 193b7494d0
Properly propagate silentNeverType in intersections (#45073)
* Properly propagate silentNeverType in intersections

* Add regression test
2021-07-16 11:20:04 -07:00
Wesley Wigham d0efe9065e
Dont swallow declaration emit errors when issued on nodes without names (#44995) 2021-07-16 10:30:22 -07:00
csigs 7ef66f647b
LEGO: Merge pull request 45072
LEGO: Merge pull request 45072
2021-07-16 10:13:11 -07:00
Andrew Casey d8f2aaeebf
Shorten baseline names (#45054)
Fixes #45051
2021-07-16 10:01:36 -07:00
Oleksandr T 00596e19f5
fix(44168): exclude adding export to existing exported identifier (#44755) 2021-07-16 09:40:17 -07:00
Oleksandr T 23ebe04563
fix(44902): resolve members in Union or Intersection types (#44904) 2021-07-16 09:07:52 -07:00
csigs e4da7a97a0
LEGO: Merge pull request 45067
LEGO: Merge pull request 45067
2021-07-16 04:13:22 -07:00
Wesley Wigham 8268f2adec
Avoid bogus circularity error on context sensitive constructor property assignments (#44601)
* Avoid bogus circularity error on context sensitive constructor property assignments

* Add JS case and ensure its fixed
2021-07-15 17:06:56 -07:00
csigs 87cff4e3bb
LEGO: Merge pull request 45060
LEGO: Merge pull request 45060
2021-07-15 16:13:30 -07:00
Andrew Branch 6d3772f357
Fix auto import require of CJS module with module:es2015+ and allowSyntheticDefaultExports (#44955) 2021-07-15 16:08:05 -07:00
Josh Goldberg 541e553163
Specific diagnostic suggestions for unexpected keyword or identifier (#43005)
Error message improvement for unexpected tokens in the following situations:

* A word was parsed that seems to have a low edit distance from a known common keyword
* A word was parsed that seems to be a known common keyword and a name _without_ a space in-between
* Parsing in a particular type of node (mostly a class property declaration) got a different word or token than expected

___

* Specific diagnostic suggestions for unexpected keywords or identifier

* Don't reach into there, that's not allowed

* Improved error when there is already an initializer

* Specific module error message for invalid template literal strings

* Skip 'unexpected keyword or identifier' diagnostics for declare nodes

* Improve error for function calls in type positions

* Switch class properties to old diagnostic

* Corrected errors in class members and reused existing textToKeywordObj map

* Corrected more baselines from the merge

* Update src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Mostly addressed feedback

* Clarified function call type message

* Split up and clarified parsing vs error functions

* Swap interface name complaints back, and skip new errors on unknown (invalid) tokens

* Used tokenToString, not a raw semicolon

* Inline getExpressionText helper

* Remove remarks in src/compiler/parser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-07-14 13:50:55 -07:00
Gabriela Araujo Britto 3358f137c6
Fix namespace name conflict detection in "Convert named imports to namespace import" action (#45019)
* fix namespace conflict detection
2021-07-14 11:07:12 -07:00
jjangga0214 2b8296b7ad
chore(typo): fix comment (#45016) 2021-07-14 09:28:48 -07:00
Jean Pierre 40ec8392a1
Fixes JSDoc @type function with variable args is interpreted incorrectly (#44864)
* Fixes #44386

* Add test

* Move test from fourslash to conformance
2021-07-13 17:17:24 -07:00
Daniel Rosenwasser 0996bff509
Support syntactic diagnostics in partial mode (#44859)
* Initial work to support syntactic diagnostics in partial mode.

* Test out 'syntacticDiagnosticsSync' requests.

* Added a 'geterr' test.

* Accepted baselines.

* Remove/clean up comments.
2021-07-13 11:22:34 -07:00
caojoshua acdf62fa1e
Fix "Union types are not being narrowed down correctly in 4.3 #44401" (#44771)
* Fix "Union types are not being narrowed down correctly in 4.3 #44401"

* On undefined constraint, add the original type to constraints.
2021-07-13 11:02:18 -07:00
csigs f453a28ed0
LEGO: Merge pull request 45000
LEGO: Merge pull request 45000
2021-07-12 22:13:14 -07:00
Wesley Wigham 8e855d140b
Watch mode watches for changes in package.json files used in resolution (#44935)
* watch mode watches for changes in package.json files used in resolution

* Pathify result of realpath

* Actually accept pathified baselines
2021-07-12 17:23:08 -07:00
csigs 0746f70fe5
LEGO: Merge pull request 44989
LEGO: Merge pull request 44989
2021-07-12 10:14:10 -07:00
csigs 3c604f1c0a
LEGO: Merge pull request 44987
LEGO: Merge pull request 44987
2021-07-12 04:13:35 -07:00
csigs ed6007d316
LEGO: Merge pull request 44982
LEGO: Merge pull request 44982
2021-07-11 22:18:01 -07:00
csigs bcb1911abd
LEGO: Merge pull request 44979
LEGO: Merge pull request 44979
2021-07-11 16:18:31 -07:00
csigs db561931a7
LEGO: Merge pull request 44977
LEGO: Merge pull request 44977
2021-07-11 10:13:09 -07:00
Ron Buckton 66c3063b06
Add collision check for 'Reflect' when using super in static initializers (#44876)
* Add collision check for 'Reflect' when using super in static initializers

* PR feedback

* Accept baseline for new failing test
2021-07-10 12:48:54 -07:00
Oleksandr T a15030ff6f
fix(35050): Decorator emit incorrect within try block (#41951)
* fix(35050): fix decorated block-scoped class emit

* Only use internal name when targeting ES5/3

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-07-08 10:48:02 -07:00
Andrew Branch e881a69939
Detect circularities printing recursive conditional types (#43733) 2021-07-08 09:19:58 -07:00
Ron Buckton 8590f0db40
Fix decorator emit regression for static fields (#44933) 2021-07-07 16:58:36 -07:00
Oleksandr T c0821aeacd
fix(44926): change noImplicitOverride description (#44929) 2021-07-07 18:43:44 +01:00
Andrew Casey 4d5978d1db
Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject (#44836)
* Apply disableReferencedProjectLoad to getOriginalLocationEnsuringConfiguredProject

* Reuse previously computed values and refine comments

* Add baselines for test matrix
2021-07-06 15:22:48 -07:00
Eli Barzilay bb7de99e5a Improve "Convert to template string" with template-strings
Fixes #44396
2021-07-06 18:14:58 -04:00
Anders Hejlsberg 8e01a86c01
Consistently ignore attributes with hyphenated names in JSX (#44873)
* Consistently skip attributes with hyphenated names in JSX

* Add regression test

* Accept new baselines

* Fix tests

* Accept new baselines
2021-07-06 10:29:51 -10:00
Andrew Branch 1da18c60d6
Refactor export map cache to not store transient symbols (#44816)
* Add some failing tests around transient symbols

* Working, but slower

* A class is much faster, apparently

* This is probably best?

* Back to multimap

* Go back to single symbol cache

* Revert now-unnecessary generics

* Rename and reorganize

* Fix weird compound condition

* Clean up
2021-07-06 11:04:59 -06:00
Oleksandr T fc5c765f81
fix(44868): handle import type in shorthand assignment (#44881) 2021-07-06 09:29:09 -06:00
Ron Buckton 069650f602
Change PerformanceObserver to be compatible with new Node types (#44884) 2021-07-03 21:26:56 -07:00
Ron Buckton 09406524b3
Add evaluation tests for class static initializers (#44878) 2021-07-03 18:30:42 -07:00
Ron Buckton 8b496ed34c
Fix class name reference in class expr (#44877) 2021-07-02 18:37:23 -07:00
Daniel Rosenwasser 248b2c3fc1
Further optional delete corrections (#44862)
* Add more tests.

* Accepted baselines.

* Switch to testing the symbol's flags.

* Accepted baselines.
2021-07-01 18:44:22 -07:00
Daniel Rosenwasser e3d6189e3a
Correctly check for 'delete' on optional properties in 'exactOptionalPropertyTypes'. (#44854)
* Check for optionality in 'delete'.

* Accepted baselines.
2021-07-01 15:19:11 -07:00
Daniel Rosenwasser 9d443b76aa
Update LKG to enable improved narrowing in 4.4. (#44842)
* Update LKG.

* Remove unnecessary assertions.
2021-07-01 12:21:27 -07:00
Oleksandr T e402c1d464
feat(44799): allow auto import codefix for shorthand property assignment (#44827) 2021-06-30 16:09:42 -05:00
Zzzen 813ddf7909
ensure export modifier is used before default modifier (#44570)
* ensure export modifier is used before default modifier

* gracefully handle `default function`

* Revert "gracefully handle `default function`"

This reverts commit 1d8e288754.

* give better error message on default without leading export
2021-06-30 09:43:14 -07:00
Oleksandr T 5c8d76347c
fix(44448): disallow 'delete' operator for optional properties (#44612) 2021-06-29 16:56:45 -07:00
Anders Hejlsberg 4c19873b64
Validate symbol-named properties against symbol index signatures (#44815)
* Validate symbols against both symbol and string index signatures

* Add tests

* Accept new baselines
2021-06-29 11:53:07 -10:00
Oleksandr T 114f68cd3d
fix(44725): handle this parameter in tagged template call (#44734) 2021-06-29 14:11:35 -07:00
Eli Barzilay f47ddbc3b0 Fix bad line number assertion in ScriptInfo.positionToLineOffset
This is the line number side of ecddf8468f (from #21924, fixing #21818).
But the code is slightly improved for both cases: instead of testing
that `leaf` is defined, check whether `lineCount` is zero, and if it is,
return `〈1,0〉` for the one-based line and zero-based column numbers.
(The requirement of `lineCount > 0` is also seen in the fact
that `lineNumberToInfo` expects a "*One*BasedLine" argument.)

I've stared at this code way too much, since I think that there is
something more fundamentally wrong here.  E.g., `EditWalker` only
`push`es to `startPath` but never pops even a `children`-less node that
is left after deleting the whole contents.  But I can't figure out the
overall structure, which is also why the test that I added is not
great (see the comment there; also, #21924 is dealing with the same
problem and didn't add a test).

Fixes #44518.
2021-06-29 14:13:44 -04:00
Anders Hejlsberg 5f8a9e5181
Fix constant reference check in CFA (#44762)
* Check entire access path is constant when narrowing by inlining

* Add tests

* Accept new baselines

* Added test cases for parameter properties.

* Accepted baselines.

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-06-28 16:41:17 -07:00
Andrew Casey c0d5c29080
Reduce exceptions (#44710)
* Don't visit non-existent basePaths

* Stop trying to add file watchers after hitting the system limit

* Update tests
2021-06-28 15:45:35 -07:00
Oleksandr T 066796be54
feat(44736): add go-to-definition on overridden members (#44740) 2021-06-28 14:58:06 -07:00
Andrew Branch 54b913cf31
Issue unawaited promise error on symbol-less expressions (#44491)
* Issue unawaited promise error on symbol-less expressions

* Use same behavior for call expressions

* Revert "Use same behavior for call expressions"

This reverts commit 60d58132e4.
2021-06-28 12:35:58 -05:00
csigs 4890312ad8
LEGO: Merge pull request 44791
LEGO: Merge pull request 44791
2021-06-28 10:13:00 -07:00
csigs a6c914e55d
LEGO: Merge pull request 44780
LEGO: Merge pull request 44780
2021-06-27 22:13:03 -07:00
csigs 67357cdb4f
LEGO: Merge pull request 44776
LEGO: Merge pull request 44776
2021-06-27 16:13:07 -07:00
csigs 3b2bc85594
LEGO: Merge pull request 44770
LEGO: Merge pull request 44770
2021-06-27 10:13:36 -07:00
csigs 5dbb7d313c
LEGO: Merge pull request 44766
LEGO: Merge pull request 44766
2021-06-26 22:12:53 -07:00
csigs 0b3a15414b
LEGO: Merge pull request 44763
LEGO: Merge pull request 44763
2021-06-26 16:14:05 -07:00
csigs 8c8d22db0f
LEGO: Merge pull request 44757
LEGO: Merge pull request 44757
2021-06-26 10:13:11 -07:00
Nathan Shively-Sanders 1ae6b8bfb5
Forbid duplicate tests only in compiler+fourslash runner (#44752)
* Forbid duplicate tests only in compiler runner

Not in fourslash, user, docker, etc.

* Include fourslash, but exempt shims and server
2021-06-25 17:33:31 -07:00
Wenlu Wang dc237b317e
Change static fields emits (#43114)
* use emit into iife

* Update emit

* Revert un-related changes

* Allow super in static context

* Allow this and super in static property declaration

* Add more tests

* Avoid errors

* Accept baseline

* Accept baseline

* Add decorated classes test

* Add errors

* Avoid this in emitter

* make lint happy

* Add class expression tests

* Add computed name test

* Avoid super if target below es6

* Adjust function boundary

* Add internal

* Fix minor CR issues

* accept baseline

* Update behavior

* Avoid spaces

* Make lint happy

* Avoid function boundary utils

* Update baseline

* Avoid errors

* Accept baseline

* Accept baseline

* Accept baseline

* Accept baseline

* Use substitutions

* Full coverage for super, this, merge static and private context

* Fix use-before-def in static fields

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 15:49:27 -07:00
Andrew Branch 328e888a9d
Resolve module specifiers for auto imports in completion list (in incomplete chunks) (#44713)
* Enable module specifiers for all auto imports

* Use isIncomplete

* isIncomplete continuation

* Lots of fixes

* Merged/transient symbol fixes, resolve all ambient module specifiers up front, pull as many as we want from cache

* Fix existing tests

* Start testing

* Add more tests

* Set cache attempt limit, update API baseline

* Fix a few tests

* Fix contextToken

* Split getModuleSpecifiers

* Unexport function

* Clean up importFixes

* Clean up completions

* Delete transient symbol assertion - fixing later
2021-06-25 17:26:53 -05:00
Orta Therox 9ebe11c2d3
Migrate latest dom types into libdom.d.ts (#44684)
* Add the types_web dom dts

* Update

* Adds new DTS

* Update baselines
2021-06-25 14:25:30 -07:00
Anders Hejlsberg 8058619aed
Control flow analysis of aliased conditional expressions and discriminants (#44730)
* CFA inlining of conditional expressions referenced by const variables

* Accept new baselines

* Add tests

* Accept new baselines

* Increase inlining limit to 5 levels per design meeting discussion
2021-06-25 13:59:58 -07:00