Skip to content

Lexical scope comes before inherited scope #641

Closed
@peter-ahe-google

Description

@peter-ahe-google

$ cat fisk.dart
int x = 89;

class Foo {
  int x = 42;
}

class Bar extends Foo {
  m() => x;
}

main() {
  print(new Bar().m());
}

$ frogsh fisk.dart
42
$ dartc_test fisk.dart
89
$ cat fisk.dart

class x {
}

class Foo {
  int x = 42;
}

class Bar extends Foo {
  m() => x;
}

main() {
  print(new Bar().m());
}
$ frogsh fisk.dart
42
$ dartc_test fisk.dart
fisk.dart:9: x is a class and cannot be used as an expression
     8: class Bar extends Foo {
     9: m() => x;
Compilation failed with 1 problem.

FWIW, there are a bunch of tests in dart/compiler/javatests/com/google/dart/compiler/{resolver,type}. Karl is already working on porting the tests from the type directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-not-plannedClosed as we don't intend to take action on the reported issueweb-dart2js

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions