Commit graph

13480 commits

Author SHA1 Message Date
Andy ba53b42663 Clean up findChildIndex (#16984) 2017-07-07 10:15:04 -07:00
Andy ba8e5a7e24 Never return undefined from getExportsOfModule (#17013) 2017-07-07 10:06:12 -07:00
Andy d4c11bfa1b Clean up creation of 'args' in client.ts (#17009) 2017-07-07 08:09:59 -07:00
Andy e7dc2a67ca Enable "object-literal-shorthand" lint rule (#16987) 2017-07-07 07:26:58 -07:00
ikatyang a79240fbc6 Add missing docs for module: 'none' in tsc --init 2017-07-07 18:25:22 +08:00
Wesley Wigham 4b19eb3200 Remove duplicate entries from tsconfig files (#16991) 2017-07-06 15:56:34 -07:00
Wesley Wigham 07e8263204 Start using a union for FunctionLike things (#16988)
* Start using a union for FunctionLike things

* Rename to shorter name
2017-07-06 14:46:15 -07:00
Wesley Wigham 4e6b2f3c93 Created a branded type for identifier-escaped strings (#16915)
* Created a branded type for escaped strings

Then flowed it throughout the compiler, finding and fixing a handful of
bugs relating to underscore-prefixed identifiers in the process.
Includes a test for two cases noticed - diagnostics from conflicting
symbols from export *'s, and enum with underscore prefixed member emit.

* Correctly double underscores WRT mapped types

* Add fourslash tests for other fixed issues

* use function call over cast

* Update forEachEntry type accuracy

* Just use escaped names for ActiveLabel

* Remove casts from getPropertyNameForPropertyNameNode

* This pattern has occurred a few times, could use a helper function.

* Remove duplicated helper

* Remove unneeded check, use helper

* Identifiers list is no longer escaped strings

* Extract repeated string-getting code into helper

* Rename type and associated functions

* Make getName() return UnderscoreEscapedString, add getUnescapedName()

* Add list of internal symbol names to escaped string type to cut back on casting

* Remove outdated comments

* Reassign interned values to nodes, just in case

* Swap to string enum

* Add deprecated aliases to escapeIdentifier and unescapeIdentifier

* Add temp var

* Remove unsafe casts

* Rename escaped string type as per @sandersn's suggestion, fix string enum usages

* Reorganize double underscore tests

* Remove jfreeman from TODO

* Remove unneeded parenthesis
2017-07-06 14:45:50 -07:00
Arthur Ozga ad291d924d Merge pull request #16748 from aozgaa/implementOptionCrash
visit question token
2017-07-06 13:51:15 -07:00
Arthur Ozga dc08c5f241 Merge branch 'master' into caretPositionInFourslash 2017-07-06 10:44:59 -07:00
Arthur Ozga 86894f3a6f i++ 2017-07-05 14:26:59 -07:00
Arthur Ozga a200aa9329 non-default args 2017-07-05 12:54:42 -07:00
Arthur Ozga 2857bb9703 remove fixCaretPosition 2017-07-05 12:47:32 -07:00
Anders Hejlsberg f18a177c97 Merge branch 'master' into optimizeTypeRelations 2017-07-05 07:01:38 -10:00
Anders Hejlsberg 7b9f5b3b66 Merge branch 'master' into optimizeForEachChild 2017-07-05 06:52:49 -10:00
Arthur Ozga b5e069816d consolidate function call 2017-06-30 19:50:09 -07:00
Arthur Ozga 5652b0677e update caret position based on edit range 2017-06-30 19:40:56 -07:00
Ron Buckton 2a6aacd0ef Merge pull request #16696 from Microsoft/fix15663
Ignore jsdoc when inferring rest args in JavaScript
2017-06-30 14:27:55 -07:00
Nathan Shively-Sanders 9048c0ae47 Merge pull request #16844 from Microsoft/codefix-spelling-correction-for-typeparameters
Spelling code fix: suggestions from apparent type
2017-06-30 12:56:18 -07:00
Yui a7fe9db746 Merge pull request #16847 from Microsoft/master-RWC
[master] fix RWC runner
2017-06-30 12:08:23 -07:00
Kanchalai Tanglertsampan 67faecc32c remove BOM 2017-06-30 11:52:00 -07:00
Nathan Shively-Sanders e0bf267029 spelling:getPropertiesOfType instead of objectType
This provides suggestions for more types based on their apparent type:
unions, type parameters with constraints, primitives.
2017-06-30 10:11:00 -07:00
Arthur Ozga 4e6e1d1b8b Merge pull request #16657 from aozgaa/formatOnOpenCurly
Format on open curly
2017-06-30 10:04:57 -07:00
Nathan Shively-Sanders 2eec7f3565 Dedupe some utility code
1. convertToArray is a duplicate of arrayFrom
2. inferFromParameterTypes delegates immediately to inferFromTypes
3. One usage of arrayFrom instantiated a whole iterator only to take the
first element, which is the same as calling `next`.
2017-06-30 09:23:00 -07:00
Arthur Ozga 25abf8a9e8 respond ot comments 2017-06-29 17:31:41 -07:00
Kanchalai Tanglertsampan 2e13c3a7a6 Update RWC runner 2017-06-29 16:55:46 -07:00
Kanchalai Tanglertsampan 0ffbb75503 check error early and return null to indicate that everything is going well 2017-06-29 16:53:37 -07:00
Nathan Shively-Sanders b1af566396 Remove unused code in bindWorker 2017-06-29 16:30:44 -07:00
Nathan Shively-Sanders f45df8fb69 Spelling code fix:suggestions from apparent type
The code fix for spelling correction needs to provide suggestions based
on the apparent type since sometimes the type at a location will be a type
parameter. One such example is `this`.

Fixes #16744
2017-06-29 16:21:00 -07:00
Ryan Cavanaugh ec00bb9b72 Merge pull request #16697 from RyanCavanaugh/preserveMethodComments
Preserve method comments in JS->ES6 conversion.
2017-06-29 15:40:16 -07:00
Andrew Casey ac72803bb2 Merge pull request #16684 from amcasey/Vsts434619
Watch for the creation of missing files
2017-06-29 13:41:18 -07:00
Andrew Casey 569ecabb0a Address PR feedback
Make Program.getMissingFilePaths required

Assume getMissingFilePaths always returns a defined value

Make getMissingFilePaths internal

Replace nullable-bool with enum

Update type to reflect possibility of undefined

Use deepEqual to simplify tests

Make condition const

Don't bother cleaning up map before freeing it

Switch from foreach to for-of to simplify debugging

Use a Map, rather than a FileMap, to track open FileWatchers

Fix compilation errors

Introduce and consume arrayToSet

Fix lint warnings about misplaced braces

Delete incorrect comment

Delete from map during iteration

Eliminate unnecessary type annotations
2017-06-29 11:29:19 -07:00
Arthur Ozga 60b78c618f only format open curly up to the open curly 2017-06-29 11:13:44 -07:00
Andy 179a3e10b5 Handle depth in all readDirectory implementations (#16646) 2017-06-29 11:04:33 -07:00
Ryan Cavanaugh 8b7402f9f8 Merge pull request #16833 from ltearno/master
Comments incorrectly read 'TypeFlags' instead of 'ObjectFlags' at some places
2017-06-29 10:40:50 -07:00
Andrew Casey 0f683ac2ad Add missing file unit tests
1. Test `Program.getMissingFilePaths`
2. Test program structure reuse (i.e. that the appearance of a missing
file prevents complete reuse)
2017-06-29 10:39:32 -07:00
Andrew Casey 6d200bffbd Watch files through the host
Call `this.projectService.host.watchFile`, rather than
`ts.sys.watchFile` so that it gets mocked correctly in the unit tests.
Repair two failing tests.
2017-06-29 10:39:32 -07:00
Andrew Casey 4652fc491f Confirm method is defined before calling 2017-06-29 10:39:32 -07:00
Andrew Casey a39e969338 Clean up file watchers on project close 2017-06-29 10:39:31 -07:00
Andrew Casey 4863ada22c Track missing files
1. Expose missing files from the `Program`.
2. In `tsc --watch` and `tsserver`, add file watchers to missing files.
3. When missing files are created, schedule compilation (tsc) or refresh
the containing projects (tsserver).
2017-06-29 10:39:31 -07:00
Andrew Casey 587309d029 Update error case check
`getTouchingWord` indicates failure by returning the sourceFile node,
rather than `undefined`.
2017-06-29 10:39:30 -07:00
Andy 977525b37e getSymbolOfEntityNameOrPropertyAccessExpression: combine common code from PropertyAccessExpression and QualifiedName cases (#16827) 2017-06-29 10:07:08 -07:00
Andy d73b05cc63 Fix typo (#16826) 2017-06-29 10:06:35 -07:00
Arnaud Tournier 9ccf8ca6b0 Comments incorrectly read 'TypeFlags' instead of 'ObjectFlags' at some places 2017-06-29 17:54:34 +02:00
t_ 51fb7e9a81 Add alwaysStrict option (#16562)
* Add alwaysStrict option

* Enable alwaysStrict

* Fix for strict mode

* keep whitespace
2017-06-28 19:44:15 -07:00
Daniel Rosenwasser 22f38b720c Merge pull request #16704 from charlespierce/namespace_export_default
Diagnostics for default class / function export in namespace
2017-06-28 17:10:45 -07:00
Andy c4319e3b94 Clean up uses of ensureScriptKind (#16714)
* Clean up uses of ensureScriptKind

* Remove unneeded parentheses
2017-06-28 14:29:16 -07:00
Arthur Ozga 39b7965c0d respond to comment 2017-06-28 13:41:52 -07:00
Andy 2ccfe502f7 Fix scope of @typedef references (#16718)
* Fix scope of @typedef references

* Remove unused variables
2017-06-28 13:30:23 -07:00
Andy 9013665e22 Replace FileMap with Map where there is no keyMapper (#16724)
* Replace FileMap with Map where there is no keyMapper

* Remove `toKey` and use `keyMapper` directly
2017-06-28 13:15:34 -07:00
Arthur Ozga eae234cab2 disable spaceBeforeOpenCurly if newline rule is enabled 2017-06-28 13:13:53 -07:00
Andy 9260a399a3 Remove duplicate switch cases (#16721) 2017-06-28 12:53:43 -07:00
Andy 42e08f5578 findAllRefs: Find string references inside of template strings (#16723) 2017-06-28 12:53:12 -07:00
Arthur Ozga a5c8a29fa4 only format opencurly if no intervening tokens 2017-06-28 12:48:14 -07:00
Nathan Shively-Sanders c51c2aecca Merge pull request #16736 from DickvdBrink/issue/15208
Also check TypeAlias for unused type parameters
2017-06-28 12:37:04 -07:00
Nathan Shively-Sanders cf0fe925fa Merge pull request #16734 from HerringtonDarkholme/error
fix #16702: polish type predicate error message
2017-06-28 12:33:45 -07:00
Nathan Shively-Sanders 2f5ecf00a1 Merge pull request #16698 from Microsoft/master-16017
[Master]  Fix 16017 - ordering of promise all method
2017-06-28 10:46:53 -07:00
Andy 18357543c6 Provide better services for incomplete generic calls (#16535)
* Provide better services for incomplete generic calls

* Use clearer name

* Remove `inferredAnyDefaultTypeArgument` and `getBestGuessSignature`; have `resolveSignature` always get the best signature if !produceDiagnostics

* Update names and comments
2017-06-27 09:14:23 -07:00
Arthur Ozga 45a77c0a2c visit question token 2017-06-26 12:33:29 -07:00
Arthur Ozga c5f6c4fac0 remove unecessary check 2017-06-26 11:21:21 -07:00
Andy aeb5264b74 Consistently use variable mangledScopedPackageSeparator instead of magic "__" string (#16713) 2017-06-26 11:10:57 -07:00
Arthur Ozga 61af315778 respond to comments 2017-06-26 10:55:04 -07:00
Ryan Cavanaugh b52747e12c Add property comments as well 2017-06-26 10:54:18 -07:00
Herrington Darkholme 962aee93cd fix #16702: polish type predicate error message 2017-06-26 13:32:29 +08:00
Anders Hejlsberg 24a6a087f5 Add early bail out for token nodes 2017-06-23 08:31:48 -10:00
Andy fd22a88abc Code cleanup in jsTyping.ts (#16632) 2017-06-23 10:03:01 -07:00
Charles Pierce 8418d67ebb Fix missed lint error 2017-06-22 21:01:05 -07:00
Charles Pierce 386454a255 #16300 #16301 Diagnostics for default export in namespace 2017-06-22 20:20:41 -07:00
Nathan Shively-Sanders 6a111928b4 Merge pull request #16375 from Microsoft/skip-block-scope-for-global-symbol
Skip block scope check for global symbol
2017-06-22 15:29:35 -07:00
Anders Hejlsberg fd1e5ab6ed Simplify forEachChild 2017-06-22 08:55:18 -10:00
Kanchalai Tanglertsampan feefd520b6 Reorder promise.all signatures 2017-06-22 11:51:00 -07:00
Ryan Cavanaugh 04d750f9f8 Preserve method comments in JS->ES6 conversion. Fixes #16622 2017-06-22 11:45:34 -07:00
Yui 3ade89ca0e Merge pull request #16178 from Microsoft/master-fix13306
[Master] Fix #13306 recognize @type on property assignment
2017-06-22 11:25:22 -07:00
Arthur Ozga 485927b26a clarify comment 2017-06-22 11:17:55 -07:00
Ron Buckton 8d9e66badd Ignore jsdoc when inferring rest args in JavaScript 2017-06-22 10:49:47 -07:00
Andrew Casey aac7fb7cef Merge pull request #16664 from amcasey/TokenWorker
Short-circuit getTokenAtPositionWorker
2017-06-22 10:44:47 -07:00
Dick van den Brink 09be537786 Also check TypeAlias for unused type parameters
Fixes #15208
2017-06-22 16:41:40 +02:00
Anders Hejlsberg 68cd4e55d5 Merge branch 'master' into optimizeTypeRelations 2017-06-20 16:03:07 -10:00
Andrew Casey 2690d792c1 Short-circuit getTokenAtPositionWorker
The children of a given node are sorted by start position so, if one of
them starts after a given position, all subsequent children all start
after that position.
2017-06-20 15:32:32 -07:00
Oleg Mihailik b60f936b14 Enquote undefineds. 2017-06-20 22:54:50 +01:00
Anders Hejlsberg 21732eb56f More efficient recording of intermediate results in type relations 2017-06-20 11:38:09 -10:00
Andy 4ef4882b42 hasProperty doesn't need to be generic (#16650) 2017-06-20 12:13:05 -07:00
Arthur Ozga 0df66a5e6d format space before single-line blocks 2017-06-20 11:52:03 -07:00
Arthur Ozga 4c40c42f56 format on open curly 2017-06-20 11:51:45 -07:00
Yui 47c1563649 Merge pull request #16544 from Microsoft/master-fixIncrementalParsingWithDynamicImport
[Master] wip - fix incremental parsing with dynamic import
2017-06-19 16:44:47 -07:00
Andy 4313ecf758 Use custom error message in Debug.fail (#16625) 2017-06-19 15:26:26 -07:00
Alex Eagle 0123bd0e20 Add missing newline in --pretty diagnostics formatter
It was compensated in tsc.ts, but then other compilers are missing a newline.
2017-06-17 09:20:55 -07:00
Sheetal Nandi a2776648cd Merge pull request #16539 from Microsoft/updateBuilderOnlyIfItHasInfos
Update the builder dependency graph only if it was created.
2017-06-16 13:46:54 -07:00
Sheetal Nandi 31653de3c3 Merge pull request #16566 from Microsoft/keywordFilters
Fix the completion for parameters
2017-06-15 15:44:33 -07:00
Sheetal Nandi 4b3e661aaa Merge pull request #12336 from Microsoft/ownJsonParsing
Use parser to parse tsconfig json instead of using Json.parse
2017-06-15 14:30:42 -07:00
Sheetal Nandi 4ce8af3652 Show public/private/protected/readonly when looking for constructor parameter and otherwise parameter declaration or property declaraiton should result in no completion
Fixes #15937
2017-06-15 11:16:35 -07:00
Andy 537695c313 In TypeScript code, never bind JSDoc normally, just set parent pointers (#16555) 2017-06-15 10:02:16 -07:00
Sheetal Nandi 09f0b3471a Merge branch 'master' into ownJsonParsing 2017-06-15 09:59:37 -07:00
t_ 675e7f00c3 Allow running in strict mode (#16557)
`arguments` can't be assigned in strict mode
2017-06-15 09:47:59 -07:00
Daniel Rosenwasser 5b12a04965 Merge pull request #16213 from charlespierce/await_yield_literals
Update special cases for await / yield expression parsing
2017-06-15 00:39:57 -07:00
Yui T a92b549336 Set the structureReused to be safemoudles when dynamic import change 2017-06-14 21:50:12 -07:00
Yui T 1636fbc966 Wip-fix incremental parsing 2017-06-14 17:13:35 -07:00
Sheetal Nandi b2e8fb7f32 Update the builder dependency graph only if it was created.
This makes sure that we dont create this graph just because project was updated
2017-06-14 16:20:44 -07:00
Nathan Shively-Sanders 26ab0cd138 Merge pull request #16530 from Microsoft/excess-property-check-error-span-for-spread-property
Improve excess property check error span for spread property
2017-06-14 16:16:20 -07:00
Sheetal Nandi 187febd10f Merge pull request #16494 from Microsoft/dontCreateScriptInfosWithFileExistsAndReadFile
Fixes the memory leak because of project and its corresponding script info even after project is removed
2017-06-14 15:17:25 -07:00
Nathan Shively-Sanders ef70a6c61b Add comment to new code in hasExcessProperties 2017-06-14 15:13:46 -07:00
Sheetal Nandi 428bc68baa Add comment for deletion of orphan script infos in file open 2017-06-14 15:02:24 -07:00
Mohamed Hegazy a3f39ece62 Fix #16521: mark thisArg as optional in typed array map function (#16526) 2017-06-14 11:58:21 -07:00
Nathan Shively-Sanders d719de5928 Use first declaration, not valueDeclaration
valueDeclaration is frequently not set
2017-06-14 11:43:51 -07:00
Sheetal Nandi 98cb0ce815 Move the cleanup of script infos to next file open
This helps in reusing script infos even if the project is closed but next open recreates the same project
2017-06-14 11:37:31 -07:00
Nathan Shively-Sanders 8680768478 Improve excess property check for spread property
Fall back to the assignment's declaration; don't use the property's
valueDeclaration because that is not useful when the property comes from
a spread. The fallback now happens when the property's valueDeclaration
does not have the object literal's valueDeclaration as an ancestor.
2017-06-14 11:26:15 -07:00
Nathan Shively-Sanders 657c469d4f Remove undefined from optional spread properties
Fixes #16509 by making the change from #15938 less strict. This is
technically a hole, but it's not as big a hole as before #15938.
2017-06-14 10:31:11 -07:00
Ron Buckton fbe002a595 Merge pull request #16502 from Microsoft/fix16211
Fix 'extends' with type parameter default returned from superclass construct signature
2017-06-13 19:30:27 -07:00
Ron Buckton 73d63ec98c Switch to sameMap 2017-06-13 18:02:39 -07:00
Mohamed Hegazy 3532875af7 Merge branch 'master' into completionWithMeaning 2017-06-13 17:41:24 -07:00
TravCav 9611e58670 combined logic in parseParameterOrPropertyTag (#16481) 2017-06-13 16:30:36 -07:00
Kanchalai Tanglertsampan 3062d36463 Add "undefined" as return type 2017-06-13 15:20:52 -07:00
Nathan Shively-Sanders 57f8648b0f Merge pull request #16505 from Microsoft/decl-emit-parenthesize-keyof
Add parentheses around keyof in declaration emit when needed
2017-06-13 14:17:49 -07:00
Kanchalai Tanglertsampan d392f1edab Remove unnecessary get type from JSDoc comment 2017-06-13 14:09:16 -07:00
Nathan Shively-Sanders 43d47de74d Add parentheses around keyof in declaration emit
When needed. Use InElementType flag to determine this.
2017-06-13 13:59:38 -07:00
Ron Buckton 6370fc8b85 Fix class extends+decorator with new class emit 2017-06-13 13:35:53 -07:00
Nathan Shively-Sanders 9f69cd5a62 Merge pull request #16497 from Microsoft/use-checker-for-decl-emit-of-optional-param-props
Use checker for declaration emit of optional, uninitialised parameter properties
2017-06-13 13:21:35 -07:00
Ron Buckton 696643998a Fix constructor instantiation with defaults 2017-06-13 13:19:54 -07:00
Ron Buckton 742836938b Fix grammar check for empty type argument list and compiler crash 2017-06-13 12:19:49 -07:00
Nathan Shively-Sanders 433a06d599 Add isOptionalUninitializedParameterProperty
Improves declaration emit and code readability
2017-06-13 11:49:58 -07:00
Anders Hejlsberg 31f0814d4a Simplify generic function call error reporting (#16439)
* Simplify error reporting for generic functions

* Accept new baselines

* Fix fourslash tests
2017-06-13 11:43:13 -07:00
Kanchalai Tanglertsampan 7dae8f73dd Merge branch 'master' into master-fix13306 2017-06-13 11:41:48 -07:00
Nathan Shively-Sanders 2a921d4b33 Use checker for decl emit:optional parameter props
Optional parameter properties create a property with a type that unions
with undefined when strictNullChecks is on. This needs to be reflected
in the generated declaration.
2017-06-13 11:31:51 -07:00
Arthur Ozga 9cd04e06fd Merge pull request #16309 from aozgaa/codeFixPrefixUnused2
Code fix prefix unused2
2017-06-13 11:16:33 -07:00
Sheetal Nandi 1f167786ad Merge branch 'master' into completionWithMeaning 2017-06-13 11:16:32 -07:00
Nathan Shively-Sanders 2495e6780b Merge pull request #16488 from Microsoft/add-jsdoc-to-eof-token
Add jsdoc to EOF token to catch missed `@typedef`s
2017-06-13 11:14:52 -07:00
Arthur Ozga 2a05bb1441 Merge pull request #16433 from Microsoft/suppressBraceCompletionOfQuotesinComments
Suppress brace completion of Quotes in Comments
2017-06-13 11:07:52 -07:00
Nathan Shively-Sanders 6d3e15f0ee Add JSDoc to EOF token to catch missed @typedefs 2017-06-13 10:32:25 -07:00
Yui 23f618b6bc Merge pull request #16406 from Microsoft/master-fix16402
[Master] Language Service on Dynamic import
2017-06-13 10:22:45 -07:00
Kanchalai Tanglertsampan da52bad4b8 Address PR 2017-06-13 10:03:43 -07:00
Mohamed Hegazy 1d0087dd2d Update version 2017-06-12 18:28:10 -07:00
Sheetal Nandi 1bf1209f7e Cleanup script infos that are not part of any project when the project is closed or inferred projects are refreshed
Also dispose some pointers so that the closures get disposed with project and script infos
2017-06-12 16:52:36 -07:00
Nathan Shively-Sanders 3d8cf62846 Merge pull request #16463 from Microsoft/jsdoc-@template-in-scope-as-type-parameter
Jsdoc @template in scope as type parameter
2017-06-12 16:07:49 -07:00
Arthur Ozga 70bace78a0 respond to comments 2017-06-12 15:36:34 -07:00
Nathan Shively-Sanders ecc211345a Merge pull request #16465 from Microsoft/skip-non-null-assertion-for-reference-expr
Skip non-null assertion for references
2017-06-12 15:33:36 -07:00
Andy 6a8a6c34b4 getPossibleSymbolReferencePositions: Always use full start (#16420) 2017-06-12 15:24:31 -07:00
Andy 8b55675cb4 Simplify isDeclarationNameOrImportPropertyName (#16421) 2017-06-12 15:23:45 -07:00
Nathan Shively-Sanders 93bdd3cb39 Fix reference to isTypeParameterDeclaration in services
Fixes build break
2017-06-12 15:07:04 -07:00
Nathan Shively-Sanders 55beb14bca Checking references skips assertions+parentheses 2017-06-12 14:40:01 -07:00
Andy fbcddb61e2 Don't bind JSDoc namespace in a TS file (#16416) 2017-06-12 14:35:35 -07:00
Andy 050126c1b6 Rename isTypeParameter to isTypeParameterDeclaration (#16422) 2017-06-12 14:31:01 -07:00
Nathan Shively-Sanders 024ab094b3 Update jsdoc of new function 2017-06-12 14:27:43 -07:00
Nathan Shively-Sanders abc9e687ac Consolidate getting type parameter declarations
Create getEffectiveTypeParameterDeclarations in utilities.ts
2017-06-12 14:23:47 -07:00
Nathan Shively-Sanders eda7978dd1 Cleanup getTypeParametersFromDeclaration et al 2017-06-12 14:06:46 -07:00
Anders Hejlsberg dde60bb624 Merge pull request #16368 from Microsoft/stricterGenericChecks
Stricter generic signature checks
2017-06-12 13:56:21 -07:00
Nathan Shively-Sanders 1b585dd503 Type params introduced by @template are in scope
The test to make sure that type parameters are in scope for
instantiation previously ignored type parameters created by `@template`.
Now it correctly says that they are in scope.
2017-06-12 13:55:07 -07:00
Anders Hejlsberg dc28aaa132 Add --noStrictGenericChecks compiler option 2017-06-12 13:09:01 -07:00
Andy 7fb821e45b Support completions in destructuring in for-of (#16454) 2017-06-12 12:12:51 -07:00
Andy 2748b3b334 Add isForInOrOfStatement utility (#16455) 2017-06-12 11:08:41 -07:00
Andy 44d5c44cb5 Document highlights for a JSX tag should just be the matching tag, not all references (#16453) 2017-06-12 11:08:21 -07:00
Anders Hejlsberg f81925992c Intersection with 'never' type always produces 'never' 2017-06-11 14:54:36 -07:00
Mohamed Hegazy a404edae38 Split import into var and type to avoid breaking backword compatability of tsserverlibrary (#16409) 2017-06-10 11:12:09 -07:00
Arthur Ozga 798db1e884 Suppress brace completion of Quotes in Comments 2017-06-09 21:10:01 -07:00
Andy 09321b3834 Convert Extension to a string enum (#16425) 2017-06-09 19:32:44 -07:00
Sheetal Nandi 2ec92b9c02 Dont create script snapshots for files that arent source files 2017-06-09 18:30:17 -07:00
Anders Hejlsberg d27f4d4f15 Fix comments 2017-06-09 15:39:24 -07:00
Anders Hejlsberg 76093c24cd Merge branch 'master' into stricterGenericChecks
# Conflicts:
#	src/compiler/checker.ts
2017-06-09 15:35:37 -07:00
Andy 13b7d17da7 Don't bind JSDoc type parameter in a TS file (#16413)
* Don't bind JSDoc type parameter in a TS file

* Fix tests

* Remove unnecessary non-null assertions
2017-06-09 14:52:01 -07:00
Andy a757e84284 Add hash of project file location to project info telemetry (#16397)
* Add hash of project file location to project info telemetry

* Rename to projectId
2017-06-09 13:12:31 -07:00
Mine Starks 7796e3775a Merge pull request #16374 from minestarks/typingcacheversion
Set typings cache location per TS version
2017-06-09 10:07:29 -07:00
Kanchalai Tanglertsampan 2e55b6ae16 Implement LS on string-literal of dynamic import 2017-06-09 10:01:17 -07:00
Andy a2d524252c --isolatedModules: Still allow re-export of type in a declaration file (#16399)
* --isolatedModules: Still allow re-export of type in a declaration file

* Use isInAmbientContext
2017-06-09 09:39:55 -07:00
Nathan Shively-Sanders cae1286b72 Merge pull request #16343 from Microsoft/weak-types-for-primitives
Weak type errors for primitives
2017-06-09 09:03:48 -07:00
Ron Buckton eadafd20eb Merge pull request #16346 from Microsoft/fix15618
Improve contextual types using jsdoc tags
2017-06-09 00:11:47 -07:00
Daniel Rosenwasser 025fa87b8c Merge pull request #16382 from Microsoft/ContainsMaster
[Master] Rename & internalize PossiblyContainsDynamicImport
2017-06-08 23:57:01 -07:00
Arthur Ozga b9885eed5a Only add underscore in
* for-in
* for-of
* parameters
2017-06-08 18:43:02 -07:00
Andy 0d36d0e39f Support completions for qualified names in JSDoc (#16380)
* Support completions for qualified names in JSDoc

* Fix typo
2017-06-08 17:21:36 -07:00
Ron Buckton ff1f33729b Improve contextual types and return type checking 2017-06-08 16:44:42 -07:00
Daniel Rosenwasser af41c28ba9 Fixed up comments. 2017-06-08 16:00:39 -07:00
Daniel Rosenwasser 86e54ac787 Correct pluralization of 'Contain' to 'Contains', made the nodeflag internal. 2017-06-08 16:00:38 -07:00
Nathan Shively-Sanders ffc899ed38 Merge pull request #16377 from Microsoft/fix-synthetic-properties-in-hasExcessProperties
Fix synthetic properties in hasExcessProperties
2017-06-08 15:49:51 -07:00
Yui 9d30ab6ac9 Merge pull request #16378 from Microsoft/master-PortChange
[Master] port change from release-2.4 to master
2017-06-08 15:05:43 -07:00
Ron Buckton fe62f5f3ff Merge pull request #16376 from Microsoft/fix14506
Fix source map for variables in ES5/3 async funcs and generators
2017-06-08 14:34:47 -07:00
Kanchalai Tanglertsampan 7d2d35d0bf Include dynamic import during pre-processing needed by VS 2017-06-08 14:31:44 -07:00
Ron Buckton 9e985c9619 Merge branch 'master' into fix15618 2017-06-08 14:31:14 -07:00
Kanchalai Tanglertsampan 7121891921 Remove unneccessary debug.fail as by defualt we will add commonJS module transformation step 2017-06-08 14:31:11 -07:00
Kanchalai Tanglertsampan 58aa0f3f76 Copy PossiblyContainDynamicImport from old source file to new one 2017-06-08 14:30:56 -07:00
Ron Buckton b325790270 Merge pull request #16310 from Microsoft/enableDebugInfo
Enable debug info when running tests
2017-06-08 14:28:59 -07:00
Ron Buckton ef86f7da50 Adjust source map offsets for variables in downlevel async funcs and generators 2017-06-08 14:15:40 -07:00
Nathan Shively-Sanders 70069aeb31 hasExcessProperty only uses valueDeclaration if available
Previously it would crash if valueDeclaration was not set
2017-06-08 14:15:24 -07:00
Nathan Shively-Sanders cc87e29e13 Skip block scope check with no error location
An example of a symbol with no error location is a global symbol like
Promise.
2017-06-08 13:45:21 -07:00
Mine Starks 3bd5df7577 Set typings cache location per TS version 2017-06-08 13:33:24 -07:00
Ron Buckton 80a7716117 PR Feedback 2017-06-08 11:27:35 -07:00
Anders Hejlsberg 6da961078c Merge branch 'master' into stricterGenericChecks 2017-06-08 11:26:22 -07:00
Anders Hejlsberg ff83327f30 Remove convoluted code that attempts to re-fix type parameters 2017-06-08 11:23:04 -07:00
Nathan Shively-Sanders 2eea0989ea Merge branch 'master' into delay-signature-return-type-instantiation 2017-06-08 09:42:50 -07:00
Nathan Shively-Sanders 7797b1ddba Always use getPropertyOfObjectType in isKnownProperty
It doesn't make sense to say that 'toString' is part of a weak type
since having 'toString' would mean that the type isn't actually weak.
2017-06-08 09:01:40 -07:00
Mohamed Hegazy c8d33bc38e Update generated files 2017-06-07 22:17:40 -07:00
Ron Buckton 0760439a16 Merge pull request #16316 from Microsoft/fix14056
Better types from jsdoc type references
2017-06-07 17:30:33 -07:00
Ron Buckton 6bbacb64ce Improve contextual types using jsdoc tags 2017-06-07 17:14:27 -07:00
Nathan Shively-Sanders efa490eb16 Detect weak type errors with primitive sources 2017-06-07 16:20:39 -07:00
Ron Buckton 595a815b94 Merge branch 'master' into fix15651 2017-06-07 15:51:35 -07:00
Andy 43e3d60f09 Fix lint failure (#16338)
* Fix lint failure

* Use curly braces
2017-06-07 15:50:26 -07:00
Ron Buckton 00a926cc4e Fix parameter emit for synthetic function types 2017-06-07 15:34:10 -07:00
Nathan Shively-Sanders 40dd8ba18f Merge pull request #16330 from Microsoft/fix-js-infer-rest-args
Fix JS-inferred rest parameters
2017-06-07 14:44:02 -07:00
Anders Hejlsberg 872e916019 Infer generic type for lambda with generic contextual signature 2017-06-07 14:25:36 -07:00
Ron Buckton d3d9175841 PR Feedback 2017-06-07 14:13:30 -07:00
Ron Buckton d450b8b2ab Merge pull request #13272 from Microsoft/externalExportStar
Support for an external exportStar helper
2017-06-07 13:59:54 -07:00
Nathan Shively-Sanders 10beac2c1c Delay instantiation of signature return type
`getReturnTypeOfSignature` correctly handles an un-instantiated
signature, but `instantiateSignature` used to eagerly instantiate the
return type. This caused an infinite recursion in #16233.

Now `instantiateSignature` doesn't instantiate the return type, but
relies on `getReturnTypeOfSignature` to do it.
2017-06-07 12:58:36 -07:00
Andy abb9681248 Support completions for JSDoc @param tag names (#16299)
* Support completions for JSDoc @param tag names

* Undo change to finishNode

* Don't include trailing whitespace in @param range; instead, specialize getJsDocTagAtPosition
2017-06-07 12:28:52 -07:00
TravCav b57830f7f9 enforcing curly braces (#16315) 2017-06-07 11:58:25 -07:00
Nathan Shively-Sanders 4e927bdbd4 Create js-inferred rest params in getSignatureOfDeclaration
Previously they were created too late, in resolveCall, via mutation.
The mutation of the signature caused bug #16139 because recursion
detection in type checking didn't work.
2017-06-07 11:24:19 -07:00
Andy 68122ea4cc Support find-all-references for export = of class expression (#16327)
* Support find-all-references for `export =` of class expression

* Add comments
2017-06-07 11:16:12 -07:00
Ron Buckton 7304a738a0 Fix typo in getTypeReferenceType 2017-06-07 10:58:51 -07:00
Ron Buckton 9250d0a290 Merge branch 'master' into externalExportStar 2017-06-07 10:53:42 -07:00
Andrew Casey 747d01c59a Merge pull request #16311 from amcasey/mtime
Reuse already-computed modification time
2017-06-07 10:09:25 -07:00
Ryan Cavanaugh 6007eb7dfb Merge pull request #16307 from RyanCavanaugh/refactor_refactor
Refactor refactor
2017-06-06 22:28:52 -07:00
Ron Buckton 9f9e20c5a3 Limit getTypeReferenceType to two passes 2017-06-06 18:25:55 -07:00
Ron Buckton 471e680ef0 Better types from jsdoc param tags 2017-06-06 18:10:00 -07:00
Ron Buckton b217c39bb1 Merge pull request #15935 from chuckjaz/external-file-source-map
Add support for external file references in source maps
2017-06-06 18:06:06 -07:00
Anders Hejlsberg 50b24ee884 Merge branch 'master' into stricterGenericChecks 2017-06-06 17:53:25 -07:00
Anders Hejlsberg 588880487c Merge pull request #16305 from Microsoft/contextualGenericTypes
Contextual generic function types
2017-06-06 17:49:51 -07:00
Chuck Jazdzewski ce1d1c81ef Add support for external file references in source maps 2017-06-06 17:45:08 -07:00
Andrew Casey e3c4a7031d Reuse already-computed modification time 2017-06-06 16:35:11 -07:00
Ron Buckton 2f6c6e6538 Merge branch 'master' into fix16086 2017-06-06 16:09:37 -07:00
Ryan Cavanaugh f739f68231 Tidy up 2017-06-06 16:08:24 -07:00
Ryan Cavanaugh f395bc1d83 Handle missing body case 2017-06-06 16:01:53 -07:00
Ron Buckton 4c65be8bad Enable debug info when running tests 2017-06-06 16:01:52 -07:00
Arthur Ozga ce5f7072a1 prefix identifiers 2017-06-06 15:23:10 -07:00
Ron Buckton 70c1c57493 Merge pull request #16196 from Microsoft/fix15959
Allow JS constructor function to return non-void
2017-06-06 15:16:58 -07:00
Nathan Shively-Sanders 617f60e3f0 Merge pull request #16306 from Microsoft/fix-nullable-filtering-in-spreads
Fix nullable filtering in spreads
2017-06-06 15:00:48 -07:00
Ryan Cavanaugh 1f3ef7df7a Refactor refactor 2017-06-06 14:58:18 -07:00
Anders Hejlsberg 98a5c9b73f Merge branch 'master' into contextualGenericTypes 2017-06-06 14:57:20 -07:00
Ron Buckton 6e87078540 Added tests and improve type of new expression 2017-06-06 14:48:40 -07:00
Anders Hejlsberg 1143489417 Ignore nullability in contextual signature instantiation 2017-06-06 14:44:44 -07:00
Nathan Shively-Sanders 93465bdae2 Filter nullables after lifting union over spread
Previously, null/undefined were removed upfront, which is incorrect. Now
nullable types are removed with other non-primitives after union is
lifted over spread. This produces unions, which are larger, but more correct.
2017-06-06 14:11:01 -07:00
Ron Buckton 8cb5333791 Verify JS function is constructor 2017-06-06 13:33:19 -07:00
Ron Buckton 08e71641bf Merge branch 'master' into fix15959 2017-06-06 13:30:55 -07:00
Arthur Ozga f17a612de8 rename codeFix 2017-06-06 13:13:46 -07:00
Anders Hejlsberg 0f6f857702 Allow contextual signature to be generic 2017-06-06 11:38:50 -07:00
Sheetal Nandi 65a48ca15d Encorporting feedback 2017-06-06 11:27:31 -07:00
Sheetal Nandi 48189c883f Merge branch 'master' into ownJsonParsing 2017-06-06 11:03:21 -07:00
Mine Starks 52e867c86e Merge pull request #16277 from minestarks/safelistpackagenames
discoverTypings should look at typingSafelist.json values
2017-06-06 10:21:23 -07:00
Herrington Darkholme 0600a27dd9 fix #15447: object is empty object type (#16290) 2017-06-06 10:08:33 -07:00
Anders Hejlsberg 368e5af162 Stricter type relationship checking of generic signatures 2017-06-06 09:49:50 -07:00
Yui a6e1cedfd7 Merge pull request #16281 from Microsoft/master-MergeDynamicImport
[Master] Remerge this back to master after fixing test failure
2017-06-05 18:55:24 -07:00
Ron Buckton b5f81f9ede Fix emit when type import merges with local value 2017-06-05 18:39:32 -07:00
Andy cbdf02f47c Undo change and go back to making a copy of leadingComments and trailingComments (#16273) 2017-06-05 18:07:55 -07:00
Ron Buckton d9ec08ceaf Merge pull request #16279 from Microsoft/fix15928
Fix for..await emit for es2017
2017-06-05 18:03:09 -07:00
Mine Starks ba04dc8860 Add typingsInstaller unit test 2017-06-05 17:45:07 -07:00
Yui T fe4fec5220 Fix breaking tests 2017-06-05 17:23:33 -07:00
Yui T b9017795a0 Revert "Revert "[Master] wip-dynamic import" (#16264)"
This reverts commit ccc60c8b3b.
2017-06-05 17:16:29 -07:00
Sheetal Nandi c4ad151a46 Merge branch 'master' into ownJsonParsing 2017-06-05 17:01:09 -07:00
Ron Buckton a05a53b2a2 Fix for..await emit for es2017 2017-06-05 16:57:50 -07:00
Arthur Ozga c179d9a22d Merge pull request #16045 from aozgaa/codeFixAddMissingMethod
Code fix add missing method
2017-06-05 16:50:46 -07:00
Ryan Cavanaugh 1f3c2b3998 JSX Closing tags get priority over other completion types (#15922)
Fixes #15897
2017-06-05 16:19:32 -07:00
Nathan Shively-Sanders 8f4af49ccd Merge pull request #16194 from Microsoft/fix-reexported-missing-alias
Fix reexported missing alias
2017-06-05 16:04:26 -07:00
Nathan Shively-Sanders bb54a6a53e Typeof can refer to a class in a previous file with --out (#16269)
* Typeof can refer block-scoped values in prev file

`typeof C` can now refer to block-scoped values in a preceding file when
used with --out or --outFile. Previously this was not allowed with --out
or --outFile since they depend on file order for their emit.

* Test `typeof C` reference across files with --out
2017-06-05 15:57:32 -07:00
Mine Starks ddb9774de7 discoverTypings should look at typingSafelist.json values 2017-06-05 15:52:19 -07:00
Andy 8ace7b826f importFixes: Support missing "React" at a JSXOpeningElement (#16066)
* importFixes: Support missing "React" at a JSXOpeningElement

* Fix nextLineRule linting

* Rename to resolveJsxNamespaceAtLocation

* Expose getJsxNamespace and resolveNameAtLocation separately
2017-06-05 14:23:39 -07:00