This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
task mode: field initializer inference is overriding explicit LHS type #350
Closed
Description
For the field type inference issue, we're seeing extra casts like:
Zone._current = dart.as(zone, _RootZone);even though _current is declared in Dart as:
static Zone _current = _ROOT_ZONE;It appears that the rhs expression type is incorrectly overriding the lhs declared type.
I've also seen this in 'casts in constant contexts' in checker test:
class A {
static const num n = 3.0;
static const int i = /*info:AssignmentCast*/n;
final int fi;
const A(num a) : this.fi = /*info:DownCastImplicit*/a;
}
class B extends A {
const B(Object a) : super(/*info:DownCastImplicit*/a);
}
void foo(Object o) {
var a = const A(/*info:DownCastImplicit*/o);
}
The i = n
initializer fails with a static type error because it thinks n
is double
instead of num
like it should be.