Commit graph

29560 commits

Author SHA1 Message Date
Kagami Sascha Rosylight
05a2f1b110 Support bigints in ES2020 (#33874) 2019-12-23 12:18:52 -08:00
Andrew Branch
bed7c89354
Add base constraint completions for JSX attributes (#35803)
* Add base constraint completions for JSX attributes

* Add test for class components
2019-12-23 14:06:46 -06:00
Kagami Sascha Rosylight
d66e959a74 Add ES2020 to diagnostic messages (#35814) 2019-12-23 11:40:41 -08:00
Alexander T
a4e794d872 fix file extension (#35825) 2019-12-23 11:39:50 -08:00
Ron Buckton
6c413e0bbb
Add support for Call Hierarchies in language server (#35176)
* Add support for Call Hierarchies in language server

* Use baselines for callHierarchy tests

* Clean up commented code

* Support multiple hierarchy items when an implementation can't be found

* Use optional chaining in a few places

* Use getFileAndProject
2019-12-22 13:25:09 -08:00
Ron Buckton
114dad7f56
Add top-level await for esnext and system modules (#35813) 2019-12-22 13:24:31 -08:00
Daniel Rosenwasser
88795e2a2e Fixed lints. 2019-12-20 17:04:47 -08:00
Daniel Rosenwasser
35a3a5fbaf Merge remote-tracking branch 'origin' into convert-to-template 2019-12-20 16:46:37 -08:00
Kagami Sascha Rosylight
deb5288e31 Add module: es2020 (#33893) 2019-12-20 16:29:49 -08:00
Wenlu Wang
4c7844be74 Implement export as namespace from (#34903)
* init export start as decl

* fix some broken

* fix more case

* fix more and more case

* make it work

* make lint happy and accept baseline

* add more tests

* fix system module

* add more case

* delete useless assert

* accept baseline

* make lint happy

* fix missing utils

* update api

* make lint happy

* add missing semi

* fix minor issue

* fix locally bound

* avoid useless check

* update public api

* add more case

* fix some case

* Use multi-module selection in test runner to cut down on duplication.

* Accepted baselines.

* remove superfluous tests.

* Remove baseline.

* Downlevel `export * as ns` in es2015.

* Accepted baselines.

* Update names of things.

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2019-12-20 16:00:20 -08:00
Anders Hejlsberg
2f0d07c29a
Increase selectivity of subtype relationship for signatures (#35659)
* Increase selectivity of subtype relationship for signatures

* Add regression test

* Accept new baselines

* Use strictSubtypeRelation for union subtype reduction

* (x: number | undefined) -> void is subtype of (x?: number | undefined) => void

* Accept new baselines

* Add tests

* Accept new baselines

* Address CR feedback

* Fix parameter list length check

* Accept API baseline changes
2019-12-20 14:52:22 -08:00
Nathan Shively-Sanders
3d2b92ce69
Readonly support for jsdoc (#35790)
* Add @readonly

The rule for @readonly on this-assignments in the constructor is wrong.
See failing tests.

* In-progress

Add ctor function test
Add some notes and rename variable

* Done except for cleanup and fix 1 bug

* Fix last test and clean up
2019-12-20 13:47:20 -08:00
Andrew Branch
d96be353cb
Fix JSDoc param type completions when name hasn’t been written yet (#35787) 2019-12-20 15:23:53 -06:00
TypeScript Bot
a0d47d632d Update user baselines (#35791) 2019-12-20 13:22:01 -08:00
Nathan Shively-Sanders
3b7de1a976
remove JSDOC object->any rewrite for noImplicitAny (#35661)
* remove JSDOC object->any rewrite

* reinstate object->any rewrite when noImplicitAny: false

* flip boolean right way round
2019-12-20 09:23:15 -08:00
Nathan Shively-Sanders
2cc1340a7b
Ignore @private/@protected on constructor functions (#35782)
* Ignore @private on constructor functions

This was incorrect in the best of circumstances and caused a crash when
the parent of the function had no symbol, because the accessibility
check assumed it was operating on a constructor and that the parent was
always the containing class.

* Non-constructors are always accessible

Previously, all function-like kinds were accessible, which includes
constructors. This was wrong.
2019-12-20 08:41:52 -08:00
Sheetal Nandi
9445657184
Correctly set filesByName map when reusing program to ensure it is same as old (#35784)
It was previously not populated correctly if preserveSymlinks with useSourceOfProjectReference was true,
in that case if module was resolved to symlink and we deduced it refers to source of project reference we want to set "resolvedFileName" correctly
otherwise it results in incorrect module not found errors.
2019-12-20 07:44:35 -08:00
Wesley Wigham
8c9e96bea9
Move executeCommandLine ambient code into tsc (#35788) 2019-12-19 15:55:42 -08:00
Andrew Branch
1fd5bd2b4e
Filter out self-fulfilling completions (#35709) 2019-12-19 16:05:23 -06:00
Sheetal Nandi
ec84392f2e
Use resolvedPath consistently in the builder (#35757)
* Add baseline for #35468

* Use resolvedPath consistently in the builder
Fixes #35468
2019-12-19 10:10:17 -08:00
Eli Barzilay
5d3284032b Fix scripts/hooks/post-checkout
Shell scripts must use LFs.  Also make it executable.

(Both failures probably don't happen on some windows environment where
git is told to translate EOLs, and all files are assumed executable.)
2019-12-18 17:25:07 -05:00
Ben Lichtman
3c153d885b
Merge pull request #35742 from uniqueiniquity/addPositionAssert
Add asserts to narrow down position issue
2019-12-18 14:19:29 -08:00
TypeScript Bot
1952ccc0b6 Update user baselines (#35756) 2019-12-18 13:04:10 -08:00
Nathan Shively-Sanders
3c5ecc2a60
Add jsdoc support for @public/@private/@protected (#35731)
* Add @private/@protected/@public test

* Fix @declaration

* draft abstraction + one usage

* Fill in necessary parsing etc

* make general getEffectiveModifierFlags

move to utilities, make the right things call it

* reorder public/private/protected

* JS declaration emit works with @public/@private/@protected

* revert unneeded/incorrect changes

* Update baselines and skip @public/etc when parsing

1. Update the API baselines with the new functions.
2. Do not check for @public/etc during parsing, because parent pointers
aren't set, so non-local tags will be missed; this wrong answer will
then be cached.

* Parser: don't call hasModifier(s) anymore.

Then move jsdoc modifier tag checks into getModifierFlagsNoCache where
they should be. The jsdoc checks are skipped when the parent is
undefined. There are 3 cases when this can happen:

1. The code is in the parser (or a few places in the binder, notably
declareSymbol of module.exports assignments).
2. The node is a source file.
3. The node is synthetic, which I assume to be from the transforms.

It is fine to call getModifierFlags in cases (2) and (3). It is not fine
for (1), so I removed these calls and replaced them with simple
iteration over the modifiers. Worth noting: Ron's uniform node construction
PR removes these calls anyway; this PR just does it early.

* Fix constructor emit

1. Emit protected for protected, which I missed earlier.
2. Emit a constructor, not a property named "constructor".
3. Split declaration emit tests out so that errors are properly reported
there.
2019-12-18 12:58:12 -08:00
TypeScript Bot
f7860b0480 Update user baselines (#35755) 2019-12-18 11:16:25 -08:00
Ben Lichtman
9f1e389441 Remove unnecessary internal tags, handle bad input 2019-12-18 10:44:40 -08:00
Sheetal Nandi
853507642a
Do not list output files that just change their modified time when using --listEmittedFiles (#35714)
* Baseline incremental scenarios for listEmittedFiles

* Do not list output file that just changes modified time stamp as emitted file
Fixes #35605
2019-12-18 10:24:59 -08:00
Sheetal Nandi
8c1900c74b
Baselining tsc --watch output just like tsc baselines for easier updates (#35710)
* Baselining tsc --watch output

* Fix lint errors
2019-12-18 10:23:58 -08:00
Andrew Branch
aef2e0a238
Fix implement interface codefix for synthetic member symbols (#35718) 2019-12-18 07:20:01 -08:00
Ben Lichtman
42dc4155ce Refactor to make failure messages more consistent 2019-12-17 17:41:38 -08:00
Ron Buckton
2eb60c2cb2
Fix decoding of HTML entities in TSX/JSX (#35739) 2019-12-17 17:32:48 -08:00
Ben Lichtman
925582d034 Add asserts to narrow down position issue 2019-12-17 17:04:54 -08:00
Anders Hejlsberg
cafa175501
Properly reflect CFA effects of return in try or catch blocks (#35730)
* Properly reflect CFA effects of return in try or catch blocks

* Add tests

* Accept new baselines
2019-12-17 16:46:34 -08:00
Sheetal Nandi
f90cde4706
Fix completions when the ts installation and project are on two different windows drive (#35733)
* Fix completions when the ts installation and project are on two different windows drive
Fixes #35512

* Fix typo
2019-12-17 14:19:52 -08:00
Andrew Branch
c73af610fe
Add ignoreInterpolations util to fourslash for fuzzy diagnostic matching (#35652)
* Add ignoreInterpolations util to fourslash for fuzzy diagnostic matching

* Simplify

* It’s not Swift

* Fix regexp

* Remove unnecessary type assertion
2019-12-16 17:21:21 -08:00
Andrew Branch
53c8b958d7
Fix formatting scanner on multiline JSX attribute strings (#35705)
* Fix formatting scanner on multiline JSX attribute strings

* Update API
2019-12-16 12:36:40 -08:00
TypeScript Bot
16aae96a90 Update user baselines (#35687) 2019-12-16 09:06:46 -08:00
TypeScript Bot
8feff60aee Update user baselines (#35685) 2019-12-15 02:35:18 -08:00
Andrew Branch
8a88c1c84c
Don’t offer import fix for members of arrays or classes (#35635)
* Write failing test

* Don’t offer import fix for members of arrays or classes
2019-12-13 14:20:54 -08:00
TypeScript Bot
543ec2362b Update user baselines (#35671) 2019-12-13 13:04:47 -08:00
TypeScript Bot
af95cb3598 Update user baselines (#35665) 2019-12-13 11:28:27 -08:00
Sheetal Nandi
c3b2aea9f9
Do not write files directly from builder when noEmitOnError is true (#34832)
* Add tests for noEmitOnError

* Do not write files directly from builder when noEmitOnError is true
Fixes #34823

* make linter happy

* Instead of generating output in memory, check errors before doing the emit in case of noEmitOnError
2019-12-12 19:51:18 -08:00
TypeScript Bot
ac5e10bc72 Update user baselines (#35662) 2019-12-12 17:04:09 -08:00
TypeScript Bot
738e222ac5 Update user baselines (#35643) 2019-12-12 16:20:43 -08:00
Anders Hejlsberg
71a91763f4
Fix33448 (#35513)
* Filter out discriminants of type 'never'.

* Add tests

* Accept new baselines

* Remove unnecessary '!' assertion
2019-12-12 06:45:46 -08:00
Nathan Shively-Sanders
b98cb0645d
Fix binding of this-assignments w/computed properties (#35639)
Top-level this-assignments do not support computed properties. But the
binder forgets to check for computed properties and tries to bind them
normally. This hits a helpful assert.

This change stop binding this-properties with computed properties at the
top-level.  There's nothing sensible we could do with them; we're unable
to late-bind entries to the global scope or to modules.
2019-12-11 15:55:08 -08:00
Sheetal Nandi
1fd1b429f0
Handles different references and renames involved with import export and import type node (#34813)
* Test

* Handle import type node when handling the namespace import and reexport
Fixes #33017

* Handle qualifier of the importTypeNode

* Handle export specifier

* Fix rename prefix when search for rename starts at qualifier in import type ndoe

* Fix rename of qualifier with importType node when invoked without provideSuffixAndPrefix option
2019-12-11 15:11:27 -08:00
Wesley Wigham
fc0f67dcfd
Dedent external runner message text 2019-12-11 14:28:59 -08:00
Sheetal Nandi
236012e47b
Add watchOptions to tsconfig and allow supplying them on command line as well (#35615)
* Create different watch options in compiler options

* Thread through the new watch options

* Actually use the options passed through for watch strategy

* Support delay on updating child directory watches

* Make watchOptions separate from compilerOptions

* Support passing watch options from command line

* Handle displaying of watchOptions
2019-12-11 13:26:44 -08:00
Sheetal Nandi
4212484ae1
Open bigger set of configured projects when opening composite project for operations that operate over multiple projects like rename (#33287)
* Add isInferredProject, isConfiguredProject and isExternalProject

* Skip refreshing configured project on change of config file if its not loaded

* Open a tree of projects when doing findAllRefs or rename operations

* Fix addToSeen project key

* Refactor combineProjectsOutputWorker

* if the definition is local, no need to load and look in other projects

* Add disableSearchSolution as option to disable looking for solution

* Rename the option to disableSolutionSearching
2019-12-11 12:28:18 -08:00