Closed
Description
If I have the following .analysis_options
file:
analyzer:
strong-mode:
- implicit-downcasts: false
- implicit-dynamic: false
and the following Dart file (taken from this example):
// test.dart
void main() {
Object o = new Object();
String s = o; // Implicit downcast
String s2 = s.substring(1);
}
and I run dartanalyzer test.dart
, it only reports:
[hint] The value of the local variable 's2' is not used
The same is true if I run dartanalyzer --strong --no-implicit-casts test.dart
. However, if I delete .analysis_options
and run dartanalyzer --strong --no-implicit-casts test.dart
, I get:
[error] A value of type 'Object' cannot be assigned to a variable of type 'String'
[hint] The value of the local variable 's2' is not used
I've tested this against Dart 1.20.1 and 1.19.0. I think the implicit-dynamic
flag has the same issue, but I don't know of a simple file to test it on.