Commit graph

10886 commits

Author SHA1 Message Date
Nathan Shively-Sanders 6e1aac1c42 Merge pull request #12147 from mylesmegyesi/12050-IncompatableAssignementOfIdenticallyNamedTypes
Adds error message for incompatible assignment of identically named type
2016-11-10 13:17:31 -08:00
Nathan Shively-Sanders 973d83ce93 Merge branch 'master' into fix-jsdoc-missing-space-from-bad-indent 2016-11-10 13:12:32 -08:00
Nathan Shively-Sanders 8bd0a47c82 Retain space after first word in multiline jsdoc
For words that were shorter than the jsdoc indent level, the space was
omitted previously.
2016-11-10 13:11:32 -08:00
Cotton Hou 9a8e1bf8a6 Add ES2017 string padding (#12152)
* add es2017.string.d.ts for String.prototype.{padStart,padEnd}

* append es2017.string.d.ts into es2017.d.ts

* add es2017.string into commandLineParser

* append es2017.string into error message for unit tests of commandLineParser

* append es2017.string into Gulpfile

* append es2017.string into Jakefile
2016-11-10 12:43:51 -08:00
Nathan Shively-Sanders 205ce3247f Merge pull request #12154 from Microsoft/import-helpers-reports-errors-for-__rest
Import helpers reports errors for __rest
2016-11-10 12:29:39 -08:00
Vladimir Matveev 3ecb60146b synthesize complete import declaration for tslib (#12151) 2016-11-10 11:57:37 -08:00
Nathan Shively-Sanders d6bf27d6b6 Correctly check spread assignments in strict mode
Previously it crashed in the binder.
2016-11-10 11:46:10 -08:00
Nathan Shively-Sanders 0d4ac01574 Report errors for import helpers missing __rest 2016-11-10 11:45:56 -08:00
Anders Hejlsberg 64d269885c Merge branch 'master' into mappedTypes
# Conflicts:
#	src/compiler/checker.ts
2016-11-10 11:17:53 -08:00
Anders Hejlsberg aca1ab3bfe Check mapped type constraint is assignable to string | number 2016-11-10 10:41:17 -08:00
Sheetal Nandi c87bce1119 Merge pull request #11978 from Microsoft/errorReportingInJsFile
Report all the js file errors and skip only the nodes that are not allowed in JS file
2016-11-10 10:37:16 -08:00
Anders Hejlsberg b81c226639 Use pull model to obtain type alias information for type nodes 2016-11-10 10:31:24 -08:00
Sheetal Nandi c458576553 Merge pull request #12135 from Microsoft/jsxFactory
Support for --jsxFactory option
2016-11-10 09:49:57 -08:00
Sheetal Nandi 2eba10a25b Updated condition for more readability 2016-11-10 09:40:50 -08:00
Myles Megyesi c05e226c4b
Adds error message for incompatible assignment of identically named type
Fixes issue #12050
2016-11-10 11:32:03 -06:00
Nathan Shively-Sanders be5e5fb872 Merge pull request #11150 from Microsoft/object-spread
Object spread/rest
2016-11-10 09:28:58 -08:00
Nathan Shively-Sanders 6398e0d6dd Merge pull request #11633 from Microsoft/fix-comparable-in-switch
Fix comparable in switch
2016-11-10 09:20:46 -08:00
Nathan Shively-Sanders 25462c9571 Merge pull request #12028 from Microsoft/object-rest
Object rest
2016-11-10 09:18:13 -08:00
Anders Hejlsberg 2170ff6f16 Defer resolution of mapped types to enable recursive definitions 2016-11-10 09:11:21 -08:00
Sheetal Nandi dd7f00f20b Parse the jsxFactory again in the checker instead of using cached value in the program 2016-11-10 08:54:13 -08:00
Sheetal Nandi 35e4c459f5 Transpile unit test case 2016-11-09 16:50:40 -08:00
Sheetal Nandi 3d6950d023 When emitting use jsx factory entity expression if provided 2016-11-09 16:40:11 -08:00
Sheetal Nandi 06affa6672 Resolve first identifier of the jsxFactory as part of type check 2016-11-09 15:35:54 -08:00
Sheetal Nandi f7bac98948 Verify that jsxFactory is either identifier or qualified name 2016-11-09 14:32:42 -08:00
Nathan Shively-Sanders fcf32c444f Treat | undefined like optionality in spread type 2016-11-09 13:39:42 -08:00
Sheetal Nandi 4b8a55793a Add support for taking in jsxFactory option and report errors for invalid combinations 2016-11-09 12:23:59 -08:00
Sheetal Nandi 78bb276216 Merge branch 'master' into errorReportingInJsFile 2016-11-09 11:38:11 -08:00
Nathan Shively-Sanders 214ce38a6a Downlevel array destructuring to ES6 in object rest
Previously array destructuring inside an object destructuring with an
object rest would downlevel the array destructuring to ES5. This breaks
if the code that targets ES2015 is using iterators instead of arrays
since iterators don't support [0] or .slice that the ES5 emit uses.
2016-11-09 10:47:54 -08:00
Sheetal Nandi 6456325973 Handle abstract and const modifiers 2016-11-09 10:39:46 -08:00
Anders Hejlsberg 3dd11e48a9 Properly implement type relationship for '[P in S]: X' and '[P in T]: Y' 2016-11-09 09:59:15 -08:00
Andy Hanson 7079d0450e Fix duplicate function error 2016-11-09 09:12:43 -08:00
Andy Hanson d559f7f17d Merge branch 'master' into symlink3 2016-11-09 09:11:25 -08:00
Andy Hanson 9c80909a90 Resolve symlinks for type reference directives too. 2016-11-09 08:08:10 -08:00
Ron Buckton bac9350847 Merge branch 'master' into emitHelper 2016-11-08 16:36:31 -08:00
Ron Buckton 12cd0bfb69 Remove EmitHelperState, general helper cleanup. 2016-11-08 16:32:41 -08:00
Vladimir Matveev 28cc938503 (signature help) type parameter lists are never variadic (#12112) 2016-11-08 16:10:34 -08:00
Vladimir Matveev 9a9f45f0fb use createHash from ServerHost instead of explicit require (#12043)
* use createHash from ServerHost instead of explicit require

* added missing method in ServerHost stub
2016-11-08 15:32:53 -08:00
Anders Hejlsberg aca7e2fa3b Don't include private/protected properties in keyof T 2016-11-08 13:38:52 -08:00
Anders Hejlsberg cf2953bc44 Add relations for keyof S / keyof T and [P in S]: X / [P in T]: X 2016-11-08 12:21:44 -08:00
Anders Hejlsberg a562d6e63f Make keyof T assignable to and subtype of string | number 2016-11-08 10:14:44 -08:00
Andy Hanson 1c64615e32 Allow a path mapping to provide a file extension 2016-11-08 07:19:17 -08:00
Anders Hejlsberg 7ca5923214 Merge branch 'master' into mappedTypes
# Conflicts:
#	src/compiler/checker.ts
2016-11-08 07:12:35 -08:00
Anders Hejlsberg 8aef1e6bb1 Type inference for mapped types 2016-11-08 06:55:35 -08:00
Anders Hejlsberg 2282477012 Merge pull request #12068 from Microsoft/fixTypeAliasDisplay
Fix type alias display
2016-11-08 06:43:38 -08:00
Vladimir Matveev 9e3d6efb19 reduce set of files being watched, increase polling interval (#12054) (#12092) 2016-11-07 21:13:11 -08:00
Mohamed Hegazy 2bf38ab6cd Port fix for https://github.com/Microsoft/TypeScript/issues/12069 (#12095) 2016-11-07 21:09:17 -08:00
Anders Hejlsberg 8f568d4740 Merge pull request #12064 from Microsoft/cacheSignatureInstantiations
Cache generic signature instantiations
2016-11-07 17:16:05 -08:00
Ron Buckton ddc4ae7eac Reuse subtree transform flags for incrementally parsed nodes (#12088) 2016-11-07 16:03:04 -08:00
Vladimir Matveev be2e8e85d6 property handle missing config files in external projects (#12094) 2016-11-07 15:49:19 -08:00
Vladimir Matveev 0173a3fa79 return empty file watcher in case if target directory does not exist (#12091)
* return empty file watcher in case if target directory does not exist

* linter
2016-11-07 15:48:46 -08:00
Nathan Shively-Sanders e1c50e1c40 Address more PR comments 2016-11-07 13:57:26 -08:00
Vladimir Matveev 4ffdea838a Ports #12051 and #12032 into master (#12090)
* use local registry to check if typings package exist (#12014)

use local registry to check if typings package exist

* enable sending telemetry events to tsserver client (#12035)

enable sending telemetry events
2016-11-07 13:36:08 -08:00
Nathan Shively-Sanders bd5ce284c9 Set spread type symbols in checkObjectLiteral
Instead of getSpreadType.

Also clean up special-case handling inside getSpreadType to be more
readable.
2016-11-07 13:35:36 -08:00
Andy d16aa3075c Merge pull request #12089 from Microsoft/lshost_realpath
Add `realpath` implementation for lshost
2016-11-07 13:19:50 -08:00
Nathan Shively-Sanders 567f5636e3 Create spread property types eagerly
This avoids the need for a synthetic symbol and later code called from
getTypeOfSymbol.
2016-11-07 13:02:05 -08:00
Andy Hanson d5c67312f6 Add realpath implementation for lshost 2016-11-07 12:42:12 -08:00
Nathan Shively-Sanders 9977936190 Do not emit __rest for --target esnext 2016-11-07 11:34:37 -08:00
Nathan Shively-Sanders 1866d0580c Rename variable in checkSwitchStatement per PR 2016-11-07 11:16:54 -08:00
Nathan Shively-Sanders 609cd0016b Merge branch 'object-spread' into object-rest 2016-11-07 11:10:29 -08:00
Nathan Shively-Sanders f03fecbd31 Merge branch 'master' into object-spread 2016-11-07 11:02:49 -08:00
Nathan Shively-Sanders 83e95d43f8 Revert unneeded change and comments per PR 2016-11-07 11:00:24 -08:00
Anders Hejlsberg 9f3aa38d17 Improve sharing by re-instantiating top level type aliases 2016-11-07 10:24:54 -08:00
Nathan Shively-Sanders d4a5b0855c Add --target esnext tests and update baselines 2016-11-07 09:56:48 -08:00
Nathan Shively-Sanders 7b9a42f995 Add --target esnext
Currently, this disables the rest and spread transforms. This will
change as proposals enter and leave stage 3.
2016-11-07 09:54:48 -08:00
Anders Hejlsberg de93876abe Correct symbol display for type parameter of mapped type 2016-11-07 09:43:20 -08:00
Anders Hejlsberg 5de63a74eb Validate constraint type in mapped type 2016-11-07 09:43:01 -08:00
Nathan Shively-Sanders 6a82ae4cbb Add SpreadAssignment to visitors
1. visitNode
2. reduceNode
3. emit

This fixes an emit bug for setters.
2016-11-07 09:04:00 -08:00
Nathan Shively-Sanders a84c7aeea4 Rename SpreadElementExpression -> SpreadAssignment
and SpreadExpression (formerly SpreadElementExpression) -> SpreadElement
2016-11-07 08:36:03 -08:00
Andy Hanson 07630e95e0 Add source maps and declarations to test 2016-11-07 07:14:47 -08:00
Anders Hejlsberg 2bf4bad0e1 Revert incorrect logic from #11392 2016-11-06 16:00:41 -08:00
Anders Hejlsberg 2564e1cd26 Handle recursion in mapped type display 2016-11-06 12:38:49 -08:00
Anders Hejlsberg da7f11fe4b Properly instantiate aliasTypeArguments 2016-11-05 17:36:00 -07:00
Anders Hejlsberg 507ab30e9c Handle readonly and optional properties + index signatures 2016-11-05 17:01:47 -07:00
Anders Hejlsberg 61b9da548a Cache generic signature instantiations 2016-11-05 08:20:02 -07:00
Anders Hejlsberg 1c7b397fbb Introduce instantiateCached function 2016-11-05 07:04:56 -07:00
Vladimir Matveev ed4fead087 add missing bind calls to properly set parent on token nodes (#12057) 2016-11-04 21:54:22 -07:00
Anders Hejlsberg 7807ac96f5 Attach symbols to mapped types 2016-11-04 16:47:43 -07:00
Nathan Shively-Sanders a55ed26d2b Spread any types to any 2016-11-04 16:06:33 -07:00
Anders Hejlsberg ecdb74cee6 Merge branch 'master' into mappedTypes 2016-11-04 14:18:44 -07:00
Anders Hejlsberg fc450a2d2f Introduce MappedType in type checker 2016-11-04 14:17:51 -07:00
Nathan Shively-Sanders 4c365bd76a Move transformFunctionBody to factory
It is shared by es2015 and esNext transformers.

This commit just adds a convertObjectRest flag to be passed on to
flattenDestructuring functions, as well as adding necessary parameters
to use the code outside a transformer.
2016-11-04 13:56:28 -07:00
Nathan Shively-Sanders cc342d12e7 Move convertForOf to factory for esnext and es2015
Saves a lot of duplicated code
2016-11-04 11:06:56 -07:00
Sheetal Nandi 4a906143c6 Merge pull request #11998 from Microsoft/unusedProperty
Mark property referenced in the destructuring as referenced
2016-11-04 10:42:05 -07:00
Nathan Shively-Sanders 71f3157a35 Address PR comments
1. Remove extra line in __rest shim.
2. Improve __rest vs __assign check for destructuring assignment.
2016-11-04 09:03:03 -07:00
Ron Buckton defc0537ae Merge pull request #12039 from Microsoft/fix12010
Ensure transformFlags are correct before visiting a node.
2016-11-03 23:38:52 -07:00
Zhengbo Li 1c004bf317 Port #12027, #11980 and #11932 to master (#12037)
* add test for the fix for overwrite emitting error

* cr feedback
2016-11-03 21:13:41 -07:00
Ron Buckton cbec19afd7 Ensure transformFlags are correct before visiting a node. 2016-11-03 17:21:36 -07:00
Anders Hejlsberg d1a8af5320 Parse '[P in K]' part of mapped type as a type parameter declaration 2016-11-03 14:35:27 -07:00
Nathan Shively-Sanders c9c5f49a24 Improve readability of ES next destructuring emit 2016-11-03 13:36:35 -07:00
Paul van Brenk 40c0cbd7b5 Clean up 2016-11-03 13:28:08 -07:00
Paul van Brenk 2f453ce674 Handle most module cases 2016-11-03 12:48:28 -07:00
Anders Hejlsberg 6a5de5d00e Fix linting errors 2016-11-03 10:55:58 -07:00
Nathan Shively-Sanders 7ff8876096 Merge branch 'object-spread' into object-rest-syntax 2016-11-03 10:12:45 -07:00
Anders Hejlsberg 83abd048b5 Correct assignability for keyof types and type parameters 2016-11-03 10:01:27 -07:00
Nathan Shively-Sanders 7a2c7ad374 Spread handles index signatures from singleton spreads
I broke it when simplifying the logic earlier.
2016-11-03 09:41:31 -07:00
Andy Hanson b6727ea582 Only resolve symlinks in node_modules 2016-11-03 07:53:10 -07:00
Andy Hanson 2eca0af91b Leave files from node_modules out when calculating getCommonSourceDirectory 2016-11-03 07:50:07 -07:00
Anders Hejlsberg 7cd39e3818 Parsing of mapped types 2016-11-03 06:09:44 -07:00
Nathan Shively-Sanders a6320203be Fix lint 2016-11-02 16:31:04 -07:00
Nathan Shively-Sanders 334820c357 Remove spread types, leaving spread syntax/emit
Spreads are still typed, but cannot be created from a non-object type.
Tests still need to be updated.
2016-11-02 16:26:34 -07:00
Nathan Shively-Sanders e3a08ed663 Downlevel emit of rest elements 2016-11-02 14:56:01 -07:00
Nathan Shively-Sanders a7c18367ca Parse, bind and check rest elements 2016-11-02 14:55:24 -07:00
Vladimir Matveev ab75ea75d3 module resolution: prefer locally defined ambient modules, reuse resolutions to ambient modules from the old program (#11999)
module resolution: prefer locally defined ambient modules, reuse resolutions to ambient modules from the old program
2016-11-02 14:41:26 -07:00
Nathan Shively-Sanders f2d739ffcf Spread types handle nested index [access] types
Nested index [access] types are treated as assignable to themselves only,
just like type parameters.
2016-11-02 11:36:25 -07:00
Sheetal Nandi 13e8f7fada Mark property referenced in the destructuring as referenced
Fixes #11324
2016-11-02 11:08:34 -07:00
Nathan Shively-Sanders 2ae6ecc1a5 Merge branch 'master' into object-spread 2016-11-02 10:57:20 -07:00
Anders Hejlsberg 7b34b612be Merge pull request #11929 from Microsoft/keyoftypes
Static types for dynamically named properties
2016-11-02 09:36:54 -07:00
Anders Hejlsberg 70fc25a45a Minor fixes 2016-11-02 09:02:05 -07:00
Mohamed Hegazy 6b94bae437 Fix #11396: Make error message referene Promise explicitly (#11982)
* Simplify the checking for async function return type

* Fix https://github.com/Microsoft/TypeScript/issues/11396: Make error message referene `Promise` explicitly
2016-11-01 17:03:56 -07:00
Anders Hejlsberg 663985eed0 Fix 'keyof any' to produce 'string | number' 2016-11-01 16:59:53 -07:00
Paul van Brenk 71960187cd Removed unused, confusing cases 2016-11-01 16:43:17 -07:00
Paul van Brenk b59714ea7e Add more testcases and simplify 2016-11-01 16:31:23 -07:00
Sheetal Nandi 06331b57de Report all the js file errors and skip only the nodes that are not allowed in js
Fixes #11800
2016-11-01 13:00:30 -07:00
Sheetal Nandi d896d3f8a9 Add test cases to report errors for decorators in js file 2016-11-01 11:05:09 -07:00
Anders Hejlsberg 41c20545e1 Improve unification by moving more logic to getIndexedAccessType 2016-11-01 10:17:08 -07:00
Nathan Shively-Sanders d7f5fc8fcf Get literal type only once 2016-11-01 09:09:40 -07:00
Andy Hanson de6751b80c Make cachingInServerLSHost tests work with runtests-browser 2016-11-01 08:22:56 -07:00
Anders Hejlsberg 6b28d21a82 Merge branch 'master' into keyoftypes
# Conflicts:
#	src/compiler/diagnosticMessages.json
2016-10-31 16:04:40 -07:00
Anders Hejlsberg f9e208533a Unify checking of indexed access expressions and indexed access types 2016-10-31 15:28:28 -07:00
Ron Buckton 4371889854 Merge pull request #11430 from Microsoft/fixAsyncReturnTypeCheck
Fix async return type check
2016-10-31 15:18:11 -07:00
Ron Buckton 884e9f47db Merge branch 'master' into fixAsyncReturnTypeCheck 2016-10-31 15:17:26 -07:00
Andy ecb7b00e1c Forbid augmentation of untyped module (#11962)
* Forbid augmentation of untyped module

* Just use `undefined` for untyped modules
2016-10-31 15:04:22 -07:00
Nathan Shively-Sanders ebef408dfa Move eitherIsNotLiteral check into switch and === checks
This improves error messages
2016-10-31 14:44:04 -07:00
Nathan Shively-Sanders b0080a253d Merge branch 'master' into fix-comparable-in-switch 2016-10-31 14:20:10 -07:00
Andy 49be2e2c5d Merge pull request #11957 from Microsoft/fix_realpathmap
Fix realPathMap in test harness: Must be used in `directoryExists`
2016-10-31 14:03:42 -07:00
Andy e6f6a5e6f6 Merge pull request #11495 from Microsoft/includes_glob
Implicitly consider an extensionless file in "includes" to be a recursive directory glob
2016-10-31 13:56:10 -07:00
Mohamed Hegazy 8984e43b20 Update generated files (#11963) 2016-10-31 13:15:46 -07:00
Andy Hanson ebebac9c4e Add helper function 2016-10-31 11:08:09 -07:00
Andy Hanson 03ce7b0145 Fix realPathMap in test harness: Must be used in directoryExists 2016-10-31 08:23:02 -07:00
Anders Hejlsberg 2f34f7c569 Improve more error messages 2016-10-30 19:01:07 -07:00
Anders Hejlsberg 6c205330a1 Improved error messages for invalid assignments to properties 2016-10-30 18:08:43 -07:00
Anders Hejlsberg 5515dcea34 Improved error messages for invalid assignments to identifiers 2016-10-30 16:01:15 -07:00
Vladimir Matveev 44ce59d1d8 cache type for empty type literal (#11934)
cache type for empty type literal
2016-10-29 15:57:51 -07:00
jramsay 980f9fd2a9 Merge pull request #11848 from Microsoft/AddJavaScriptSemanticErrorsToSyntacticErrors
Fix for #11719 - TSServer: JS files should display syntactic errors for TS syntax
2016-10-28 16:49:53 -07:00
Vladimir Matveev fcdeecfa4a Merge pull request #11925 from Microsoft/vladima/11880
update CFG to properly handle do statements
2016-10-28 16:12:53 -07:00
Vladimir Matveev 9bb7ba5862 Merge pull request #11928 from Microsoft/vladima/11738
do not inline async IIFEs in control flow graph
2016-10-28 16:12:31 -07:00
Anders Hejlsberg 8d87971fee Minor fixes 2016-10-28 15:35:15 -07:00
Vladimir Matveev 73c59bbf85 do not inline async IIFEs in control flow graph 2016-10-28 14:43:08 -07:00
Vladimir Matveev fc93e8f6f4 update CFG to properly handle do statements 2016-10-28 14:17:01 -07:00
Vladimir Matveev fdb3b6857d enable non-ts extensions in inferred projects by default 2016-10-28 11:30:00 -07:00
Ron Buckton 5f5b117406 Merge branch 'master' into emitHelper 2016-10-28 10:52:00 -07:00
Nathan Shively-Sanders 988bf1fc69 Rename TransformFlags.Experimental -> ESNext 2016-10-28 10:24:30 -07:00
Nathan Shively-Sanders fdcc7cc185 Merge pull request #11905 from Microsoft/skip-overloads-with-too-short-function-parameters
Skip overloads with too short function parameters
2016-10-28 09:59:38 -07:00
Nathan Shively-Sanders 179682610f isAritySmaller runs later: getNonGenericSignature 2016-10-28 08:57:19 -07:00
Nathan Shively-Sanders 278d0a4665 Do not use contextual signatures with too few parameters 2016-10-27 22:52:01 -07:00
Zhengbo Li 4513ae3034 disable CoS for inferred projects (#11909) 2016-10-27 18:00:21 -07:00
Jason Ramsay 43bd2d8747 Changes from CR feedback 2016-10-27 16:38:59 -07:00
Nathan Shively-Sanders 39b9163715 Rename Experimental transform to ESNext
1. Spread/rest are no longer experimental.
2. We need a place to put stage 3 ES features.
2016-10-27 16:03:01 -07:00
Andy Hanson 12f6dcefa1 Revert "Merge pull request #11354 from Microsoft/map4"
This reverts commit adfdae0dc4, reversing
changes made to aad663cebf.
2016-10-27 15:50:21 -07:00
Nathan Shively-Sanders 3e71d50708 Ignore optionality when skipping overloads 2016-10-27 15:42:41 -07:00