Commit Graph

7408 Commits

Author SHA1 Message Date
Anders Hejlsberg
9dd31488f6 Merge pull request #22959 from Microsoft/fixInferTypeParameterLeak
Fix 'infer T' type parameter leaks
2018-03-28 15:45:09 -07:00
Sheetal Nandi
5472ca9ed8 Merge pull request #22963 from Microsoft/incrementalEditWithJsDocNode
Correct the incremental parsing when there is jsDoc node
2018-03-28 15:42:18 -07:00
Anders Hejlsberg
83276ce163 Add another test 2018-03-28 15:21:29 -07:00
Sheetal Nandi
33e9ef60c4 Correct the incremental parsing when there is jsDoc node
Fixes #22924
2018-03-28 14:32:46 -07:00
Andy
6ec13bb945 Use getAllSuperTypeNodes in more places (#22718) 2018-03-28 13:33:20 -07:00
Anders Hejlsberg
0e446fe8c2 Add regression test 2018-03-28 13:16:29 -07:00
Wenlu Wang
cb9f436b54 fix accessor parse with line terminator (#22893) 2018-03-28 10:59:09 -07:00
Nathan Shively-Sanders
adf30dd694 isMethodLike recognises prototype-assignment methods (#22935)
* isMethodLike recognises prototype-assignment methods

* Require js prototype methods to be in JS files
2018-03-28 10:41:24 -07:00
Andy
659dc03f68 completions: isNewIdentifierLocation = false for string literal where all legal values are known (#22933) 2018-03-27 19:36:54 -07:00
Andy
4f1656035b findAllReferences: Consistently use getTextSpan (#22847)
* findAllReferences: Consistently use getTextSpan

* Remove initializer
2018-03-27 19:36:16 -07:00
Wesley Wigham
ddb7bb22dc Add regression test for GH #21871 (#22733) 2018-03-27 19:28:58 -07:00
Andy
b518120883 findAllReferences: Respect search file set searching for references to an exported symbol (#22657)
* findAllReferences: Respect search file set searching for references to an exported symbol

* Remove debugging code
2018-03-27 18:48:27 -07:00
Andy
3e32e15895 Add 'fixAllDescription' property to CodeFixAction (#22616)
* Add 'fixAllDescription' property to CodeFixAction

* Code review

* Add to protocol

* Make fixAllDescription be just a string
2018-03-27 18:21:21 -07:00
Andy
2cbad6ab06 Support completion details for string literal completions (#22664) 2018-03-27 17:02:04 -07:00
Mohamed Hegazy
4699c829de Merge pull request #22898 from Kingwl/fix-return-type-lookup-rule
fix type lookup rule
2018-03-27 17:01:56 -07:00
Andy
b9f48c1d5d refactorConvertToEs6Module: Preserve quote style of imports (#22929) 2018-03-27 17:01:31 -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
21cd68dd04 Test for isNewIdentifierLocation, and make true for type with index signature (#22910) 2018-03-27 13:05:41 -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
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
王文璐
9b7e5e212f fix type lookup rule 2018-03-27 17:37:19 +08: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
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
Andy
ced4c00522 importFixes: Distinguish when we need to import JSX constructor or JSX namespace (#22828) 2018-03-26 14:05:03 -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
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
Anders Hejlsberg
5b1554f708 Change test to use type variables 2018-03-25 15:30:46 -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
c2a53f90de Add regression tests 2018-03-23 17:41:55 -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
Anders Hejlsberg
1c2f3d228c Add regression test 2018-03-23 09:48:00 -07:00
Nathan Shively-Sanders
e16bb3e418 Improve behaviour of ... inside JSDoc functions (#22809)
* No error for ... on last param of jsdoc function

* ... is a rest param w/array type in jsdoc function

* Simplify getTypeFromJSDocVariadicType
2018-03-22 16:17:16 -07:00
Wesley Wigham
ca1d19a579 Always make a new jsxAttributes type, dont reuse emptyObjectType (#22810)
* Always make a new jsxAttributes type, dont reuse emptyObjectType

* Break up conditional a bit
2018-03-22 15:16:33 -07:00
Wesley Wigham
a909000b62 Parse and check type arguments on JSX opening and self-closing tags (#22415)
* Parse and check type arguments on JSX opening like elements

* Fix nits
2018-03-22 15:07:36 -07:00
Wesley Wigham
a7b066fe04 Allow local class declarations to be returned as mixins (#22807) 2018-03-22 15:02:54 -07:00
Andy
94570eedcc Don't provide spelling suggestion for module (#22805) 2018-03-22 14:27:34 -07:00
Nathan Shively-Sanders
4462c159b1 Correctly track thisContainer for this-property-assignments in JS nested containers (#22779)
* Track thisContainer for this-property-assignments in JS

Previously it would update on every block, not just those that could
bind `this`.

In addition, if the constructor symbol still can't be found, then no
binding happens. This is usually OK because people don't add new
properties in methods too often.

* Update additional baselines

* Add lib:dom to new test

* Address PR comments

* Correct new name for saveThisParentContainer
2018-03-22 09:54:43 -07:00
Andy
f2f2393f4b convertFunctionToEs6Class: Copy comments from constructor to class (#22738) 2018-03-22 08:12:02 -07:00
Anders Hejlsberg
e5f6ed0b60 Merge pull request #22707 from Microsoft/fixIndexedAccessInConditionalType
Fix indexed access in conditional type
2018-03-21 15:18:39 -07:00
Nathan Shively-Sanders
de4a69cb72 In source files and blocks, bind function declarations before other statements (#22766)
* Add test case and temporarily disable inference

(Inference of class members from this-assignments inside a
prototype-assigned function.)

* Update baselines

* In blocks and source files, bind functions first

* Add tests from other bugs

* Remove temporary failsafe

* Update tests to restore intent and clean up errors

* Restore intent even better

* Restore intent even better x2

* Add missed baselines
2018-03-21 14:22:09 -07:00
Anders Hejlsberg
ee546fb30f Merge pull request #22764 from Microsoft/fixInferTypeDeclarationFiles
Fix missing 'infer T' in declaration files
2018-03-21 14:17:51 -07:00
Anders Hejlsberg
eb3fd150a7 Add regression test 2018-03-21 13:35:15 -07:00
Nathan Shively-Sanders
c930895d80 Undo 'any' inference propagation (#22736)
* Undo 'any' inference propagation

Removing this only changes one test slightly, and fixes JQuery types,
which rely on the old method of inference.

* Add jquery regression test and update baselines

* Restore any inference propagation to wildcard only
2018-03-21 11:13:39 -07:00
Anders Hejlsberg
4fef35cdd0 Add regression test 2018-03-21 10:03:48 -07:00
Anders Hejlsberg
fa8564fa9e Add test to verify errors on nested 'infer T' declarations 2018-03-21 10:03:07 -07:00