Skip to content

Abstract ancestor property accessors not resolving properly #33420

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

Open
rich-j opened this issue Jun 12, 2018 · 0 comments
Open

Abstract ancestor property accessors not resolving properly #33420

rich-j opened this issue Jun 12, 2018 · 0 comments
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. web-dev-compiler

Comments

@rich-j
Copy link

rich-j commented Jun 12, 2018

Virtual references in multi-level ancestors are not resolving properly. A simplified example of the issue happens with 3 levels of inheritance with declaration at the first level, reference at the second and definition at the third.

abstract class Base {
  String get id;
}

abstract class Enhanced extends Base {
  //String get id;      // <-- uncomment this and equality will work
  operator ==(other) => other is Enhanced && id == other.id;
}

class Obj extends Enhanced {
  String id = "id1";
}

Running the test case:

test("Equality test", (){
  final obj = new Obj();
  expect(obj, obj);
});

Results in a test failure because the equality check for obj fails. Add a declaration for id in the second level (the commented line in class Enhanced) and the equality check succeeds.

Dart VM version: 2.0.0-dev.60.0 (Mon Jun 4 22:09:13 2018 +0200) on "macos_x64"

Run with command pub run build_runner test -- -p chrome

@vsmenon vsmenon added the area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. label Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. web-dev-compiler
Projects
None yet
Development

No branches or pull requests

3 participants