Skip to content

v12 regression: explicitly annotated option return type with non-primative inner type causes compiler error #8055

@illusionalsagacity

Description

@illusionalsagacity

Thank you for filing! Check list:

  • Is it a bug? Usage questions should often be asked in the forum instead.
  • Concise, focused, friendly issue title & description.
  • A minimal, reproducible example.
  • OS and browser versions, if relevant.
  • Is it already fixed in master? Instructions

If the explicit type annotation contains an array, result, dict, or Null.t (I haven't tried exhaustively) it results in a compiler error when the function is called. This doesn't seem to happen with primative types however.

let foo = (): option<array<string>> => Some(["foo"])

let bar = foo()

results in

Type Errors
[E] Line 3, column 10:
This function has type unit => option<array>
It only accepts 1 argument; here, it's called with more.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions