Open alan-knight opened 6 years ago
@alan-knight - do you remember if this is a compile time error?
It's definitely a compile-time error. (I think it always was).
For comparison, this is what dart2js writes as error:
Error: Can't declare 'response' because it was already used in this scope.
var response = 42;
^^^^^^^^
lib/main.dart:2:9:
Info: Previous use of 'response'.
print(response);
^^^^^^^^
Version 2_0_0_dev_69_5 , Linux
Code like
Gives an error message on the second line that the variable "response" cannot be used before it is declared. This is confusing. It makes sense the compiler because response has been shadowed, and the shadowed variable isn't visible yet, but could be quite confusing for users, as there is clearly a variable response and it's clearly in scope from the line directly before.