Skip to content
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

dartanalyzer/dart2js disagrees with VM about scoping rules #20074

Closed
mkustermann opened this issue Jul 16, 2014 · 6 comments
Closed

dartanalyzer/dart2js disagrees with VM about scoping rules #20074

mkustermann opened this issue Jul 16, 2014 · 6 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. web-dart2js
Milestone

Comments

@mkustermann
Copy link
Member

The following example:

  1 doit() {
  2 error(error) {
  3 print(error);
  4 }
  5 error('foobar');
  6 }
  7 main() {
  8 doit();
  9 }

Results in the following output of dartanalyzer/dart2js/dartvm:

$ dartanalyzer test.dart
Analyzing [test.dart]...
[error] The name 'error' is already defined (/usr/local/google/home/kustermann/test.dart, line 2, col 9)
1 error found.

$ dart2js --out=/tmp/foo.js test.dart
test.dart:2:3:
Error: Duplicate definition of 'error(error){print(error);}'.
  error(error) {
  ^^^^^
test.dart:2:9:
Info: Existing definition of 'error(error){print(error);}'.
  error(error) {
        ^^^^^
Error: Compilation failed.

$ dart test.dart
foobar

Dart-SDK version: 1.6.0-dev.3.0

lrn/ahe/I think that this is a bug in dartanalyzer/dart2js.

@floitschG
Copy link
Contributor

cc @johnniwinther.

@bwilkerson
Copy link
Member

I agree that analyzer is wrong in this case. The name of the function is defined in the scope of the body of the 'doit' method. The name of the parameter is defined in the function's parameter scope. There shouldn't be any conflict.


Removed Priority-Unassigned label.
Added Priority-Medium label.

@johnniwinther
Copy link
Member

Fixed for dart2js in r38847.

@stereotype441
Copy link
Member

Set owner to @stereotype441.
Added Started label.

@stereotype441
Copy link
Member

Fixed in revision 41621.


Added Fixed label.

@clayberg
Copy link

Added this to the 1.8 milestone.

@mkustermann mkustermann added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. web-dart2js labels Nov 28, 2014
@mkustermann mkustermann added this to the 1.8 milestone Nov 28, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. web-dart2js
Projects
None yet
Development

No branches or pull requests

6 participants