12868 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
eb933f9567 More tests of enum assignability
1. Numeric literal <-> enum literal assignability
2. Computed enum <-> union enum assignability
3. Also rebaseline error reporting of existing enum cases.
2016-09-13 13:00:40 -07:00
Nathan Shively-Sanders
64e4f6f395 Address PR comments
1. Cache results of isEnumTypeRelatedTo
2. Make numeric literal assignment stricter again.
3. Use isEnumRelatedTo for comparing enums to each other. This provides
the previous semi-structural semantics.
4. Because of the new distinction between computed enums (no union
members) and union enums (no computed values => a union of enum
literals), some semi-structural code moves out to the body of
`isRelatedTo`.
2016-09-13 13:00:36 -07:00
Nathan Shively-Sanders
a0c3d4f306 Fix both new enum assignability predicates
And update error reporting baseline (new error is less elaborate)
2016-09-13 13:00:31 -07:00
Nathan Shively-Sanders
bf3941da47 Test that enum literal is assignable to an enum in a union 2016-09-13 13:00:27 -07:00
Nathan Shively-Sanders
7482d5b77d Enum literal is assignable to enum, even inside union
Previously, only number literals were assignable to enums inside unions.
2016-09-13 13:00:21 -07:00
Nathan Shively-Sanders
495ea0d497 Test that number is assignable to enum in a union 2016-09-13 13:00:09 -07:00
Nathan Shively-Sanders
dae4ec63be Number is assignable to enum, even inside union
Previously, numbers were not assignable to enums that were inside a
union
2016-09-13 12:59:42 -07:00
Mohamed Hegazy
60d6578cb5 Update LKG 2016-09-13 09:20:05 -07:00
Mohamed Hegazy
b3bb39db3e Update baseline 2016-09-13 09:19:51 -07:00
Anders Hejlsberg
81c69b2a58 Add regression test 2016-09-13 08:55:38 -07:00
Anders Hejlsberg
88349ab436 Quick bail out when narrowing type any by equality 2016-09-13 08:55:29 -07:00
Mohamed Hegazy
b8759b38ee Update LKG 2016-09-12 12:38:32 -07:00
Anders Hejlsberg
9986f81981 Add regression test 2016-09-12 11:28:37 -07:00
Anders Hejlsberg
709b4ebc83 Preserve type parameter types in narrowing 2016-09-12 11:28:32 -07:00
Andy
5c16cb6f32 Merge pull request #10807 from Microsoft/release-2.0_re_export_shorthand
A shorthand ambient module should be considered as possibly exporting a value
2016-09-09 12:58:25 -07:00
Mohamed Hegazy
8ae5b5fe20 Update LKG 2016-09-09 11:28:48 -07:00
Mohamed Hegazy
6d6f3b1ae6 Fix typescript and tslint versions 2016-09-09 11:23:00 -07:00
Anders Hejlsberg
2cd4d20f7b Accept new baselines 2016-09-09 11:20:41 -07:00
Anders Hejlsberg
5c11d4c349 Use 'true' and 'false' types when contextual type is 'boolean' 2016-09-09 11:20:33 -07:00
Anders Hejlsberg
aee1bf6429 Accept new baselines 2016-09-09 11:20:27 -07:00
Anders Hejlsberg
88fd3d54b2 Use union type when binding element has initializer 2016-09-09 11:20:22 -07:00
Anders Hejlsberg
f4c621bb8e Add regression tests 2016-09-09 11:19:59 -07:00
Anders Hejlsberg
98ab0de8c0 Assume outer variables are always initialized in control flow analysis 2016-09-09 11:19:53 -07:00
Andy Hanson
545d7e5e89 A shorthand ambient module should be considered as possibly exporting a value 2016-09-09 08:11:47 -07:00
zhengbli
11e9f50722 Port #10728: Fix #6500 2016-09-06 13:04:29 -07:00
Mohamed Hegazy
faaf219a43 Merge pull request #10726 from Microsoft/port10703
Port https://github.com/Microsoft/TypeScript/pull/10703 to release-2.0
2016-09-06 10:25:16 -07:00
Anders Hejlsberg
9adc26c3fd Add repro from #10697 2016-09-06 10:15:50 -07:00
Anders Hejlsberg
b7289729a5 Introduce resolvingSignature to ensure caching works for anySignature 2016-09-06 10:15:43 -07:00
Andy
66d456d163 Merge pull request #10691 from Microsoft/release-2.0_node_modules_parent
Search for `node_modules` in parent directories when getting type roots.
2016-09-02 14:30:39 -07:00
Andy Hanson
12ad9d0aaf Search for node_modules in parent directories when getting type roots. 2016-09-02 13:42:43 -07:00
Kanchalai Tanglertsampan
d6dac6a6cb Update LKG 08/25 v2.0.2 v2.0-rc 2016-08-25 16:23:32 -07:00
Kanchalai Tanglertsampan
3ed8bca8db Merge branch 'master' into release-2.0 2016-08-25 16:15:30 -07:00
Nathan Shively-Sanders
0041d5ce79 Merge pull request #10538 from Microsoft/find-declarations-of-js-module-export
Fix crash when checking module exports for export=
2016-08-25 16:14:13 -07:00
Zhengbo Li
8d5aaf8eda avoid creating syntax nodes for jsdoc comment tags (#10526) 2016-08-25 14:26:58 -07:00
Nathan Shively-Sanders
6ee749f8b3 Get rid of absolute paths 2016-08-25 11:02:26 -07:00
Nathan Shively-Sanders
751b0a65de Clean up maxNodeModuleJsDepth test 2016-08-25 10:25:17 -07:00
Mohamed Hegazy
13576064f3 Update LKG 2016-08-25 10:16:53 -07:00
Zhengbo Li
6c49dc2f70 strip comments when re-emitting tsconfig.json (#10529) 2016-08-25 10:15:42 -07:00
Nathan Shively-Sanders
c0309fa78e Fix crash when checking module exports for export=
Also make maxNodeModuleJsDepth default to 0 so that incorrect tsconfigs
now let the compiler spend less time compiling JS that is found in
node_modules (especially since most people will already have the d.ts
and want ignore the JS anyway). jsconfig still defaults to 2.
2016-08-25 09:21:31 -07:00
Zhengbo Li
bab4a52983 strip comments when re-emitting tsconfig.json (#10529) 2016-08-25 06:21:02 -07:00
Nathan Shively-Sanders
ddb5a00410 Merge pull request #10446 from YuichiNukiyama/fix10351
Add error message
2016-08-23 09:34:20 -07:00
Yuichi Nukiyama
590755b8a0 change error message 2016-08-23 21:54:01 +09:00
Kanchalai Tanglertsampan
c254e9589f Update LKG on 08/22 2016-08-22 17:25:48 -07:00
Kanchalai Tanglertsampan
796c0791ba Merge branch 'master' into release-2.0 2016-08-22 17:19:04 -07:00
Yui
234b3bb9ff Merge master 08/22 (#10487)
* Add test case for #8229

* Do not report errors during contextual typecheck
Fixes #8229

* Handle the scenario when let [a=undefined]=[]

* Instantiate contextual this parameters if needed

* Test that contextually typed generic this parameters are instantiated

* Don't allow `.ts` to appear in an import

* Add specific error message for unwanted '.ts' extension

* Allow `await` in a simple unary expression

* More tests

* Forbid `await await`

* Allow `await await`

* Improve error message

* Don't allow ".d.ts" extension in an import either.

* Rename 'find' functions

* Assign and instantiate contextual this type if not present

* JSDoc supports null, undefined and never types

* Update baselines in jsDocParsing unit tests

* Return non-JsDocComment children
... to make syntactic classification work

* Move supportedTypescriptExtensionsWithDtsFirst next to supportedTypeScriptExtensions and rename

* Fix comment

* Treat special property access symbol differently
... when retriving documentation

* Fix tests

* Update shim version to be 2.1 (#10424)

* Check return code paths on getters (#10102)

* Check return paths on getters

* Remove TODO comment

* Remove extraneous arguments from harness's runBaseline (#10419)

* Remove extraneous arguments from runBaseline

* Address comments from @yuit

* Remove needless call to basename

* Refactor baseliners out of compiler runner (#10440)

* CR feedback

* fix broken tests

* Pass in baselineOpts into types baselines so that RWC baselines can be written to internal folder (#10443)

* Add more test for 10426

* routine update of dom libs

* Add test for jsdoc syntactic classification for function declaration

* Simplify implementation

* Tolerate certain errors in tsconfig.json

* Add test for configFile error tolerance

* Use TS parser to tolerate more errors in tsconfig.json

* Implement tuple types as type references to synthesized generic types

* Add comments + minor changes

* Accept new baselines

* Add .types extension

* Properly guard for undefined in getTypeReferenceArity

* Add jsdoc nullable union test case to fourslash

* Fix class/interface merging issue + lint error

* Allow "typings" in a package.json to be missing its extension (but also allow it to have an extension)

* Contextually type this in getDeclFromSig, not checkThisExpr

* Update parser comment with es7 grammar (#10459)

* Use ES7 term of ExponentiationExpression

* Update timeout for mac OS

* Address PR: add space

* allowSyntheticDefaultImports resolves to modules instead of variables

Fixes #10429 by improving the fix in #10096

* Rename getContextuallyTypedThisParameter to getContextualThisParameter

* Fix 10472: Invalid emitted code for await expression (#10483)

* Properly emit await expression with yield expression

* Add tests and update baselines

* Move parsing await expression into parse unary-expression

* Update incorrect comment
2016-08-22 17:04:49 -07:00
Nathan Shively-Sanders
93de502656 Merge pull request #10486 from Microsoft/allowSyntheticDefaultImports-resolves-to-module
allowSyntheticDefaultImports resolves to modules instead of variables
2016-08-22 16:50:55 -07:00
Nathan Shively-Sanders
f028fa3f52 Merge pull request #9746 from Microsoft/instantiate-this-for-contextually-typed-type-parameters
Instantiate this for contextually typed type parameters
2016-08-22 16:47:13 -07:00
Yui
36130ffa64 Fix 10472: Invalid emitted code for await expression (#10483)
* Properly emit await expression with yield expression

* Add tests and update baselines

* Move parsing await expression into parse unary-expression

* Update incorrect comment
2016-08-22 16:37:04 -07:00
Nathan Shively-Sanders
fc1d6a8437 Rename getContextuallyTypedThisParameter to getContextualThisParameter 2016-08-22 16:36:38 -07:00
Nathan Shively-Sanders
046b55e9f1 allowSyntheticDefaultImports resolves to modules instead of variables
Fixes #10429 by improving the fix in #10096
2016-08-22 16:27:44 -07:00