Commit Graph

13191 Commits

Author SHA1 Message Date
Ryan Cavanaugh
5ec5e0466d Merge pull request #30136 from RyanCavanaugh/no-mkdir-race
Don't crash if someone created a folder while we were checking to see if it exists
2019-02-27 15:43:14 -08:00
Ryan Cavanaugh
93fa734162 Don't crash if someone created a folder while we were checking to see if it exists 2019-02-27 14:33:25 -08:00
Nathan Shively-Sanders
be2db9db12 Add globalThis (#29332)
* Restore original code from bind-toplevel-this

With one or two additional comments

* Working in JS, but the symbol is not right.

Still need to

1. Make it work in Typescript.
2. Add test (and make them work) for the other uses of GlobalThis:
window, globalThis, etc.

* Check in TS also; update some tests

Lots of tests still fail, but all but 1 change so far has been correct.

* Update baselines

A couple of tests still fail and need to be fixed.

* Handle type references to globalThis

The type reference must be `typeof globalThis`. Just `globalThis` will
be treated as a value reference in type position -- an error.

* Restore former behaviour of implicitThis errors

I left the noImplicitThis rule for captured use of global this in an
arrow function, even though technically it isn't `any` any more --
it's typeof globalThis.  However, you should still use some other method
to access globals inside an arrow, because captured-global-this is super
confusing there.

* Test values with type globalThis

I ran into a problem with intersecting `Window & typeof globalThis`:

1. This adds a new index signature to Window, which is probably not
desired. In fact, with noImplicitAny, it's not desired on globalThis
either I think.
2. Adding this type requires editing TSJS-lib-generator, not this repo.

So I added the test cases and will probably update them later, when
those two problems are fixed.

* Add esnext declaration for globalThis

* Switch to symbol-based approach

I decided I didn't like the import-type-based approach.

Update baselines to reflect the difference.

* Do not suggest globals for completions at toplevel

* Add tests of element and property access

* Look up globalThis using normal resolution

globalThis is no longer constructed lazily. Its synthetic Identifier
node is also now more realistic.

* Update fourslash tests

* Add missed fourslash test update

* Remove esnext.globalthis.d.ts too

* Add chained globalThis self-lookup test

* Attempt at making globalThis readonly

In progress, had to interrupt for other work.

* Add/update tests

* Addres PR comments:

1. Add parameter to tryGetThisTypeAt to exclude globalThis.
2. Use combined Module flag instead combining them in-place.
3. SymbolDisplay doesn't print 'module globalThis' for this expressions
anymore.
2019-02-27 14:14:34 -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
Nathan Shively-Sanders
aedffe049d Revert "Merge pull request #27697 from mattmccutchen/issue-27118"
This reverts commit 2dfb6202ed, reversing
changes made to bbf559b9c7.
2019-02-27 11:50:04 -08:00
Daniel Rosenwasser
e8e7e88b2a Merge pull request #30094 from Kingwl/improve_completions_for_optional_props
check completions with assignable rather than identity
2019-02-26 16:19:50 -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
王文璐
4d7ec380a9 check completions with assignable rather than identity 2019-02-26 10:54:01 +08:00
Wesley Wigham
c5061486a9 Retain substitution types through instantiation if possible (#30059) 2019-02-25 17:10:03 -08:00
Wenlu Wang
592396d40a expose token flags and numeric flags (#29897)
* expose token flags and numeric flags

* hide hide useless token flags
2019-02-21 15:09:37 -08:00
Daniel Rosenwasser
4a256abc8a Give a related span pointing to the implementation signature when reporting incompatibility. 2019-02-21 10:51:18 -08:00
Daniel Rosenwasser
cee933ff09 Be more specific in errors. 2019-02-21 10:50:14 -08:00
Wesley Wigham
ee17915801 Fix build breaks (#29977)
* Some callbacks in watchUtilities werent being strictly checked due to the structural fallback

* Add direct dependeny on ms since mocha removed its impl

* Manually init stats collection on base runner like mocha.run now does
2019-02-19 14:30:58 -08:00
Anders Hejlsberg
071708f8a7 Merge pull request #29959 from Microsoft/noResolvedTypeOverwrite
Never overwrite resolved types of symbols
2019-02-19 12:22:44 -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
Anders Hejlsberg
059fd2d42e Never overwrite resolved type of symbol 2019-02-18 07:25:08 -10:00
Ryan Cavanaugh
d517713f50 Merge pull request #29935 from RyanCavanaugh/md5_2_sha
Use sha256 to hash file contents
2019-02-15 10:28:23 -08:00
Anders Hejlsberg
691df0e4b5 Merge pull request #29923 from Microsoft/freeTypeFlags
Free up some type flags
2019-02-15 09:10:21 -08:00
Ryan Cavanaugh
7983813be0 Use sha256 to hash file contents 2019-02-15 09:03:15 -08:00
Anders Hejlsberg
8f52f21f0d Fix broken check in getUnionType (check was always true) 2019-02-15 06:22:17 -08:00
Anders Hejlsberg
3e745e65cd Simplify flags propagation logic 2019-02-14 15:22:19 -08:00
Anders Hejlsberg
b57956673e Move TypeFlags.PropapatingFlags to ObjectFlags to free up 3 flags 2019-02-14 14:42:55 -08:00
Ryan Cavanaugh
cc987a1921 Merge pull request #29896 from dragomirtitian/GH-29778
Improve error message for using value as type
2019-02-14 13:14:20 -08:00
Wesley Wigham
84076a5535 Add diagnostic context for expando property declarations (#29905) 2019-02-13 22:54:33 -08:00
Titian Cernicova-Dragomir
c358b0b4a5 Fixed tslint error. 2019-02-14 07:23:11 +02:00
Titian Cernicova-Dragomir
950861ec7f Improve error message for using value as type. 2019-02-13 17:25:23 +02:00
Wesley Wigham
6d2b738bd8 Use built local on CI and not LKG (#29886)
* Use built local on CI and not LKG

* Adjust function to remove need for assertions

* Accept baseline diff to go back to local based baseline

* Remove comment
2019-02-12 17:55:19 -08:00
Anders Hejlsberg
f93f4f3c62 Merge pull request #29847 from Microsoft/inferToUnionTypes
Improve inference to union and intersection types
2019-02-11 11:34:05 -08:00
Anders Hejlsberg
d66000bc47 Merge pull request #29787 from Microsoft/inferToPartiallyHomomorphic
Infer to partially homomorphic types (such as Pick<T, K>)
2019-02-11 11:33:27 -08:00
Anders Hejlsberg
ce6c04e9b5 Merge branch 'master' into inferToUnionTypes 2019-02-11 11:00:41 -08:00
Anders Hejlsberg
32b44ac65a Merge pull request #29858 from Microsoft/fixContextualRestTuple
Fix contextual types computed from rest parameters
2019-02-11 10:59:11 -08:00
Anders Hejlsberg
1f32139811 Make inferences to union types containing multiple naked type variables 2019-02-10 15:07:01 -08:00
Anders Hejlsberg
9a0a838d12 Use getIndexedAccess to compute type for contextual rest parameters 2019-02-10 07:48:22 -08:00
Matt McCutchen
1aca1dd036 Make the assignability rule for conditional types require the check
types and distributivity to be identical.

Fixes #27118.
2019-02-09 17:22:08 -05:00
Anders Hejlsberg
040401205b Delete wayward comment 2019-02-08 06:53:39 -08:00
Anders Hejlsberg
f46c0a4597 Process more complex constraints as per CR feedback 2019-02-08 06:49:13 -08:00
Kagami Sascha Rosylight
13c72b786e Merge remote-tracking branch 'upstream/master' into es2019 2019-02-08 06:55:56 +09:00
Ron Buckton
b9ca653cf6 Merge branch 'async-es2018' of https://github.com/saschanaz/TypeScript into saschanaz-async-es2018 2019-02-07 13:27:25 -08:00
Ron Buckton
61d13b740e Merge pull request #29726 from bmeurer/modifierFlagsCache
Make modifierFlagsCache mandatory for Node objects
2019-02-07 12:13:46 -08:00
Benedikt Meurer
d3e23884c4 Fix linter warnings. 2019-02-07 20:39:03 +01:00
Ron Buckton
a94c383b71 Merge pull request #27292 from kpreisser/fix26090
Align the ShimMap iterator behavior with native Maps
2019-02-07 11:17:22 -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
kpreisser
5043bf72f5 PR feedback. 2019-02-07 09:01:27 +01:00
Kagami Sascha Rosylight
40a4bd0a95 revive esnext.symbol 2019-02-07 10:45:44 +09:00
Kagami Sascha Rosylight
582526929b restore flags 2019-02-07 10:27:50 +09:00
Kagami Sascha Rosylight
a8823f5169 Merge branch 'master' into es2019 2019-02-07 10:08:26 +09:00
Kagami Sascha Rosylight
5a6dc081f6 revive esnext.asynciterable 2019-02-07 10:01:36 +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