Open
Description
Currently the API for expression compilation in the front end is provided a set of String
s representing
the variables in scope. CFE gives all these variables the type dynamic
. This can lead to some types being incorrectly inferred:
Source code:
class D<T> {
Y id<Y>(Y x) => x;
m(List<T> l);
foo() {
List<T> s;
// breakpoint here
}
}
Expression:
m(id(s = []))
Since the type of s
is seen as dynamic
, CFE will output:
method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr(dynamic s) → dynamic
return this.{main::D::m}(this.{main::D::id}(let dynamic _ = null in s = <dynamic>[]));
This will raise a runtime type error when entering m
, whereas if the user had actually written this expression at the breakpoint, it would run ok.