Commit Graph

22193 Commits

Author SHA1 Message Date
Alexander T
b41eb1bc61 feat(36249): add quick-fix action to declare a property as private which starts from underscore (#36632) 2020-03-13 10:33:56 -07:00
Orta
f1cc8e4e4e [minor] Adds some docs to the LSP interface (#36740)
* Adds some docs to the LSP dts

* Ensure that getProgramDiagnostic is included everywhere that getCompilerOptionsDiagnostic is

* Update baselines

* Apply suggestions from code review

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

* Remove the getCompilerOptionsDiagnostics -> getProgramDiagnostics change

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2020-03-13 13:26:39 -04:00
csigs
98e45b40d1 LEGO: check in for master to temporary branch. 2020-03-13 04:10:29 +00:00
Wesley Wigham
df523b30cf Filter the type of a binding pattern to not include undefined is the pattern parent has an initializer (#37309) 2020-03-12 17:50:05 -07:00
Donald Pipowitch
e0f6ecd957 improve error message TS2307 (#27054)
* improve error message TS2307

* add updates missed from merge

* update more missed baselines

* remove incorrectly re-added test files

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-12 15:55:54 -07:00
Sheon Han
b014e2b568 Show token hints for missing closing braces (#36317)
* Add error for missing brace in object literal

* Add new baseline test

* Update all affected tests
2020-03-12 15:52:02 -07:00
Andrii Dieiev
c6cfd66fa8 Support template literals in preProcess (fixes #33680) (#33688) 2020-03-12 15:50:23 -07:00
Ryan Cavanaugh
0426e48828 Fix crash when host.getSourceFile returns undefined (#37373)
Another day, another incorrect non-null assertion

Fixes #37368
2020-03-12 15:45:56 -07:00
M.Yoshimura
f06f809c75 Treat write-only-access to a class member with setter as a reference. (#35922)
* Treat write-only-access to a class member with setter as a reference.

* Add test case for unused private members, special-casing the member with a setter.
2020-03-12 15:41:40 -07:00
Jack Williams
dcc73944f4 Fix 33436 (#35225)
* Fix 33436

* Fix code

* Fix error message after bad merge

* Remove whitespace
2020-03-12 15:40:14 -07:00
Ryan Cavanaugh
d727d5a5eb Remove 'path' from assert call (#37372)
Fixes #37369
2020-03-12 15:11:05 -07:00
Joey Watts
31963d54b8 Add implementation for fixExpectedComma (#33879)
Signed-off-by: Andrew Deniszczyc <adeniszczyc@bloomberg.net>

Cleanup of implementation

Move check node container check

Add test cases for fixExpectedCommaError

Renaming and add test case

Co-authored-by: Andrew Deniszczyc <adeniszczyc@bloomberg.net>
2020-03-12 14:55:02 -07:00
Sachin Grover
bff0ddc941 fix(36102): fix extra new line in Organize Imports (#36911)
Organize Imports was inserting extra newline.

Fixes #36102
2020-03-12 17:51:48 -04:00
Arman
3d76c37cbe More clear comment for String.prototype.match() (#36301)
* More clear comment for String.prototype.match()

* Removed trailing spaces
2020-03-12 14:44:07 -07:00
Klaus Meinhardt
7bd6209fbc Don't parse duplicate JSDoc for ExpressionStatement starting with ParenthesizedExpression (#36289)
* don't parse JSDoc on ExpressionStatement if it starts with ParenthesizedExpression

* update test
2020-03-12 14:42:49 -07:00
Tom Jenkinson
ddcf139668 make splice deleteCount required in es5.d.ts (#32643)
* make splice `deleteCount` required in es5.d.ts

In ES5 `deleteCount` is not an optional argument. If it is not provided it defaults to 0 as a side effect of `undefined` being converted to an integer.

In ES6 `deleleteCount` is optional, and it defaults to the length of the array minus the start index.

If you are targeting ES5 but don't provide `deleteCount` the behaviour will be different depending on the environment your build is running in.

fixes #32638

* update baselines
2020-03-12 14:28:14 -07:00
David
4406717f13 add config to insert space for empty braces (#35427) 2020-03-12 16:35:35 -04:00
Sheetal Nandi
a76a16696d Move useSourceOfProjectReferenceRedirect to program so other hosts can use it too, enabling it for WatchHost (#37370) 2020-03-12 13:11:11 -07:00
Sheetal Nandi
1f710167de Ensure that we have seenAffectedFiles map when files are added to pending emit because they were present in the old state (#37302)
* Make the systems for baselining default to pretty

* Ensure that we have seenAffectedFiles map when files are added to pending emit because they were present in the old state
This happens in build scenarios since semantic diagnostics are queried before emit and hence files are added to seenAffectedFiles pending emit
Fixes #37269
2020-03-12 10:54:30 -07:00
Anders Hejlsberg
41a80f5d92 No infinite recursion in excess property and weak type checks (#37360)
* New IntersectionState.ExcessCheck flag to ensure no infinite recursion

* Add regression test
2020-03-12 09:40:15 -07:00
Andrew Casey
9e97b00ca1 adds error message for using value as type argument (#37359)
This addresses issue #28975
(https://github.com/microsoft/TypeScript/issues/28975).

When providing a value as a type argument, we can suggest a more specific
error message: "Did you mean to use typeof T?"

adds error message

WIP: Detect error

WIP: progress

updated tests

janky implementation

adds test coverage around literal types being unaffected

refactor out isIdentifierATypeArgument function

adds test case for type alias

adds test case for nested type arguments

fixes linting errors

merge master into branch to overwrite changes

changes value as type error message

This suggests 'typeof T' as a potential alternative when we give an error
about using value T as a type.

remove stale tests from old change

Co-authored-by: John Patterson <john@johnppatterson.com>
2020-03-11 19:18:17 -07:00
Sheetal Nandi
243186685b Increase the idle time before which ensureProject for open file is called (#37121)
* Increase timeout for ensuring projects for open files

* Condense the project/file printing in the log (given now we have project printed anytime its structure changes)
2020-03-11 16:47:11 -07:00
csigs
f68a0b2626 LEGO: check in for master to temporary branch. 2020-03-11 22:10:31 +00:00
Sheetal Nandi
1a9c8197ff Optimize module resolution cache for watch and editor (#37055)
* Refactor resolveName

* Have resolutions of failed lookups as array and resolved to fileName map
2020-03-11 14:35:26 -07:00
Anders Hejlsberg
6856c012d2 Use objects instead of closures for type mappers (#36576)
* Use objects instead of closures for type mappers

* Flatten combined type mappers

* Single point of creation for type mappers

* More optimizations

* Fix lint error

* Fewer symbol instantiations / discard type mapper after instantiation

* More optimizations

* Simplify mapper layout and cache in composite mappers

* Removing cache as it doesn't seem to matter much

* Get rid of identityMapper
2020-03-11 13:28:49 -07:00
Austin Cummings
ae3d28b5eb Implement constructor type guard (#32774)
* Implement constructor type guard

* Fix code review issues for constructor type guard.
- Do not limit constructor expression to only identifiers
- Fix `assumeTrue` and operator no-narrow check
- Use better way to check that identifier type is a function
- Loosen restriction on what expr is left of ".constructor"
- Update typeGuardConstructorClassAndNumber test to include else cases

* Fix grammar & spacing in `narrowTypeByConstructor`

* fix bad merge

* switch (back?) to crlf

* update baselines

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-11 13:16:33 -07:00
Anders Hejlsberg
b78ef30cb7 No union subtype reduction during type inference (#37327)
* No union type subtype reduction in getImplicitIndexTypeOfType

* Add regression test
2020-03-11 10:27:51 -07:00
csigs
ffa35e14b7 LEGO: check in for master to temporary branch. 2020-03-11 16:10:34 +00:00
Arpad Borsos
5937ffdf25 Add constructor functions for {Symbol,Node}Links (#36845)
Using a constructor function like this can help node better optimize
object allocation. This improves memory usage when compiling
`src/compiler` from **277M** to **270M**, a nice ~3% win.
2020-03-11 08:40:51 -07:00
Wenlu Wang
20625a964b add promise.any (#33844)
* add promise.prototype.any

* add AggregateError

* Update src/lib/esnext.promise.d.ts

Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* update baseline again

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-11 08:36:00 -07:00
csigs
dd09e65673 LEGO: check in for master to temporary branch. 2020-03-11 04:10:30 +00:00
csigs
94ff6fd15c LEGO: check in for master to temporary branch. 2020-03-10 22:10:33 +00:00
Jack Williams
67ca82b375 Add flag to omit default case (#33574) 2020-03-10 15:04:03 -07:00
Iku Iwasa
5e0f584b67 Support NetBSD platform (#34756) 2020-03-10 14:53:37 -07:00
csigs
8507a23b91 LEGO: check in for master to temporary branch. 2020-03-10 16:10:29 +00:00
Anders Hejlsberg
c4da90368f Infer to erased signatures (#37261)
* Use erased signatures as inference targets

* Add tests
2020-03-10 08:42:36 -07:00
csigs
fe8decb316 LEGO: check in for master to temporary branch. 2020-03-10 10:10:28 +00:00
Sheetal Nandi
e68524a8d2 Handle WatchCompilerHost without timeout methods to retrieve correct Program (#37308) 2020-03-09 16:30:52 -07:00
Josh Goldberg
bf15eac16e Removed unused host variable in createProgramHost (#37278)
As stated in 26417, `host` is only ever written to and never read from. `createProgramHost` is the only place I could find that provides a member for `ProgramHost`'s `onCachedDirectoryStructureHostCreate`, so that's removed as well.
2020-03-09 13:53:49 -07:00
Andrew Branch
bc0e5a241c Fix longer type-only property access in non-emitting heritage clauses (#37264)
* Fix longer type-only property access in non-emitting heritage clauses

* Rename misnomer function
2020-03-09 12:05:36 -07:00
Alexander T
8d63a7a842 fix(28163): change outdated options (#37268) 2020-03-07 10:23:07 -08:00
Sheetal Nandi
8dede43365 Reset hasChangedAutomaticTypeDirectiveNames once new program is created (#37266)
* Allow passing watch to the change as parameter

* Reset hasChangedAutomaticTypeDirectiveNames once new program is created
Also dont invoke afterProgramCreate if the program is not new
2020-03-06 18:21:16 -08:00
Jonathan Share
c0c5760d15 Fixes duplicated comment when executing code fix to add missing enum member (#28163)
Resolves issue #28031 by overriding default value of
`useNonAdjustedStartPosition` option to replaceNode. Test case included
that confirms intended behaviour.
2020-03-06 16:53:37 -08:00
Ben Lichtman
631def81d5 Merge pull request #37260 from uniqueiniquity/watchFileExistsFix
Fix fileExists check for a watch program
2020-03-06 13:01:03 -08:00
Ben Lichtman
a4430f7baf Update tests to be more precise 2020-03-06 12:41:00 -08:00
Ben Lichtman
0ed21e34ed Fix file exists check for watch program 2020-03-06 09:44:16 -08:00
csigs
ec83e9f6f9 LEGO: check in for master to temporary branch. 2020-03-06 04:10:31 +00:00
csigs
755e99fe21 LEGO: check in for master to temporary branch. 2020-03-05 22:10:33 +00:00
Nathan Shively-Sanders
458977b94b Reinstate incorrectly removed esnext.bigint (#37233)
* Reinstate incorrectly removed esnext.bigint

From a bad merge I made in #33845

* fix esnext.bigint alias
2020-03-05 10:11:48 -08:00
csigs
6a79c585ce LEGO: check in for master to temporary branch. 2020-03-05 16:10:29 +00:00