Commit Graph

3083 Commits

Author SHA1 Message Date
Anders Hejlsberg
c03b7f525c Merge pull request #30568 from Microsoft/instantiateContextualTypes
Contextual typing based on instantiated types
2019-03-28 12:38:01 -07:00
Daniel Rosenwasser
6a244b9058 Added test. 2019-03-27 23:29:22 -07:00
Wesley Wigham
b7881a26a0 Unify substitution type any handling into costruction and instantiation (#30592)
* Unify substitution type `any` handling into costruction and instantiation

* Strengthen supertype reduction check to reduce breakage

* Rename conditional type fields per convention

* Explicitly handle anyish signatures in compareSignaturesRelated so strict variance doesnt kill subtyping

* Allow tuple expansions to an `any` rest to be considered an `any` signature as well
2019-03-27 12:55:17 -07:00
Anders Hejlsberg
887b30682b Add tests 2019-03-24 11:34:14 -07:00
Wesley Wigham
b86dea03f2 Fix crash caused by cyclic defaults (#30532) 2019-03-21 18:27:14 -07:00
Ron Buckton
cfb0adeadf Merge pull request #28609 from ajafff/class-decorator-generics
resolve TypeReference in class decorator at parent of class
2019-03-19 15:46:58 -07:00
Masahiro Wakame
18b8625ef8 fix error on globalThis type extend (#30460)
* Add test for extend globalThis

* Fix compile aborting
2019-03-18 09:18:27 -07:00
Anders Hejlsberg
36cf12fe0a Merge pull request #30363 from Microsoft/fixTypeParameterPromotion
Higher order type parameter promotion fixes
2019-03-18 08:48:03 -07:00
Anders Hejlsberg
b6aff98fd7 Add test relating type predicates with and without this parameters 2019-03-17 17:39:08 -10:00
Nathan Shively-Sanders
0f598db3e5 Fixes #29524, a merged UMD-global (#30403)
This kind of merged symbol causes crashes in two places because it's
marked BlockScoped, which makes us assume that it must be something that
is inside a SourceFile. However, block-scoped checks don't make sense
for this kind of symbol, so I exclude them by looking at the kind of
the valueDeclaration, as @mprobst suggested in the original bug.
2019-03-15 09:45:33 -07:00
Wesley Wigham
563593b8be Enable better error spans for async functions (#30413) 2019-03-14 17:10:42 -07:00
Sheetal Nandi
342616781e Merge pull request #30381 from Microsoft/mapConstructor
Fix map constructor to accept readonly tuple
2019-03-13 15:24:22 -07:00
Wesley Wigham
5d08b68122 Fix react-redux break on DT (#30375)
* Forbid reentrancy in conditional type creation (force deferal on occurance)

* Add repro from react-redux, accept updated baselines
2019-03-13 15:21:46 -07:00
Sheetal Nandi
027d65a920 Fix map constructor to accept readonly tuple
Fixes #29721
2019-03-13 14:52:58 -07:00
Anders Hejlsberg
fd0d477519 Add test 2019-03-13 06:51:13 -07:00
Anders Hejlsberg
4f4d9f6819 Add test 2019-03-12 17:29:44 -07:00
Matt McCutchen
ab8153602a Fix mixin logic to preserve at least one constructor type even when the (#27701)
intersection also contains non-constructor types.

Fixes #17388.
2019-03-12 14:30:43 -07:00
Matt McCutchen
6c6f216d0d Handle generic mapped types in getTypeOfPropertyOfContextualType. (#27586)
* Handle generic mapped types in getTypeOfPropertyOfContextualType.

The changes to existing baselines look acceptable to me.

Fixes #24694.

* Minor reorganization, add test case from @yortus
2019-03-12 14:13:32 -07:00
Anders Hejlsberg
ba95fcac87 Merge pull request #30334 from Microsoft/inferenceContextCleanup
Revise InferenceContext implementation
2019-03-12 10:13:55 -07:00
Anders Hejlsberg
7f90ad1155 Add tests 2019-03-12 06:29:33 -07:00
Wesley Wigham
3ba5aa9f60 Add regression test for #29692 (#30325) 2019-03-11 15:41:05 -07:00
Wesley Wigham
ca9566fcde Forbid contravariant inferences to conditional type branches (#30287) 2019-03-11 15:21:03 -07:00
Sheetal Nandi
97fbc87e98 Merge pull request #29813 from Microsoft/incrementalBuildInfo
Build .tsbuildinfo file when building using tsc --b
2019-03-08 15:49:44 -08:00
Wesley Wigham
a9ad94ab3c Conditional type simplifications & Globally cached conditional type instances (#29437)
* Introduce simpliciations for extract/exclude-like conditional types and fix restrictive instantiations

* Add test for the common simplifications

* unify true branch constraint generation logic and true branch simplification

* Use identical check on instantiated types

* Add late-instantiate conditionals to test

* Globally cache conditional type instantiations ala indexed access types

* Handle `any` simplifications

* Factor empty intersection check into function

* Modifify conditional type constraints to better handle single-branch `any` and restrictive type parameters

* Add test case motivating prior commit

* Fix lint

* Factor logic into worker vs cacheing function

* Remove now unneeded casts
2019-03-08 15:33:12 -08:00
Wesley Wigham
58e847abb5 Add assignability rule relaxing the assignability of partial mapped types (#30112)
* Add assignability rule relaxing the assignability of partial mapped types

* Update comment
2019-03-08 14:01:27 -08:00
Wesley Wigham
45a6cb7066 Reset toplevel flag when higher priority inference takes place (#30265) 2019-03-08 13:57:43 -08:00
Sheetal Nandi
990b199ebd Merge branch 'master' into incrementalBuildInfo 2019-03-08 11:42:19 -08:00
Anders Hejlsberg
d59e51b063 Merge pull request #30215 from Microsoft/higherOrderFunctionTypeInference
Higher order function type inference
2019-03-08 10:41:32 -08:00
Wesley Wigham
e982240500 Instantiating a signature in the context of another should infer from return type predicates if they match up (#30242)
* Instantiating a signature in the context of another should infer from return type predicates if they match up

* Invert condition per PR feedback
2019-03-07 17:39:58 -08:00
Wesley Wigham
4c9ad08610 Add fix for webpack history merge bug (#29339)
* Add fix for webpack history merge bug

* Add test case
2019-03-07 13:34:28 -08:00
Sheetal Nandi
fe9f42480a Handle error when type parameter of mapped type uses private type
Fixes #30201
2019-03-06 13:30:48 -08:00
Sheetal Nandi
6e1e1e7bd5 Merge branch 'master' into incrementalBuildInfo 2019-03-05 12:02:27 -08:00
Anders Hejlsberg
22c934a065 Add tests 2019-03-04 11:07:02 -08:00
Anders Hejlsberg
304e25cf69 Add tests 2019-03-02 11:59:33 -08:00
Anders Hejlsberg
d9bb869341 Add regression test 2019-03-01 16:34:23 -08:00
Sheetal Nandi
223d42847b Merge branch 'master' into incrementalBuildInfo 2019-03-01 11:39:44 -08:00
Sheetal Nandi
cd195c91c6 Add options tsBuildInfoFile to provide name for the buildinfo file 2019-03-01 10:28:57 -08:00
Sheetal Nandi
df9da15abb Incremental false with composite not allowed 2019-03-01 09:39:58 -08:00
Wesley Wigham
b1a73ab560 Resolve aliases to jsx namespace symbol (#30160) 2019-02-28 13:52:57 -08:00
Wesley Wigham
a6a3ae00a6 Only collect inferences which actually have inferences into the returnMapper (#30111) 2019-02-28 12:46:24 -08:00
Wesley Wigham
13c08ab32b Use identity with the permissive instantation to detect nongenric instances and disable variance probing on nongeneric instances (#29981)
* Use identity with the restrictive instantation to detect nongenric instances and disable variance probing on nongeneric instances

* Generalize to also include interfaces, add test case, still perform argument comparisons for postive comparisons if possible

* Actually accept baselines, lol

* Reduce deep nesting limit just a bit so yargs still builds

* Handle circular identities in isNonGeneric

* Use a simple traversal of the types rather than the restrictive instantiation

* Cache the bits using an existing field to further reduce any time nongeneric check takes

* Revert to using an existing mapper, use permissive > restrictive

* Revert constant change

* And revert the comment, too
2019-02-27 14:12:30 -08:00
Wesley Wigham
288851066b Dont create a union type to infer conditional type branches (#30010) 2019-02-26 13:43:41 -08:00
Wesley Wigham
2533d8294e Make a fresh empty object literal not a subtype of a type with an index signaure (#29975)
* Forbid inferable index checkign during subtype relationship checking

* Merge object.values and object.entries overloads to work around subtype change

* Invert subtype relationship between fresh empty objects and non-empty object types

* Remvoe comment

* Revert lib change

* Remove trailing whitespace ffs
2019-02-26 13:43:22 -08:00
Wesley Wigham
c5061486a9 Retain substitution types through instantiation if possible (#30059) 2019-02-25 17:10:03 -08:00
Wesley Wigham
eafff75c2a Remove diagnostic dependent output in structuredTypeRelatedTo (#29817)
* Unify variance probing error exceptions between interfaces/aliases

* Consistiently return false on variance probe failure

* Remove strictFunctionTypes early bail from getVariances so independent type parameters are correctly measured

* Fix lint, remove now-redundant change from covariant void check function
2019-02-19 11:39:16 -08:00
Wesley Wigham
84076a5535 Add diagnostic context for expando property declarations (#29905) 2019-02-13 22:54:33 -08:00
Anders Hejlsberg
15610faa9d Update test 2019-02-10 15:18:45 -08:00
Kagami Sascha Rosylight
b3c179540a String.prototype.{trimStart,trimEnd} hit stage 4 2019-02-08 00:51:23 +09:00
Kagami Sascha Rosylight
f525a89e87 Array.prototype.{flat,flatMap} hit stage 4 2019-02-08 00:10:34 +09:00
Wesley Wigham
8e5dcfbde5 Add try priors as finally lock label andecedents rather than pre finally label antecedents (#29790) 2019-02-06 16:59:26 -08:00