Commit Graph

26711 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
0d93eb9218 Merge pull request #30133 from Microsoft/revert-conditional-type-invariance
Revert "Merge pull request #27697 from mattmccutchen/issue-27118"
2019-02-27 13:25:04 -08:00
Nathan Shively-Sanders
f77b43ca09 Update baselines 2019-02-27 12:42: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
Sheetal Nandi
4718ff8f21 Merge pull request #30110 from Microsoft/revertExecFileSync
Revert execFileSync
2019-02-27 10:52:49 -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
Sheetal Nandi
fd10c12116 Revert "Use execFileSync in typing installer"
This reverts commit bc386c11fd.
2019-02-26 14:01:42 -08:00
Sheetal Nandi
3e4b9c07d2 Revert "Do not wrap npm path with quotes"
This reverts commit 1ed5e1c63b.
2019-02-26 14:01:03 -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
Sheetal Nandi
4db4c58924 Merge pull request #30095 from Microsoft/nodeExecFileSync
Do not wrap npm path with quotes
2019-02-26 09:10:22 -08:00
Sheetal Nandi
1ed5e1c63b Do not wrap npm path with quotes
Fixes #30086
2019-02-25 19:50:53 -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
Wesley Wigham
0e858a6e16 Include misc script outputs in local build (#30092)
* Include other misc script outputs in local build

* Remove comment
2019-02-25 16:33:20 -08:00
Wesley Wigham
c2f1998387 Fix baseline accept when there are multiple .delete files (#30091) 2019-02-25 16:18:03 -08:00
Daniel Rosenwasser
9787021540 Merge pull request #30078 from Microsoft/updateNpmIgnore
Fix `.npmignore` by adding the `.git` file and the `.failed-tests` file.
2019-02-25 13:21:53 -08:00
Daniel Rosenwasser
c37254e509 Merge pull request #30062 from jwunderl/quick-fix-any-annotation
Remove any annotation from declare method quickfix
2019-02-24 23:18:06 -08:00
Daniel Rosenwasser
7a391fe613 Fix .npmignore by adding the .git file (as opposed to just a directory, which is not the case for git worktrees) and the .failed-tests file. 2019-02-24 23:05:48 -08:00
Joseph Wunderlich
d87e67df58 clarify intent in returnType creation 2019-02-22 18:00:21 -08:00
Joseph Wunderlich
21ab39649c remove any annotation from declare method quickfix 2019-02-22 17:24:21 -08:00
Wesley Wigham
a41a27694a Fix baseline-accept-rwc (#30052) 2019-02-22 13:12:11 -08:00
TypeScript Bot
999eb0b9ed Update user baselines (#30046) 2019-02-22 08:56:15 -08:00
Wesley Wigham
fb0dcd4987 Have runtests always throw on failure, make rm stream signal end of read queue (#30035) 2019-02-21 18:17:53 -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
ae836eb854 Merge pull request #30028 from Microsoft/betterOverloadErrors
Better overload incompatibility errors
2019-02-21 13:53:31 -08:00
Daniel Rosenwasser
d6bb3ee64c Accepted baselines. 2019-02-21 11:02:21 -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
b67f2d6bdf Remove jake (hopefully for real this time) (#29085)
* Remove jake (hopefully for real this time)

* Fix gulpfile non-lkg build, add sanity-check build to posttest on CI, accept older baseline style to go with lkgd build

* More docs/scripts jake -> gulp
2019-02-20 15:32:15 -08:00
Daniel Rosenwasser
4e3efc2e90 fix no space before equal operator in type parameter (#29990)
fix no space before equal operator in type parameter
2019-02-20 12:16:18 -08:00
xiaofa
7c8c6cf4d0 fix no space before equal operator in type parameter 2019-02-20 18:12:09 +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
Ryan Cavanaugh
9d9cfaff16 Merge pull request #29948 from tomholub/patch-1
update docs: dated build cmd
2019-02-19 10:23:56 -08:00
Anders Hejlsberg
ecfd40891f Accept new baselines 2019-02-18 07:25:22 -10:00
Anders Hejlsberg
059fd2d42e Never overwrite resolved type of symbol 2019-02-18 07:25:08 -10:00
Tom J
540aeb6073 update docs: dated build cmd
Hopefully I didn't miss something obvious.

Running `gulp build` as suggested causes the following:
```
$ gulp build
[18:26:11] Using gulpfile ~/git/TypeScript/Gulpfile.js
[18:26:11] Task never defined: build
[18:26:11] To list available tasks, try running: gulp --tasks
```

```
$ gulp --tasks
gulp --tasks
[18:21:26] Tasks for ~/git/TypeScript/Gulpfile.js
[18:21:26] ├── lib                           Builds the library targets
...
...
[18:21:27] ├─┬ default                       Runs 'local'
[18:21:27] │ └─┬ <series>
[18:21:27] │   └─┬ local
[18:21:27] │     └─┬ <series>
[18:21:27] │       ├── buildFoldStart
[18:21:27] │       ├─┬ <parallel>
[18:21:27] │       │ ├── generateLibs
[18:21:27] │       │ └─┬ <series>
[18:21:27] │       │   ├── buildScripts
[18:21:27] │       │   └── generateDiagnostics
[18:21:27] │       ├─┬ <parallel>
[18:21:27] │       │ ├── localize
[18:21:27] │       │ ├── buildTsc
[18:21:27] │       │ ├── buildServer
[18:21:27] │       │ ├─┬ <series>
[18:21:27] │       │ │ ├── flattenServicesConfig
[18:21:27] │       │ │ ├── buildTypescriptServicesOut
[18:21:27] │       │ │ ├── createTypescriptServicesJs
[18:21:27] │       │ │ ├── createTypescriptServicesDts
[18:21:27] │       │ │ ├── createTypescriptJs
[18:21:27] │       │ │ ├── createTypescriptDts
[18:21:27] │       │ │ └── createTypescriptStandaloneDts
[18:21:27] │       │ └─┬ <series>
[18:21:27] │       │   ├── flattenTsServerProject
[18:21:27] │       │   ├── buildServerLibraryOut
[18:21:27] │       │   ├── createServerLibraryJs
[18:21:27] │       │   └── createServerLibraryDts
[18:21:27] │       └── buildFoldEnd
[18:21:27] └── help                          Prints the top-level tasks.
```

The default task seems to do something useful:
```
$ gulp
[18:21:49] Using gulpfile ~/git/TypeScript/Gulpfile.js
[18:21:49] Starting 'default'...
[18:21:49] Starting 'local'...
[18:21:49] Starting 'buildFoldStart'...
[18:21:49] Finished 'buildFoldStart' after 726 μs
[18:21:49] Starting 'generateLibs'...
[18:21:49] Starting 'buildScripts'...
[18:21:49] Finished 'generateLibs' after 207 ms
[18:21:49] Finished 'buildScripts' after 686 ms
[18:21:49] Starting 'generateDiagnostics'...
[18:21:49] Finished 'generateDiagnostics' after 700 μs
[18:21:49] Starting 'localize'...
[18:21:49] Starting 'buildTsc'...
[18:21:49] Starting 'buildServer'...
[18:21:49] > /usr/bin/node scripts/generateLocalizedDiagnosticMessages.js src/loc/lcl built/local src/compiler/diagnosticMessages.generated.json
[18:21:49] Starting 'flattenServicesConfig'...
[18:21:49] Starting 'flattenTsServerProject'...
[18:21:49] Finished 'flattenServicesConfig' after 54 ms
[18:21:49] Starting 'buildTypescriptServicesOut'...
[18:21:49] Finished 'flattenTsServerProject' after 54 ms
[18:21:49] Starting 'buildServerLibraryOut'...
[18:21:53] Finished 'localize' after 3.38 s
[18:23:17] Finished 'buildTsc' after 1.45 min
[18:23:17] Finished 'buildServer' after 1.45 min
[18:23:17] Finished 'buildTypescriptServicesOut' after 1.45 min
[18:23:17] Starting 'createTypescriptServicesJs'...
[18:23:17] Finished 'buildServerLibraryOut' after 1.45 min
[18:23:17] Starting 'createServerLibraryJs'...
[18:23:17] Finished 'createServerLibraryJs' after 635 ms
[18:23:17] Starting 'createServerLibraryDts'...
[18:23:18] Finished 'createTypescriptServicesJs' after 642 ms
[18:23:18] Starting 'createTypescriptServicesDts'...
[18:23:18] Finished 'createTypescriptServicesDts' after 20 ms
[18:23:18] Starting 'createTypescriptJs'...
[18:23:18] Finished 'createServerLibraryDts' after 30 ms
[18:23:18] Finished 'createTypescriptJs' after 260 ms
[18:23:18] Starting 'createTypescriptDts'...
[18:23:18] Finished 'createTypescriptDts' after 4.47 ms
[18:23:18] Starting 'createTypescriptStandaloneDts'...
[18:23:18] Finished 'createTypescriptStandaloneDts' after 5.59 ms
[18:23:18] Starting 'buildFoldEnd'...
[18:23:18] Finished 'buildFoldEnd' after 350 μs
[18:23:18] Finished 'local' after 1.48 min
[18:23:18] Finished 'default' after 1.48 min
```

I'm I'm guessing wrongly, please reject & correct the docs to whatever the right way to run builds is.
2019-02-17 18:28:32 +00:00
Sheetal Nandi
b2b360a64f Merge pull request #29816 from Microsoft/ti
Use execFileSync in typing installer
2019-02-15 10:47:04 -08: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
Nathan Shively-Sanders
ed8c81a563 Update lodash dependency (#29903)
For security reasons
2019-02-14 14:56:22 -08:00
Anders Hejlsberg
b57956673e Move TypeFlags.PropapatingFlags to ObjectFlags to free up 3 flags 2019-02-14 14:42:55 -08:00