New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making dart2js warnings consistent #11266
Comments
I forgot to mention that you can isolate the duplicate message as shown below, but I was showing the bigger example to highlight that this is hidden when there are other warnings around, and that it seems to happen on more complex code (any of the cases m1, m2, or m3 does't report "dead code"): main() { int compute(y) => y == 0 ? y : y * compute(y - 1); |
Added this to the M6 milestone. |
Set owner to @karlklose. |
Removed this from the 1.6 milestone. |
Removed Oldschool-Milestone-1.6 label. |
I found this strange bug in dart2js warnings. Consider the following code:
main() {
int x = compute(3);
m1(x);
m2(x);
m3(x);
m4(x);
}
void m4(int d) {
switch(d) {
default:
if (d > 10) {
throw "foo";
} else {
return;
}
d++;
}
}
void m3(int c) {
if (c > 10) {
throw "foo";
} else {
return;
}
c++;
}
void m2(int b) {
switch(b) {
default:
throw "a";
b++;
}
}
void m1(int a) {
throw "foo";
a++;
}
int compute(y) => y == 0 ? y : y * compute(y - 1);
program:warning.dart:17:7: Warning: unreachable code
d++;
^^^^
warning.dart:27:3: Warning: unreachable code
c++;
^^^^
warning.dart:34:7: Warning: unreachable code
b++;
^^^^
warning.dart:40:3: Warning: unreachable code
a++;
^^^^
Dart file warning.dart compiled to JavaScript: out.js
This looks great!
warning.dart:17:7: Warning: unreachable code
d++;
^^^^
warning.dart:17:7: Warning: dead code
d++;
^^^^
Dart file warning.dart compiled to JavaScript: out.js
Strangely: the error on d++ is reported twice, and the second time uses a different error message.
The text was updated successfully, but these errors were encountered: