Skip to content

Commit

Permalink
v0.86.0
Browse files Browse the repository at this point in the history
Reviewed By: gabelevi

Differential Revision: D12968159

fbshipit-source-id: f493d270b3cebe7056d42a763aebb06213d3027c
  • Loading branch information
Mayank Patke authored and facebook-github-bot committed Nov 8, 2018
1 parent 88afb18 commit 52b3700
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 24 deletions.
43 changes: 43 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
### 0.86.0

Likely to cause new Flow errors:
* New errors may arise from generic definitions which lack the necessary annotations. Flow does not infer generic types, and the types it used to infer in their place occasionally masked errors. The types it now infers are still not generic, but will mask fewer errors.
* Fixed bug in union type checking which caused Flow to miss some errors when used in conjunction with generics and certain [utility types](https://flow.org/en/docs/types/utilities/).
* Improvements to constraints involving `any` may result in new errors.

New Features:
* `type-at-pos` can reconstruct spread objects when evaluation of the spread is not possible.
* `type-at-pos` now supports implicit instantiation with `_`.
* Added core types `$ReadOnlyMap`, `$ReadOnlyWeakMap`, `$ReadOnlySet`, and `$ReadOnlyWeakSet`. These types and their mutable counterparts mostly follow the pattern of `$ReadOnlyArray` and `Array`: the read-only parent class provides non-mutating methods, and the usual mutable class extends it. **Unlike `$ReadOnlyArray`, the new types are _invariant_ in their type parameters.**
* Added the `React.StrictMode` type.
* Added the [`flowtest` package](https://github.com/facebook/flow/tree/master/packages/flowtest). `flowtest` is a CLI tool for running tests on Flow types.
* Added the `sharedmemory.heap_size` option.

Notable bug fixes:
* Restructured file signatures to support overloading in exports.
* Allow named exports in exact `module.exports` objects.
* Fixed forward references for `declare function`.
* Various bug fixes to the type normalizer and to `type-at-pos`.
* `flow suggest` no longer outputs `<<anonymous class>>`.
* Imported symbols should no longer appear `Remote` in `type-at-pos`.

Misc:
* Improved formatting in JavaScript output.
* Improved the way the element type of an array is determined.
* Various improvements to the AST differ.
* `WeakMap` keys must now be objects.
* Improved profiling for error collation and formatting.
* When a union lower bound flows into a union upper bound, if both unions are enums, we use the underlying set representation to handle this in O(n log n) time instead of quadratic time.
* The type normalizer properly represents utility types instead of treating them as generics.
* The type normalizer provides more accurate information about generics.
* Flowing a string lower bound into a union upper bound occurs in O(log n) instead of O(n) when the union is an enum.
* CJS modules' namespace objects are now treated as covariant.
* The type normalizer reconstructs literal types more precisely when `preserve_inferred_literal_types` is set. This does not change the behavior of `type-at-pos`.
* Deleted the `experimental.cancelable_rechecks` option.

Parser:
* Removed the deprecated `expression` field from `Function` nodes in the AST.
* Enabled some tail call optimizations in `flow_parser.js` which should cause it to stack overflow in fewer cases.
* The layout generator no longer prints empty statements as `{}` instead of `;` in pretty mode.
* Allow anonymous function parameter types inside generics inside arrow function return types. For example, we disallow `var x = (): (string) => number => 123` because the first `=>` is ambiguous. However, `var x = (): T<(string) => number> => 123` is not ambiguous and we no longer disallow it.

### 0.85.0

Likely to cause new Flow errors:
Expand Down
2 changes: 1 addition & 1 deletion opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "1.2"
name: "flowtype"
version: "0.85.0"
version: "0.86.0"
maintainer: "[email protected]"
homepage: "https://flow.org"
dev-repo: "https://github.com/facebook/flow.git"
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-parser-bin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flow-parser-bin",
"version": "0.85.0",
"version": "0.86.0",
"description": "The Flow JavaScript parser, via bindings to the native OCaml implementation",
"main": "index.js",
"repository": "https://github.com/facebook/flow.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flow-parser",
"version": "0.85.0",
"version": "0.86.0",
"description": "JavaScript parser written in OCaml. Produces ESTree AST",
"homepage": "https://flow.org",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/common/flow_version.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* LICENSE file in the root directory of this source tree.
*)

let version = "0.85.0"
let version = "0.86.0"
2 changes: 1 addition & 1 deletion src/parser/META
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name="parser_flow"
version="0.85.0"
version="0.86.0"
requires = "sedlex wtf8"
description="flow parser ocamlfind package"
archive(byte)="parser_flow.cma"
Expand Down
2 changes: 1 addition & 1 deletion src/parser/opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "1.2"
name: "flow_parser"
version: "0.85.0"
version: "0.86.0"
maintainer: "[email protected]"
authors: ["Flow Team <[email protected]>"]
homepage: "https://github.com/facebook/flow/tree/master/src/parser"
Expand Down
24 changes: 12 additions & 12 deletions tests/json2_output/json2_output.exp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions tests/json_exit/json_exit.exp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{"flowVersion":"0.85.0","exit":{"code":12,"reason":"Could_not_find_flowconfig","msg":"Could not find file or directory pants; canceling search for .flowconfig.\nSee \"flow init --help\" for more info"}}
{"flowVersion":"0.86.0","exit":{"code":12,"reason":"Could_not_find_flowconfig","msg":"Could not find file or directory pants; canceling search for .flowconfig.\nSee \"flow init --help\" for more info"}}
{
"flowVersion":"0.85.0",
"flowVersion":"0.86.0",
"exit":{
"code":12,
"reason":"Could_not_find_flowconfig",
"msg":"Could not find file or directory pants; canceling search for .flowconfig.\nSee \"flow init --help\" for more info"
}
}
{"flowVersion":"0.85.0","exit":{"code":64,"reason":"Commandline_usage_error","msg":"flow: --pants unknown option\nUsage: flow check [OPTION]... [ROOT]\n\nDoes a full Flow check and prints the results.\n\nFlow will search upward for a .flowconfig file, beginning at ROOT.\nROOT is assumed to be the current directory if unspecified.\n\n --all Typecheck all files, not just @flow\n --color Display terminal output in color. never, always, auto (default: auto)\n --debug Print debug info during typecheck\n --declaration Specify one or more patterns, comma separated, for files to treat as declarations\n --flowconfig-name Set the name of the flow configuration file. (default: .flowconfig)\n --from Specify client (for use by editor plugins)\n --help This list of options\n --ignore Specify one or more ignore patterns, comma separated\n --ignore-version Ignore the version constraint in .flowconfig\n --include Specify one or more include patterns, comma separated\n --include-suppressed Ignore any `suppress_comment` lines in .flowconfig\n --include-warnings Include warnings in the error output (warnings are excluded by default)\n --json Output results in JSON format\n --json-version The version of the JSON format (defaults to 1)\n --lib Specify one or more lib files/directories, comma separated\n --lints Specify one or more lint rules, comma separated\n --max-warnings Warnings above this number will cause a nonzero exit code (implies --include-warnings)\n --max-workers Maximum number of workers to create (capped by number of cores)\n --merge-timeout The maximum time in seconds to attempt to typecheck a file or cycle of files. 0 means no timeout (default: 100)\n --message-width Sets the width of messages but not code snippets (defaults to the smaller of 120 or the terminal width)\n --munge-underscore-members Treat any class member name with a leading underscore as private\n --no-flowlib Do not include embedded declarations\n --no-saved-state Do not load from a saved state even if one is available\n --one-line Escapes newlines so that each error prints on one line\n --pretty Pretty-print JSON output (implies --json)\n --profile Output profiling information\n --quiet Suppress output about server startup\n --saved-state-fetcher Which saved state fetcher Flow should use (none, local) (default: none)\n --saved-state-no-fallback If saved state fails to load, exit (normally fallback is to initialize from scratch)\n --sharedmemory-dep-table-pow The exponent for the size of the shared memory dependency table. The default is 17, implying a size of 2^17 bytes\n --sharedmemory-dirs Directory in which to store shared memory heap (default: /dev/shm/)\n --sharedmemory-hash-table-pow The exponent for the size of the shared memory hash table. The default is 19, implying a size of 2^19 bytes\n --sharedmemory-log-level The logging level for shared memory statistics. 0=none, 1=some\n --sharedmemory-minimum-available Flow will only use a filesystem for shared memory if it has at least these many bytes available (default: 536870912 - which is 512MB)\n --show-all-branches Print all branch errors (the default is to print the most relevant branches)\n --show-all-errors Print all errors (the default is to truncate after 50 errors)\n --strip-root Print paths without the root\n --temp-dir Directory in which to store temp files (default: FLOW_TEMP_DIR, or /tmp/flow/)\n --traces Outline an error path up to a specified level\n --unicode Display terminal output with unicode decoration. never, always, auto (default: auto)\n --untyped Specify one or more patterns, comma separated, for files to treat as untyped\n --verbose Print verbose info during typecheck\n --verbose-depth Recursively print types up to specified depth (default 1, implies --verbose)\n --verbose-flowlib Print verbose info while initializing the flowlib\n --verbose-indent Indent verbose info during typecheck (implies --verbose)\n --weak Typecheck with weak inference, assuming dynamic types by default"}}
{"flowVersion":"0.86.0","exit":{"code":64,"reason":"Commandline_usage_error","msg":"flow: --pants unknown option\nUsage: flow check [OPTION]... [ROOT]\n\nDoes a full Flow check and prints the results.\n\nFlow will search upward for a .flowconfig file, beginning at ROOT.\nROOT is assumed to be the current directory if unspecified.\n\n --all Typecheck all files, not just @flow\n --color Display terminal output in color. never, always, auto (default: auto)\n --debug Print debug info during typecheck\n --declaration Specify one or more patterns, comma separated, for files to treat as declarations\n --flowconfig-name Set the name of the flow configuration file. (default: .flowconfig)\n --from Specify client (for use by editor plugins)\n --help This list of options\n --ignore Specify one or more ignore patterns, comma separated\n --ignore-version Ignore the version constraint in .flowconfig\n --include Specify one or more include patterns, comma separated\n --include-suppressed Ignore any `suppress_comment` lines in .flowconfig\n --include-warnings Include warnings in the error output (warnings are excluded by default)\n --json Output results in JSON format\n --json-version The version of the JSON format (defaults to 1)\n --lib Specify one or more lib files/directories, comma separated\n --lints Specify one or more lint rules, comma separated\n --max-warnings Warnings above this number will cause a nonzero exit code (implies --include-warnings)\n --max-workers Maximum number of workers to create (capped by number of cores)\n --merge-timeout The maximum time in seconds to attempt to typecheck a file or cycle of files. 0 means no timeout (default: 100)\n --message-width Sets the width of messages but not code snippets (defaults to the smaller of 120 or the terminal width)\n --munge-underscore-members Treat any class member name with a leading underscore as private\n --no-flowlib Do not include embedded declarations\n --no-saved-state Do not load from a saved state even if one is available\n --one-line Escapes newlines so that each error prints on one line\n --pretty Pretty-print JSON output (implies --json)\n --profile Output profiling information\n --quiet Suppress output about server startup\n --saved-state-fetcher Which saved state fetcher Flow should use (none, local) (default: none)\n --saved-state-no-fallback If saved state fails to load, exit (normally fallback is to initialize from scratch)\n --sharedmemory-dep-table-pow The exponent for the size of the shared memory dependency table. The default is 17, implying a size of 2^17 bytes\n --sharedmemory-dirs Directory in which to store shared memory heap (default: /dev/shm/)\n --sharedmemory-hash-table-pow The exponent for the size of the shared memory hash table. The default is 19, implying a size of 2^19 bytes\n --sharedmemory-log-level The logging level for shared memory statistics. 0=none, 1=some\n --sharedmemory-minimum-available Flow will only use a filesystem for shared memory if it has at least these many bytes available (default: 536870912 - which is 512MB)\n --show-all-branches Print all branch errors (the default is to print the most relevant branches)\n --show-all-errors Print all errors (the default is to truncate after 50 errors)\n --strip-root Print paths without the root\n --temp-dir Directory in which to store temp files (default: FLOW_TEMP_DIR, or /tmp/flow/)\n --traces Outline an error path up to a specified level\n --unicode Display terminal output with unicode decoration. never, always, auto (default: auto)\n --untyped Specify one or more patterns, comma separated, for files to treat as untyped\n --verbose Print verbose info during typecheck\n --verbose-depth Recursively print types up to specified depth (default 1, implies --verbose)\n --verbose-flowlib Print verbose info while initializing the flowlib\n --verbose-indent Indent verbose info during typecheck (implies --verbose)\n --weak Typecheck with weak inference, assuming dynamic types by default"}}
{
"flowVersion":"0.85.0",
"flowVersion":"0.86.0",
"exit":{
"code":64,
"reason":"Commandline_usage_error",
Expand Down
2 changes: 1 addition & 1 deletion tests/version/version.exp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Wrong version of Flow. The config specifies version 0.1.0 but this is version 0.85.0
Wrong version of Flow. The config specifies version 0.1.0 but this is version 0.86.0
2 changes: 1 addition & 1 deletion website/en/docs/_install/setup-npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ npm install --save-dev flow-bin
"name": "my-flow-project",
"version": "1.0.0",
"devDependencies": {
"flow-bin": "^0.85.0"
"flow-bin": "^0.86.0"
},
"scripts": {
"flow": "flow"
Expand Down

0 comments on commit 52b3700

Please sign in to comment.