@facebook-github-bot facebook-github-bot released this Aug 17, 2018 · 31 commits to master since this release

Assets 7

Notable bug fixes:

  • If a server was not already started, running flow status --flowconfig-name 'name'
    would start a server without taking into account the new flowconfig name. The same
    is true for running flow without any command specified. This changes this by
    passing the name to the new server.

@facebook-github-bot facebook-github-bot released this Aug 16, 2018 · 31 commits to master since this release

Assets 7

Likely to cause new Flow errors:

  • A fix in requiring annotations on exports: Flow uses type variables for
    unannotated program parts. To facilitate inference, these type variables may
    not appear in input positions of exports. Before, Flow would not complain if a
    type variable appeared in both an output and an input position of an export
    (in that order), as the first occurrence marked the use of the type variable
    as legitimate. Now, Flow analyzes exports in a polarity-sensitive way and will
    require an annotation in the above scenario.

New Features:

  • Saved state:
    • Added an initialization path, where instead of parsing every file dependency,
      it loads the expected results for each available file from the saved state.
    • A hash is stored for each file in the saved state to determine whether it has been
      modified and therefore needs to be reparsed after the state is loaded. This way,
      saved state servers can skip parsing files that are unchanged.
    • If loading saved state fails, Flow falls back to a full initialization, unless
      --saved-state-no-fallback is passed in which case Flow fails.
    • Saved state tests are included in the automated testing framework.
  • Profiling was refactored to support hierarchical profiling. That is:
    • Support running timers inside of other timers.
    • Support merging a finished profiling object (like from a recheck) into the
      currently running profiling object (like from handling a command).
  • Cancelable workloads (jobs that handle commands). If Flow determines that a file
    has changed while handling a command, it stops, performs a recheck, and then
    re-runs the workload from scratch.
  • The Flow diff checker became more fine-grained, by including comparisons at the
    level of loops and variable declarations.
  • Added a name field in the [options] portion of .flowconfig.

Notable bug fixes:

  • Send the server logging context to the LSP command and use that when logging
    success and failure events instead of the LSP command's context (which is logged
    as the client context).
  • Fixed stack overflow when running flow --json with a large error output, by
    moving to a tail-recursive implementation.
  • Fixed string literal printing in flow suggest.

Misc:

  • Library definition improvements for React$Context.Provider and
    CanvasRenderingContext2D.imageSmoothingQuality.
  • Typed AST: The constraint generation phase returns a version of the AST that
    includes a type for each program node.
  • Added doc details for $Shape.
  • The changes in saved state were followed by code refactorings in various checking
    modules (types_js.ml, merge_service.ml, rechecker.ml, etc.).

@fishythefish fishythefish released this Aug 3, 2018

Assets 7

New Features:

  • Added the unnecessary-invariant lint, which will flag uses of invariant when Flow can determine that the predicate must be truthy.
  • find-refs now traverses union types.
  • The --flowconfig-name flag now allows you to specify the name of the flowconfig.
  • Added a file_watcher option for .flowconfig.
  • Rechecks will now stop and restart as soon as Flow notices other file changes. The previous behavior was to finish the recheck and then start a new recheck. The new behavior is currently off by default and can be enabled by setting experimental.cancelable_rechecks=true in .flowconfig.
    Note: This feature is experimental. When it stabilizes, the flag will be removed and this feature will be enabled by default.

Notable bug fixes:

  • flow-upgrade should no longer trigger ENOENT on Windows.
  • Running Flow with --profile should no longer throw on Windows.
  • Suppression comments preceding lint errors for disabled lints should now be correctly considered unused and trigger unused suppression warnings.
  • ArrayBuffer's static indexer property is now correctly marked covariant. This should prevent errors like this one.
  • Fixed a bug in which the polarity of a type parameter was propagated to all subsequent type parameters, causing errors when covariant type parameters followed contravariant or invariant ones.
    This bug is demonstrated by the difference in behavior of the following examples:

Misc:

  • Flow now prints array types as Array<T> instead of T[] in JavaScript output.
  • Flow now prints {foo:x} as { foo: x } in JavaScript output, as Prettier does.
  • Library definition changes:
    • Added destroyed to net$Socket.
    • Added document.scrollingElement.
    • Added dgram$Socket$rinfo to the Node library definitions.
    • Added WebAssembly library definitions.
    • Added the groups property to RegExp$matchResult.

@facebook-github-bot facebook-github-bot released this Jul 21, 2018 · 172 commits to master since this release

Assets 7

New Features:

Notable bug fixes:

  • Fix server crash on persistent-command unhandled exception

Misc:

  • Library type definition changes: created explicit type for Context, added readAsBinaryString to FileReader
  • AST differ utility to power rename
  • More uniform bucketing of jobs to be run in parallel leads to higher CPU utilization
  • Improvements to type printing
  • Treat getters and setters as proto fields

Parser:

  • Optimization when saving comments

@facebook-github-bot facebook-github-bot released this Jul 6, 2018 · 240 commits to master since this release

Assets 7

Likely to cause new Flow errors:

  • Flow now only allows subtyping polymorphic types with the same number of type parameters. This added strictness lets Flow avoid some slow typing code and shouldn't cause too many problems.

New Features:

  • New [silence] section in the .flowconfig which can suppress all errors in 1 or more files. Thanks @LegNeato! (#4916)
  • Added flow server --file-watcher watchman flag which uses Watchman for file watching instead of the builtin file-watcher, dfind
  • Added a --expand-type-aliases flag to type-at-pos. It replaces type aliases with their bodies in the returned type.
  • Added flow save-state command to generate a saved state file (experimental & loading a saved state isn't ready yet)

Notable bug fixes:

  • Fixed type-at-pos for B in import type { A as B } from 'M';
  • Fixed find-refs, autocomplete, get-def, etc for $Facebookism$Idx

Misc:

  • Bunch of improvements to the libdefs. Thanks everyone for the PRs!
  • Handful of improvements to the type normalizer, which improves the type-at-pos output
  • Tweaked error messages for + operator to match other binary operators

@facebook-github-bot facebook-github-bot released this Jun 21, 2018 · 353 commits to master since this release

Assets 7

Likely to cause new Flow errors:

  • Added return type to RegExp.prototype.match() (thanks @peter-leonov!)
  • Fixed callable property lookup rules to no longer walk the prototype chain
  • Made it an error to import a type via destructuring on a require call (use import type instead)
  • Made the type of Array.of stricter (thanks @wchargin!)

New Features:

  • Added typing rules to support {| |} as a subtype of { +p?: T }
  • Added support for optional catch bindings (thanks @cpojer!)
  • Improved performance of enum equality checks
  • Added support for [[call]] syntax in objects and interfaces
  • Many improvements to flow find-refs command
  • Many improvements to LSP support

Notable bug fixes:

  • Fixed crash when refining a non-value

Misc:

  • Updated node.js libdefs (thanks @hcz!)
  • Fixed some flakiness in the LSP tests
  • Added libdefs for ECDH class (thanks @eleith!)
  • Added --check flag to flow ast command
  • Added filter property to CanvasRenderingContext2D libdef
  • Added timingSafeEqual method to node crypto module (thanks @n-johnson!)

Parser:

  • Added Decorator node, matching estree

@facebook-github-bot facebook-github-bot released this Jun 7, 2018 · 438 commits to master since this release

Assets 7

Likely to cause new Flow errors:

  • Flow now performs exactness checks that were previously skipped in some cases (e.g when $ObjMap is used on an exact type).

New Features:

  • Significant progress towards supporting the LSP (Language Server Protocol) natively.
  • Allow custom module resolvers (experimental, only works with the haste resolver system).
  • Flow lints for unnecessary optional chaining.

Notable bug fixes:

  • Allow autocomplete to work with optional chaining.
  • Only report status as GCing when actually GCing.

Misc:

  • Improve the args used when launching child processes to give more information about the process when you run ps.
  • Add a max_literal_length option to .flowconfig which replaces a magic constant.
  • Multi-hop (indirect) find-refs now supports class instances.
  • Revamp find-refs on ES6 named exports to improve reliability.
  • Allow internal slot properties to be optional.
  • Improve shutdown of the server monitor process.
  • Try to gracefully stop server process when monitor exits.
  • Print server status updates on new lines when Flow is not called from a tty.
  • Add additional properties to the react-dom/server libdef.
  • Add 'as' property to the HTMLLinkElement libdef.
  • Add a libdef for the Asynchronous Clipboard API.
  • Update libdef for Clients.matchAll to return an Array rather than an Iterator.

Parser:

  • Rename InterfaceType to InterfaceTypeAnnotation.

@facebook-github-bot facebook-github-bot released this May 24, 2018 · 515 commits to master since this release

Assets 7

Likely to cause new Flow errors:

New Features:

  • Inline interface types (var foo: interface { x: string } = bar;). Will be particularly useful in the future when we revamp object types

Notable bug fixes:

  • flow find-refs threw an exception when used with an unchecked file. Now it treats the file as if it were checked, like other single-file commands do
  • flow type-at-pos now returns the class name for declare class declarations.

Misc:

  • Added .mjs to the list of extensions that Flow reads by default
  • Perf improvements to calculating the dependency graph during recheck. Should help recheck perf on large repositories.
  • flow find-refs --multi-hop now parallelizes the work and is much faster
  • Support using flow find-refs and flow get-def with destructuring patterns as a starting location
  • Support using flow find-refs with default (as in export default ...) as a starting location
  • Bunch of small fixes where flow find-refs would miss certain locations
  • Tweaked the location returned for flow get-def when used for default and named imports
  • Lots of libdef updates. Thanks for the PRs!

Parser:

  • Inline interface type support

@facebook-github-bot facebook-github-bot released this May 9, 2018 · 618 commits to master since this release

Assets 7

Likely to cause new Flow errors:

  • We've made explicit the order in which imports are merged into a module during typechecking.
    This fixes an edge case in which lazy modes and non-lazy modes would report different errors.
    This may change the order in which code is typechecked, and therefore may expose errors that Flow previously missed.
  • Treat $Exact<empty> as empty. Before, ({p:0}:$Exact<empty>) was not an error due to
    missing ground subtyping and decomposition cases. It is now an error.
  • The $Either<T>, $All<T> and $Type<T> types are not supported any more.

New Features:

  • Find-refs now includes references to all types related to an object literal through subtyping,
    and a multi-hop mode was added that determines when object types are related through subtyping
    and links them.
  • Work towards the new object model:
    • Ensure fields overwrite methods in interface definitions (since properties there are flat).
    • Store proto fields in a separate map than the one used for own properties in classes.
    • Declare Function.prototype.bind as a proto field.
  • New/call can now be passed explicit type arguments for polymorphic instantiation. Currently this is
    supported by the Flow parser. Babylon support does not exist, but it is planned.
  • Made * a deprecated type, under the deprecated-type strict flag.
  • Added support for hover, completion and error reporting (publishDiagnostics) to flow LSP.
  • Implemented nullish coalescing as per the TC39 proposal.
  • Added a debug flag --expand-json-output to print an extended JSON output for type-at-pos.
  • Updates in typings:
    • Added the definition for onclose to the IDBDatabase interface in lib/indexeddb.js
      (reference).
    • Added onmessageerror to Worker interface and fixed type of MessagePort.onmessage
      in lib/bom.js.
    • Added a swap64() to the Buffer type and a Buffer property in lib/node.js.
    • Added Intl objects for the built-in JS language API (ECMA-402 - Internationalization API).
    • Added tuple types to WebGL uniform**v setters in lib/dom.js.

Notable bug fixes:

  • LSP: Fixed races in reporting exit status over persistent connection and in test.
  • Fixed error reporting when accessing statics and simplified error localization.

Misc:

  • Added documentation for Object type, "Flow for Atom IDE" in Atom plugins, Flow Strict
    and the nonstrict-import lint rule.
  • LSP supports file edits. Each client now stores the content of files that are opened.
  • Added LSP test checking that contents of open files persist after restart.
  • Removed Travis from CIs.
  • Type normalizer: added option to flag cases where the inferred type parameter is shadowed
    by another parameter with the same name, and fixed support for recursive polymorphic types.
  • Removed dependency on ocp-build (windows now uses ocamlbuild).
  • Introduced a union-find/disjoint-set data structure
    used in find-refs to maintain sets of related types.
  • Fixed return types for WebGLRenderingContext#is* methods to all return booleans.
  • Rearranged contents of src/server directory.
  • Refactored find-refs by splitting variable and property handling in separate files,
    and breaking down functions based on their purpose (e.g. local vs global).
  • Made $Subtype and $Supertype "unclear" types when not in a library context.
  • type-at-pos now prints types at the client-side.
  • Minimum OCaml version is increased to 4.05.0.
  • Avoid redundant substitution by caching the result of substituting a polymorphic
    definition with a list of type args.

Parser:

  • Added support for nullish coalescing ?? (as above).
  • Simplified object type parsing. Dangling + or static inside an object type
    (e.g. {+}) are now disallowed.
  • Added support for a proto modifier in declare class, to specify that the property is
    a prototype property instead of a class one.
  • Internal slot properties in object types (e.g. [[new]]).
  • Explicit type arguments in new and call expressions, e.g., f<T>(x).
  • Allow reserved words as optional chain property names.

@facebook-github-bot facebook-github-bot released this Apr 27, 2018 · 759 commits to master since this release

Assets 7

Likely to cause new Flow errors:

  • The result of the unary minus (negation) operator would sometimes be incorrectly generalized to
    number rather than a literal type. This has been fixed.
  • Further restrictions on module and exports. The disallowed patterns include computed property
    accesses as well as clobbering or aliasing module and/or exports.
    • These restrictions are only enabled if experimental.well_formed_exports=true is specified in
      .flowconfig.

New Features:

  • Fragment has been added to the default exports of the React libdef.
  • Invoking find-refs on a property key in a type declaration will now also yield that key in
    object literals.
  • Files can now be marked @flow strict-local. This mode is the same as @flow strict, except it
    does not require dependencies to also be strict. @flow strict is still the recommended mode, but
    @flow strict-local allows enabling strict checking for files before all dependencies can be made
    strict. Once all the dependencies are strict, a @flow strict-local file can be upgraded to a
    @flow strict file. A @flow strict file cannot depend on a @flow strict-local file.
  • Type support for the Stage 1
    Optional Chaining proposal. To use this
    feature, set esproposal.optional_chaining=enable in your .flowconfig.
    • Note: We currently disallow calls whose callees are member expressions when the call or member
      is part of an optional chain. This restriction will be lifted in the future when we reconcile the
      optional chaining implementation with our implementation of method calls.

Notable bug fixes:

  • The type normalizer now correctly tracks the scope of type parameters instead of assuming they
    share the scope of the type definition.
  • Test output files are cleared before running tests. This prevents old errors from being printed on
    subsequent failing runs when those runs do not produce errors.
  • estree_translator properly handles all cases of the DeclareClass AST node.
  • The suggest command has been fixed to work with the new type normalizer.
  • When evaluating spreads inside array literals, we determine the element type early, preventing
    exponential complexity and infinite loops.
  • Object spread in JSX props now preserves exactness.

Misc:

  • Various improvements to find-refs.
  • Optimizations for polymorphic subtyping.
  • Adds CircleCI for continuous integration and migrates the flow.org build from Travis to Circle.
  • New tests for LSP support (disabled by default).
  • Certain exceptions will now print backtraces in addition to the exception string.
  • Improvements to spreading in array literals.
  • Support for Flow coverage reports using codecov.io.

Parser:

  • The AST has been updated to use snake_case for record fields rather than camelCase. Some field
    names have also been updated.
  • Support has been added for the
    Numeric Separators proposal, currently
    Stage 3.
  • The AST representation for Optional Chaining
    has been updated to use new OptionalMember and OptionalCall nodes instead of the existing
    Member and Call nodes, and parentheses now correctly limit the scope of short-circuiting.
    This reflects the current Babel implementation.