Skip to content

DDC prints nullable function types poorly #43112

@nshahan

Description

@nshahan

DDC does not correctly parenthesize when printing a function type to show nullability of the function.

Given the dart:

main() {
  var foo = (int Function()? fn) => fn == null ? 0 : fn();
  print(foo.runtimeType);
}

The vm and dart2js prints:

((() => int)?) => int

while ddc prints:

(() => int?) => int

Metadata

Metadata

Assignees

No one assigned

    Labels

    NNBDIssues related to NNBD ReleaseP2A bug or feature request we're likely to work onarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dev-compiler

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions