Commit graph

32005 commits

Author SHA1 Message Date
Sang f2705294ac
Fix object literals lack of this references (#43572)
* fix: object literals lack of this references

* test: improve cases
2021-04-20 10:06:08 -07:00
Jean Pierre 8513f78058
Fix getCodeFixesAtPosition for ts(2339) thows error False expression: Token end is child end (#43645)
* Fix getCodeFixesAtPosition for ts(2339) thows error False expression: Token end is child end
Fixes #43191

* Add test
2021-04-20 10:00:34 -07:00
Josh Goldberg a910c8df13
Added skipDestructiveCodeActions argument to organize imports server command (#43184)
* Stopped removing unused imports in files with syntactic errors

* Added allowDestructiveCodeActions arg

* Updated .d.ts baselines

* Stop factoring syntax errors. Weird that no tests break...

* Have args extend scope so it is not a breaking change

* Update src/harness/harnessLanguageService.ts

Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>

* Fixed API breaking change, and renamed to skip

* Always with the baselines

* One more .d.ts baseline to fix

* Remove blank line in src/harness/harnessLanguageService.ts

Co-authored-by: Jesse Trinity <jetrinit@microsoft.com>
2021-04-20 09:04:17 -07:00
Armando Aguirre f67ee44379
Instantiate getter when infering setter parameter value (#43564)
* Instantiate getter when infering setter parameter value

* Use esnext on tests

* Instantiate for JsDoc and getter from body

* PR comments

* Updated baseline
2021-04-19 23:23:40 -07:00
Wesley Wigham 167ebcd93b
Check type flags before checking multiple-meaning object flags (#43745) 2021-04-19 22:35:11 -07:00
Wesley Wigham 7e4400b9c3
Stop checking getter/setter compatability twice (#43741)
* Stop checking getter/setter compatability twice

* Ensure modifier errors are still emitted on both accessors, accept modified baselines
2021-04-19 15:53:48 -07:00
Anders Hejlsberg 52ec8ce740
Clean up ObjectFlags enum (#43732)
* Clean up ObjectFlags enum

* Accept new baselines
2021-04-19 15:33:36 -07:00
Wesley Wigham 85c9d2cc89
Use faster, stricter prop type comparison when merging props in union prop creation (#43696)
* Use faster, stricter prop type comparison when merging props in union prop creation

* Be better at determining this usage in methods, accept baselines

* Small style change
2021-04-19 15:25:12 -07:00
Armando Aguirre 1a04b17adc
Fix organize imports overlap (#43228)
* Fix organize imports overlap

* Refactored multiline end position

* Added tests for single line trailing trivia

* Fix rearranging imports

* Fix lint error

* PR coments
2021-04-19 15:10:57 -07:00
Andrew Casey c671fe1bc2
Skip up-to-date checks during force build (#43666)
* Skip up-to-date checks during force build

Save work by not checking timestamps or parsing the buildinfo file.
Retain correctness checks (like input file existence).

Suppress project status, which was confusing anyway.

* Print a message to indicate that --force is causing the rebuild

* Don't bother updating buildInfoChecked

* Add missing force check
2021-04-19 13:06:00 -07:00
Ron Buckton e0d551606f
Remove preprinter, add parenthesizer callback to emit (#43652) 2021-04-19 09:34:46 -07:00
Ryan Cavanaugh b1ab2b98be
Wire up 'writing' parameter through protected derived class detection (#43455)
Fixes #43443
2021-04-19 09:20:21 -07:00
TypeScript Bot e4e96c3399 Update package-lock.json 2021-04-18 06:07:36 +00:00
Anders Hejlsberg 0f2dabcd4b
Don't re-alias top-level type aliases with local type aliases (#43701)
* No re-aliasing of top-level type aliases with local type aliases

* Accept new baselines
2021-04-17 07:07:46 -07:00
Sheetal Nandi 01264ac414
Reducing tsbuildinfo size further (#43695)
* Serialize compiler options that are needed from old state when creating new state

* Dont write affectsGlobalScope if not true

* Encode FileInfo for better serialization size

* Update src/compiler/builder.ts

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-04-16 23:22:14 -07:00
TypeScript Bot 9af763d888 Update package-lock.json 2021-04-16 06:08:00 +00:00
Wesley Wigham 0eee64f0eb
Node factory should insert override modifier between static and astnc (#43699) 2021-04-15 17:16:19 -07:00
Andrew Branch 06f25c0390
Enforce keyword order between override and static/async (#43660)
* Enforce keyword order between override and static/async

* Update old tests for new keyword order
2021-04-15 14:03:53 -07:00
Nathan Shively-Sanders 0987ee9e0e
Do not erase signatures in getSignatureOfTypeTag (#43688)
I don't see a reason for it, and it doesn't cause any tests to fail.
2021-04-15 10:53:23 -07:00
TypeScript Bot 931b20af6c Update package-lock.json 2021-04-15 06:07:53 +00:00
Nathan Shively-Sanders 3f93d420bf
Fix @typedef/@callback scope (#43682)
JSDoc typedefs don't actually have hosts, because they're not
semantically attached to a declaration. However, the parser still
attaches them to some declaration (or statement), but that declaration
is not related to the typedef.

Previously, delayedBindJSDocTypedefTag used getJSDocHost to walk past
the unrelated declaration, but #41858 correctly started categorising
typedefs as unattached, with no host, so the binder began falling
back to file scope.

The path to skip the unrelated declaration is always the same, though, so this
PR uses `typeAlias.parent.parent` instead of `getJSDocHost(typeAlias)`.
2021-04-14 16:56:37 -07:00
Wesley Wigham 3ab6809e38
Consider identical instances of the same symbol equivalent when creating union and intersection properties (#43560)
* Consider identical instances of the same symbol equivalent when creating union and intersection properties

* Also copy over mapper and type (if available) on cloned symbols

* Editorial feedback
2021-04-14 16:55:45 -07:00
Wesley Wigham 6c7c5e9ec2
Expand exception to contravariant constraint elision to all type variables (#43599)
* Expand exception to contravariant constraint elision to all type variables

* Comment update
2021-04-14 13:13:02 -07:00
Andrew Branch f74f9cac13
Add telemetry properties for import statement completions (#43664) 2021-04-13 16:17:52 -07:00
Oleksandr T e87a0be959
fix(43444): add support JSDoc function signatures on returned function expressions (#43607)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-04-13 16:11:58 -07:00
Nathan Shively-Sanders 6a3d68905c
Add jsdoc to all js statements (#43659)
* Add jsdoc to if statements

This should only happen in JS files, however, and there needs to be some
conditional handling of jsdoc on statements that can't have jsdoc in TS
files.

* Finish change

* Add test
2021-04-13 15:30:22 -07:00
Anders Hejlsberg 5977233fd1
Reinstate constraint check for template literal types (#43661)
* Add missing constraint check for template literal types

* Add regression test
2021-04-13 12:17:55 -10:00
Armando Aguirre 5a6a499d0e
Fix sending correct symbol when using commonjs require and destructuring (#43511)
* Fix sending correct symbol when using commonjs require and destructuring

* Check BindingElement
2021-04-13 15:06:34 -07:00
Wesley Wigham 6002cff776
Trim indexed access and type variable constraint error output (#43540) 2021-04-13 13:13:32 -07:00
Andrew Branch 06a73655d0
Don’t error for missing await when promise is referenced in condition body (#43593) 2021-04-13 12:15:48 -07:00
Nathan Shively-Sanders d6012219e0
@link and @see resolve C.m as a class property reference (#43625)
* Test + Initial scribbles

The test is pretty good, the scribbles are actually cleanup from last
PR, although they break some tests.

* undo scribbles, add nonworking class-hack

* Ad-hoc name resolution for @link and @see

Turns out that you can't reuse check* functions if you want to retrieve
all meanings of a reference.

* fix failing test

* inline hapax function

* Fix find-all-refs baseline print

* Try to resolve C.m as static first

* Add interface tests

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-04-13 08:13:18 -07:00
Nathan Shively-Sanders 7c10135d9d
Don't start jsdoc tag before whitespace (#43602)
Fixes #43580
2021-04-12 10:20:44 -07:00
Kunal Desai 0487b38d06
Catch hover on as const (#43588)
* Catch hover on as const

* Update test based on feedback
2021-04-12 11:43:47 +01:00
TypeScript Bot 5d8a4a1753 Update package-lock.json 2021-04-12 06:08:08 +00:00
TypeScript Bot 131875bb84 Update package-lock.json 2021-04-10 06:07:35 +00:00
Eli Barzilay 716441d343 Process only existing files and directories in the test harness
`fs.statSync` throws `ENOENT` if there is a symlink to a nonexistent
target.  This can be avoided by checking that the entry exists before
using it.

(This is annoying when editing tests in Emacs, since it keeps lock files
for modified-but-unsaved files, which are `.#foo` symlinks to a
nonexistent target.)
2021-04-09 17:53:23 -04:00
Wenlu Wang b0c2860a68
ignore static and declared member if checking override (#43569)
* ignore static member if checking override

* Ignore declared member when check override

* Check static override too

* Add more tests
2021-04-09 10:43:33 -07:00
Sang a354a77030
Improve rendering of JSDoc comment text with displayparts (#43390)
* feat(services): jsdoc use custom name for display parts

* fix(services): jsdoc typo

* feat(services): revert jsDoc changes

* feat(services): jsdoc improve displayparts with more comment kinds

Improve rendering of JSDoc comment text with displayparts for:

- `@typedef`
- `@callback`
- `@param`
- `@property`

* feat(services): jsdoc improve displayparts for template

* test: accept baseline

* test: update jsdoc parameterName

* feat: resolve pr comments

* test: add fourslash tests for jsdoc callback, typedef

* test: accept baselines

* test: revert changes for api baselines

* refactor: naming

* refactor: code quality

* refactor: clean up code as to pr comments
2021-04-09 09:44:44 -07:00
Sheetal Nandi 75e9c94e50
While writing tsbuildinfo sort the properties of compiler options to make sure they stay same if nothing changes. (#43601)
Fixes #43571
2021-04-08 16:32:09 -07:00
TypeScript Bot 970554733a Update package-lock.json 2021-04-08 08:47:47 +00:00
Josh Goldberg fe4a6709da
Specified diagnostic for CLI flags mismatched with/out --build (#43199)
* Specified diagnostic for CLI flags missing a required --build

* Switched to an alternateMode member

* Added --build-incompatible flags too

* Small fixups to remove a hardcoding

* Switched to ||= factories

* Not a function

* I think I get it now
2021-04-07 16:03:17 -07:00
Armando Aguirre 2f82d02361
Fix Add all missing imports when ordered alphabetically (#43453)
* Refactored insertNodeInlistAfter to use next elements position

* Consider trivia on insertNodeInListAfter
2021-04-07 16:02:26 -07:00
Anders Hejlsberg d41943eb4e
Properly handle tagged primitives in control flow analysis (#43538)
* Ignore object types in intersections with primitive types

* Add regression test

* Also handle instantiable types constrained to object types

* Add another test

* Add ignoreObjects optional parameter to getTypeFacts
2021-04-07 11:29:46 -10:00
Josh Goldberg a4c683be12
Again: Improve error messages for empty DOM interface property access (#43007)
* Again: Improve error messages for empty DOM interface property access

* containerSeemsToBeEmptyDomElement

Co-authored-by: Daniel Rosenwasser <drosenwasser@microsoft.com>

* isEmptyObjectType; unescapeLeadingUnderscores

* Single tick quotes for now

* Undo accidental diagnostic change

* Correct new baseline

Co-authored-by: Daniel Rosenwasser <drosenwasser@microsoft.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-04-07 12:54:27 -07:00
Josh Goldberg 905a1fea39
Corrected parsing for decorators on 'this' parameters (#43175)
* Corrected parsing for decorators on 'this' parameters

* Moved checking to parser and added a specific test

* Remove unrelated checker.ts blank line

* Missed some baseeline updates...
2021-04-07 11:21:28 -07:00
Titian Cernicova-Dragomir 2484210a00
Gh 41788 incorrect output for esprivate with nested class in esnext (#42663)
* If target:esnext,then useDefineForClassFields: true will now be the default.

* Added error if a private identifier is used in a static a initializer if target:ESNext and useDefineForClassFields:false.

* Added test for new useDefineForClassFields default and error message.

* Fixed tests after changing the default of useDefineForClassFields to true for target esnext

* Fixed code review suggestions.

* Updated error message.

* Added missing static check for the containing property. Fixed other code review issues.
2021-04-07 08:23:16 -07:00
Nathan Shively-Sanders 2bb54dc11a
Fix getTypeFromJSDocVariadicType in callback tag (#43562)
* Fix getTypeFromJSDocVariadicType in @callback

Variadics have never worked there, I think.

* add test + fix lint

* remove outdated comment
2021-04-07 08:12:05 -07:00
TypeScript Bot c1923e9cd1 Update package-lock.json 2021-04-07 06:08:06 +00:00
Nathan Shively-Sanders dd1ef88d01
Use control flow to type CommonJS exports (#42751)
* Allow redeclaring CommonJS alias with initial undefined

This allows us to read our own output, plus the times when people
manually write exactly the same pattern.

Fixes #40555

* Use control flow to type commonjs exports

1. Could probably use a *lot* more tests.
2. getTypeOfAlias redoes some work from resolveAlias because it needs to
not resolve the alias completely, just to its export.

* fix lint, improve jsdoc

* Add tests, improve+fix control flow

1. Update the module.exports test to match the exports ones.
2. Add a test of evolving commonjs type.
3. Add a test of assignment as last statement.

(1) exposed a bug that required a better synthetic reference. (3)
exposed a bug that was most easily fixed by giving source files a
`endFlowNode` like functions and setting it in the binder.

* fix lint
2021-04-06 17:07:35 -07:00
Oleksandr T eebb89533b
fix(43495): insert Override keyword after accessibility modifier (#43504) 2021-04-06 12:03:41 -07:00