Commit Graph
21852 Commits
Author SHA1 Message Date
Andrew Branch eced0e0039 Rename misnomer function 2020-03-06 14:56:56 -08:00
Andrew Branch 2669ce7c46 Fix longer type-only property access in non-emitting heritage clauses 2020-03-06 14:42:48 -08:00
Ben LichtmanandGitHub 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-SandersandGitHub 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
ffde92349d Added @ts-expect-error to @ts-ignore directives (#36014)
* Added @ts-expect-error to @ts-ignore directives

Similar to `// @ts-ignore`, but will itself cause a new error diagnostic if it does not cause an existing diagnostic to be ignored.

Technical summary:
1. The scanner will now keep track of `CommentDirective`s it comes across: both `@ts-expect-error` and `@ts-ignore`
2. During type checking, the program will turn those directives into a map keying them by line number
3. For each diagnostic, if it's preceded by a directive, that directive is marked as "used"
4. All `@ts-expect-error` directives not marked as used generate a new diagnostic error

* Renamed to getDiagnosticsWithPrecedingDirectives per suggestion

* Added JSDoc comment I thought I did already

Co-authored-by: Orta <orta.therox+github@gmail.com>
2020-03-05 10:37:36 -05:00
csigs 5b06ce6068 LEGO: check in for master to temporary branch. 2020-03-05 10:10:40 +00:00
csigs 89410e9cb2 LEGO: check in for master to temporary branch. 2020-03-04 22:10:31 +00:00
Nathan Shively-SandersandGitHub 0a1af90bb6 add string.prototype.replaceAll (#33845)
* add string.prototype.replaceAll

* accept baseline

* fix bad merge in tests

* update missed baselines

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-04 13:25:17 -08:00
Nathan Shively-SandersandGitHub 061338e82b Don't inferFromIndexTypes() twice (#34501)
* Don't inferFromIndexTypes() twice

* Add tests
2020-03-04 13:19:35 -08:00
Eli Barzilay 5c8def9a06 Fix emitting ?.
Use `emit()` for writing `questionDotToken`, leading to properly calling
the emit hooks (which `emitTokenWithComment` doesn't) and printing the
comments.  This fixes #35372 by calling its hooks to set the `.__pos`
and `.__end` fields.

Also, remove `getDotOrQuestionDotToken` which was used only here --
mainly because it seems likely to encourage misusing the
`questionDotToken` again.

Also, fix a bunch of `visitor` -> `tokenVisiton` calls in
`visitorPublic.ts`.
2020-03-04 14:52:33 -05:00
Ryan CavanaughandGitHub 67930fc163 Don't crash when there's no class type to derive a 'this' type from (#37164)
Fixes #37161
2020-03-04 09:34:28 -08:00
Wesley WighamandGitHub dfc0b58fe7 Preserve arity for preserving js optional parameters (#37173) 2020-03-04 00:48:53 -08:00
csigs b28e1b8374 LEGO: check in for master to temporary branch. 2020-03-04 04:10:28 +00:00
Nathan Shively-SandersandGitHub b481dd4d4b More precise property-overwritten-by-spread errors (#37192)
* More precise property-overwritten-by-spread errors

Trying to do this check in getSpreadType just doesn't have enough
information, so I moved it to checkObjectLiteral, which is a better
place for issuing errors anyway.

Unfortunately, the approach is kind of expensive in that it

1. creates a new map for each property and
2. iterates over all properties of the spread type, even if it's a
union.

I have some ideas to improve (1) that might work out. I'm not sure how
bad (2) is since we're going to iterate over all properties of all
constituents of a union.

Fixes #36779

* another test and rename
2020-03-03 15:10:19 -08:00
Alexander TandGitHub 3046a54401 fix(36883): accessor allows this parameter but is not checke… (#36889) 2020-03-03 12:26:41 -08:00
Alexander TandGitHub 176241cca9 fix(36238): allow aliases in spelling suggestions (#37168) 2020-03-03 10:58:29 -08:00
Wesley WighamandGitHub 5941c6e1b1 Emit an any for namepath types (#37176) 2020-03-03 10:55:21 -08:00
Alexander TandGitHub ab8adc5f95 fix(37135): handle PrivateIdentifiers in isPropertyName (#37184) 2020-03-03 10:51:50 -08:00
Wesley WighamandGitHub b9c0999a2a Thread host.useCaseSensitiveFileNames through program and node builder into specifier generation (#37170) 2020-03-03 10:50:01 -08:00
Ryan CavanaughandGitHub 0c5878dfb1 symbol.parent really is possibly sometimes undefined here. (#37159)
Fixes #37158
2020-03-03 10:47:07 -08:00
67c6cebfc8 Reinterpret a type parameter constrained to any as an upper bound constraint (#29571)
* Reinterpret a type parameter constrained to any as an upper bound constraint

* Use real constraqint in alias in test

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-03 09:51:15 -08:00
csigs 344b0a8f67 LEGO: check in for master to temporary branch. 2020-03-03 16:10:36 +00:00
Andrew BranchandGitHub 3c468d2617 Clean up convert-to-async refactor (#36858)
* Start renaming some stuff, fix deep cloning identifiers, which apparently fixed some unnoticed bugs

* Wow a lot of stuff seems to be unused
2020-03-03 07:47:18 -08:00
Andrew CaseyandGitHub dd6811fbe3 Stop looking for the default configured project at node_modules (#35011)
* Optionally stop looking for the default configured project at
node_modules

* Make stopping at node_modules non-optional

* Generalize and simplify the change - node_modules files don't have default configured projects
2020-03-02 16:52:03 -08:00
Lo̹̫̦̥̬̜͈͝n̗͚̼̤ĝ̮̫͎̬̬͕̪ͫ̐̕ ͭ̊H̱̏ͬ̃ͨ̆͗o̱͚͉͉̖̰̪ͯ̈ͪ̈̎̚andGitHub 3b996ded9c fix: Intl.PluralRulesOptions to behave according to spec (#33414)
TL;DR: MDN doc is not accurate: https://github.com/tc39/ecma402/issues/365#issuecomment-530617744

According to spec, `PluralRulesOptions` do take in these extra params (point 2 in https://tc39.es/ecma402/#sec-intl-pluralrules-constructor)

Add LDMLPluralRule according to http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories

ResolvedPluralRulesOptions also have these params as optional because according to spec
https://tc39.es/ecma402/#sec-initializepluralrules
https://tc39.es/ecma402/#sec-setnfdigitoptions
2020-03-02 15:49:44 -08:00
Wesley WighamandGitHub ff0422091f Update LKG (#37175)
* Update LKG

* Remove unneeded check (handled by top of function)
2020-03-02 15:15:41 -08:00
Wesley WighamandGitHub af4201ff51 Retain reexports in js emit even when they export nothing (#37124) 2020-03-02 14:33:53 -08:00
csigs 8c19102e59 LEGO: check in for master to temporary branch. 2020-03-02 22:10:50 +00:00
Wesley WighamandGitHub d209092ccc Use merged symbol to pick up js-alias-merged members on export assignments (#37162) 2020-03-02 12:57:00 -08:00
Nathan Shively-SandersandGitHub 392fd0ac0b Remove bogus @implements errors (#37114)
* Remove bogus @implements errors

Make the search for the actual host more comprehensive by reusing the
code that previously only searched for functions. I don't know what to
call this function now, since the old name wasn't accurate either.

* undo gratuitous name change

* Improve name and make calling more uniform

It's slightly less efficient but I think worthwhile for readability.
2020-03-02 09:48:53 -08:00
csigs 8443ed0fa3 LEGO: check in for master to temporary branch. 2020-03-02 16:10:31 +00:00
csigs 88fd33944f LEGO: check in for master to temporary branch. 2020-03-02 04:10:23 +00:00
Anders HejlsbergandGitHub a5796cf3b2 Remove ordering restrictions in control flow analysis (#37134)
* Don't reset CFA type for x.y when x is narrowed

* Add tests

* Accept new baselines

* Remove unnecessary type assertion
2020-02-29 12:03:09 -08:00
csigs a3d4822938 LEGO: check in for master to temporary branch. 2020-02-29 16:10:24 +00:00
csigs 9ad4c5fcd3 LEGO: check in for master to temporary branch. 2020-02-29 04:10:25 +00:00
Anders HejlsbergandGitHub be4b814a4c Reduce intersections by discriminants (#36696)
* Treat never-like intersections as never

* Accept new baselines

* Fix compiler issues revealed by increased intersection correctness

* Delete fourslash tests that are no longer applicable

* Include isNeverLikeIntersection check in getNormalizedType

* Erase never-like types in several more places

* Check that base types are not never-like

* Add comments

* Revert isNeverLikeType check in getIndexType (keyof shouldn't resolve member types)

* Introduce getReducedType for union and intersection types

* Don't reduce in getApparentType

* Avoid relationship check in resolveMappedTypeMembers

* Accept new baselines

* Don't call getReducedType in getIndexType

* Ensure reduced and unreduced forms of a type can compare identical

* Reduce types before converting them to string representation

* Accept new baselines

* Reduce intersections before obtaining keyof X

* Add tests

* Accept new baselines

* Fix comment in tests

* Don't infer from empty intersection types

* Add tests

* Accept new baselines

* Defer instantiation of mapped type property types

* Accept new baselines

* Include more precise type in diagnostic

* Accept new baselines

* Minor optimization

* Improve error message

* Optional properties in intersections are never discriminants
2020-02-28 17:06:44 -08:00
Wesley WighamandGitHub f31ff2dac0 Revert #36907 (#37122) 2020-02-28 15:53:24 -08:00
f9945f5acf Full support for CommonJS auto-imports in JS (#37027)
* Support add new requires

* Always use destructuring for requiring default exports

* Add more tests

* Update existing fourslash tests

* Use `getExportsAndPropertiesOfModule`

* Add UMD test

* Apply suggestions from code review

Fix typos

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

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-28 14:34:20 -08:00
Wesley WighamandGitHub c6c2c4c8d5 Hoist initial assignment to exported names in cjs to they are not blocked by bindings made by __exportStar (#37093)
* Hoist initial assignment to exported names in cjs to they are not blocked by bindings made by __exportStar

* Copy hoisted identifiers so they do not create sourcemaps

* Accept updated baselines
2020-02-28 13:25:28 -08:00
csigs c09001cf65 LEGO: check in for master to temporary branch. 2020-02-28 04:10:26 +00:00
Andrew BranchandGitHub 0a6ee7753d Grammar error on export type * (#37064)
* Recognize `export type *` syntax, but disallow it

* Add more comments to test

* Revert recognizing invalid forms as type-only

* Revert more
2020-02-27 16:35:15 -08:00
Ryan CavanaughandGitHub f4e371c731 Harden findAllReferences.ts against symbol.declarations = undefined cases (#37088)
Fixes #37086
2020-02-27 14:55:49 -08:00
csigs 3d23f0888f LEGO: check in for master to temporary branch. 2020-02-27 22:10:46 +00:00
5c85febb0c Fix Get/Set being enumerable (#32264)
* Fix Get/Set being enumerable

fixes #3610

* fix tests

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-02-27 14:08:20 -08:00
Wesley WighamandGitHub e7c578a67d Reapply contextual type when recalculating array literals as tuples (#37071) 2020-02-27 14:02:28 -08:00