-
Notifications
You must be signed in to change notification settings - Fork 2
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
work around naming conflicts for private class members #4
Comments
Also need to review all synthetic "fields" (for things like forward declared methods) to make sure they have unique names. |
Reopening. Still need to review synthetic fields. |
This works: shared void run() {
class C() {
String foo();
foo = () => "C";
shared String fooValueC => foo();
}
class D() extends C() {
String foo();
foo = () => "D";
shared String fooValueD => foo();
}
assert(D().fooValueC == "C");
assert(D().fooValueD == "D");
} because the synthetic names are based on the unique private member names. |
This currently works: shared void runBug4c() {
class C() {
shared String foo();
foo() => "hello C";
}
class D() extends C() {
String foo();
foo() => "hello D";
}
assert (C().foo() == "hello C");
} but somewhat by chance. The synthetic Callable for Edit: Indeed, |
These tests focus on synthetic variables, for #4
Tests added. Fixed! |
Dart "private" members of classes are polymorphic, at least within the same package. Ceylon non-
shared
members are not; a private member may shadow, but not override a super class member of the same name.So we need some way to distinguish
Super.x
fromSub.x
. The easiest (only?) approach may be to use globally (or at least module-wide) unique names for private members. This isn't a problem forinterface
s since static invocation is always used for non-shared interface members.The code below currently prints "B B" rather than "A B":
the problem can also occur with
outer
in a recursive member class:or on invocation of a static reference:
The text was updated successfully, but these errors were encountered: