Commit graph

22310 commits

Author SHA1 Message Date
Andy 07a890dbbb
Reuse getBinaryOperatorPrecedence (#22844)
* Reuse getBinaryOperatorPrecedence

* Code review

* Consistently sort cases in ascending order
2018-03-27 16:38:39 -07:00
Andy 47d768ceb3
Anything after Debug.failBadSyntaxKind is dead code (#22922) 2018-03-27 15:36:05 -07:00
Wesley Wigham 1db769d566
Transform setter bodies if they contain es2015 (#22931) 2018-03-27 15:16:56 -07:00
Andy 6ef4d7774a
Always test replacementSpan, and don't provide if it would just be an identifier (#22918) 2018-03-27 15:15:50 -07:00
Andy 0a2c160dd1
Debug.failBadSyntaxKind should always be defined and return 'never' (#22091) 2018-03-27 13:35:48 -07:00
Andy 21cd68dd04
Test for isNewIdentifierLocation, and make true for type with index signature (#22910) 2018-03-27 13:05:41 -07:00
Andy ccd6a010e0
completions: Use keywordForNode helper instead of .getText() (#22751) 2018-03-27 12:56:30 -07:00
Nathan Shively-Sanders 61aad4c7b8
Handle toplevel this-assignment (#22913)
Do nothing now. Someday we might handle it correctly.
2018-03-27 12:24:37 -07:00
Andy 2bd66b3292
textChanges: Add insertCommentBeforeLine method (#22902) 2018-03-27 11:50:48 -07:00
Andy e9e1d0d70b
textChanges: Use InsertNodeOptions instead of ChangeNodeOptions where possible (#22903) 2018-03-27 11:50:34 -07:00
Andy 85f11cc5e4
textChanges: Use replaceRange in more places (#22904) 2018-03-27 10:57:42 -07:00
Andy ea6740fa91
replaceNode: Always use non-adjusted end (#22519)
* replaceNode: Always use non-adjusted end

* Never adjust start position either

* Fix excess property checks, remove unnecessary arguments

* Make 'insertText' and 'newLineCharacter' private

* Use replaceNode in one more place now that it doesn't affect comments

* Update replaceNodeRange too

* Always ask for ChangeNodeOptions
2018-03-27 10:34:16 -07:00
Kevin Donnelly 4fa96056ea Make T[never] = never instead of erroring or being any (#22787)
* Add tests showing existing behavior for indexing types with never.

* Make T[never] = never instead of erroring or being any.

And update the baselines for the tests for this change.

* Add test case for indexing an expression with never showing existing behavior.

* Make indexing an object with never expression result in never.

And update baseline to reflect new behavior.
2018-03-27 07:45:25 -07:00
Wesley Wigham dcbc478efa
Tighten heuristic for definite dts moduleness to check for syntactic default (#22814)
* Tighten heuristic for definite dts moduleness to check for syntactic default exports

* Inline function
2018-03-26 16:35:03 -07:00
Mohamed Hegazy 36b49c06cd
Merge pull request #22775 from adriengibrat/FixFunctionApplyDefinition
Fix function.apply type definition
2018-03-26 16:34:24 -07:00
Andy a9d65b8b00
textChanges: Clean up *Options interfaces (#22813) 2018-03-26 15:34:58 -07:00
Mohamed Hegazy faa3fca247
Merge pull request #22886 from Microsoft/Fix22866
Fix #22866: Condition checking for name collision of generated variable names on emit happening
2018-03-26 14:24:59 -07:00
Adrien Gibrat 4f0a2e24e4 Fix function.apply type definition
Thanks @DanielRosenwasser #fix 22600
2018-03-26 23:11:16 +02:00
Andy ced4c00522
importFixes: Distinguish when we need to import JSX constructor or JSX namespace (#22828) 2018-03-26 14:05:03 -07:00
Mohamed Hegazy 2483719e6e Fix lint issues 2018-03-26 13:49:57 -07:00
Nathan Shively-Sanders c9ac15ae56
In JS, this assignments in constructors are preferred and nullable initializers become any (#22882)
* First draft:in js, constructor declaration is preferred

* Add tests

* initializer of null|undefined gives any in JS

Also move this-assignment fixes out of binder. I'm going to put it in
the checker instead.

* In JS, initializer null|undefined: any, []: any[]

* First draft of js prefer-ctor-types overhaul

* Update tests, update baselines

* Improve readability of constructor-type preference

* Cleanup: Remove TODO and duplication

* Add noImplicitAny errors

* Add comment
2018-03-26 13:42:34 -07:00
Andy fa794f6ee1
Remove unnecessary 'forEachEntry' call (#22653) 2018-03-26 13:04:47 -07:00
Mohamed Hegazy 7fd602e594 Fix #22866: Condition checking for name collision of generated variable names on emit happening 2018-03-26 13:02:09 -07:00
Wesley Wigham 6af764c560
Declaration maps and transparent goto definition using them (#22658)
* Add compiler option to enable declaration sourcemaps

* Transparent goto definition for sourcemapped declaration files

* Post-rebase touchups

* Rename API methods

* Fix lints

* Fix typo in name XD

* Log sourcemap decode errors

* Share the cache more, but also invalidate it more

* Remove todo

* Enable mapping on go to implementation as well

* Allow fourslash to test declaration maps mroe easily

* more test

* Handle sourceRoot

* Add tests documenting current behavior with other sourcemapping flags

* Ignore inline options for declaration file maps, simplify dispatch in emitter

* Change program diagnostic

* Fix nit

* Use charCodeAt

* Rename internal methods + veriables

* Avoid filter

* span -> position

* Use character codes

* Dont parse our sourcemap names until we need to start using them

* zero-index parsed positions

* Handle sourceMappingURL comments, including base64 encoded ones

* Unittest b64 decoder, make mroe robust to handle unicode properly

* Fix lint

* declarationMaps -> declarationMap

* Even more feedback

* USE Mroe lenient combined regexp

* only match base64 characters

* Fix nit
2018-03-26 12:15:34 -07:00
Anders Hejlsberg fe8f239648
Merge pull request #22869 from Microsoft/fixConditionalTypeVariance
Fix conditional type variance
2018-03-26 09:36:16 -07:00
Anders Hejlsberg d7df84d641
Merge pull request #22850 from Microsoft/tupleTypeInference
Only make inferences from tuple types of right arity
2018-03-26 09:35:45 -07:00
Andy fdc468976e
Remove unused function (#22848) 2018-03-26 08:03:24 -07:00
Anders Hejlsberg 9acdb7575e Accept new baselines 2018-03-25 15:32:06 -07:00
Anders Hejlsberg 5b1554f708 Change test to use type variables 2018-03-25 15:30:46 -07:00
Anders Hejlsberg b5a39e814f Change to more conservative conditional type relationship 2018-03-25 15:24:31 -07:00
Anders Hejlsberg d70d505e11 Accept new baselines 2018-03-25 11:33:34 -07:00
Anders Hejlsberg 8f860f672f Add tests 2018-03-25 11:33:24 -07:00
Anders Hejlsberg 7c0cc84abd Add tests 2018-03-25 11:30:08 -07:00
Anders Hejlsberg 8750bb8949 Add missing type relationship for conditional types 2018-03-25 11:29:58 -07:00
Mohamed Hegazy 3710218d95 Update authors for release-2.8 2018-03-24 11:51:41 -07:00
Anders Hejlsberg 63f98de813 Accept new baselines 2018-03-23 17:42:05 -07:00
Anders Hejlsberg c2a53f90de Add regression tests 2018-03-23 17:41:55 -07:00
Anders Hejlsberg d6b6bb73de Don't infer between tuple types with different arity 2018-03-23 17:32:52 -07:00
Andy 9557e4ad96
Handle completions in interface / type literal similar to class (#22701)
* Handle completions in interface / type literal similar to class

* Code review
2018-03-23 16:04:29 -07:00
Benjamin Lichtman 383751866e
Merge pull request #22842 from uniqueiniquity/outliningLineEnding
Make region outlining more sensitive to CRLF
2018-03-23 16:02:33 -07:00
Ryan Cavanaugh e7b2017bb0
Merge pull request #22744 from RyanCavanaugh/fixCacheInvalidation
Fix cache invalidation
2018-03-23 15:44:35 -07:00
Ryan Cavanaugh a69adf272a Run test in both module resolvers 2018-03-23 15:22:41 -07:00
Ryan Cavanaugh 1e66f071fd Always include parent folder failed lookup locations 2018-03-23 14:42:16 -07:00
uniqueiniquity 6ba4dbeae4 Make region outlining more sensitive to CRLF 2018-03-23 14:29:32 -07:00
Wesley Wigham 0736554db7
Alternate but more general token comment emit fix + organizeImports fix (#22836)
@amcasey: Preserve leading trivia when organizing imports

When organizing imports, we used to move the leading and trailing trivia
of each individual import with that import as it was repositioned or
deleted.  This had the unfortunate effect of repositioning or deleting
the header comment of the file.

Our new approach is to leave the leading trivia of the first import
ahead of the resulting block of imports (i.e. it no longer follows the
first import as it is repositioned or deleted).  Trailing trivia on the
first import and trivia on subsequent imports are treated as before.
2018-03-23 14:13:40 -07:00
Anders Hejlsberg 5daffbbad1
Merge pull request #22830 from Microsoft/fixDestructuringWithConstraint
Fix control flow analysis for destructuring with constraint
2018-03-23 12:47:22 -07:00
Anders Hejlsberg ad3b3597e4 Accept new baselines 2018-03-23 09:48:11 -07:00
Anders Hejlsberg 1c2f3d228c Add regression test 2018-03-23 09:48:00 -07:00
Anders Hejlsberg deb87bb8ad Obtain constraint from destructured property when applicable 2018-03-23 09:42:43 -07:00
Andy 02ee11c357
Refactor tryGetGlobalSymbols into list of things to try (#22704)
* Refactor `tryGetGlobalSymbols` into list of things to try

* Refactor to `||` expression
2018-03-23 08:44:21 -07:00