Skip to content

Relax function subtyping between optional and non-optional parameters #7777

Closed
@munificent

Description

@munificent

I just checked in this patch: https://codereview.chromium.org/11794051/

This changes a line of code from:

  process.onExit = completer.complete;

to:

  process.onExit = (exitCode) => completer.complete(exitCode);

You'll note this appears to be a pointless lambda that just forwards. The reason is that Completer.complete takes an optional argument, and the type of process.onExit here has a mandatory positional argument. The original code thus fails in checked mode with a type error.

Peter saw this patch and said:

> FYI. Lars and I talked about this yesterday. I think we should change the subtype rule. You should file a bug.

And here it is.

Metadata

Metadata

Assignees

Labels

area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions