Skip to content

Strict inference documentation uses obsolete example #4306

Open
@eernstg

Description

@eernstg

The documentation of the strict-inference static analysis option needs to be updated:

The section Example: Under-constrained generic method invocations explains that the following invocation of fold fails to infer safe types (and, consequently, it throws at run time):

void main() {
  var a = [1, 2, 3].fold(true, (s, x) => s + x);
}

However, the treatment of this invocation is quite different today because we now have horizontal inference. The typing is now safe, and the description of the run-time failure is wrong (and has been wrong since Dart 2.18).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThere is a mistake in the language specification or in an active document

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions