Skip to content

Strong-mode should fill omitted type parameters with type bound instead of dynamic? #26310

Closed
@ochafik

Description

@ochafik

Context: I found many usages of class Rectangle<T extends num> with the non-generic raw type Rectangle. Seems like it's treated by strong-mode as Rectangle<dynamic>, while it would seem it could / should be Rectangle<num>:

import 'dart:math';

foo(Rectangle r) => bar(r);
//                      ^
// [error] Unsound implicit cast from Rectangle<dynamic> to Rectangle<num>
bar(Rectangle<num> r) => null;

(tested with 1.16.0-dev.2.0)

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failureslegacy-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