Skip to content

Analyzer and dart2js compute least upper bounds incorrectly for function types #23381

Closed
@leafpetersen

Description

@leafpetersen

The analyzer and dart2js both seem to treat the least upper bound of function types as always dynamic. This program generates no warnings:

void foo(bool b, int f(k), int g(int k)) {
  (b ? f : g).bar;
}

Per the spec (16.20), the type of the conditional expression should be the lub of the types of the arms of the conditional, and per 19.8.2, the lub of these two functions types should be dynamic -> int, which should generate a warning for this program.

Dart-to-JavaScript compiler (dart2js) version: 1.10.0-dev.1.5+2

dartanalyzer version 1.10.0-dev.1.5+2

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions