1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
class ScopeCls {
Int v;
init() {
init() { v = 20; }
}
Int get() {
Int v = 10;
v;
}
Int testScope() {
tester();
}
Int testScopeNoDot() {
// Note: due to equivalence of this.tester() and tester(this), this matches the member
// function since that one is closer in scope.
tester(this);
}
Int testScopeNoThis() {
noThis();
}
Str testClassCollision() {
classCollision.toS;
}
Int tester() {
v;
}
Int noThis() {
v;
}
Int classCollision() {
0;
}
}
Int tester(ScopeCls s) {
10;
}
Int noThis() {
10;
}
class classCollision {
init() {}
Str toS() : override {
return "class";
}
}
Int testScopeCls() {
ScopeCls c;
c.get;
}
Int testClassMember() {
ScopeCls c;
c.testScope;
}
Int testClassNonmember() {
ScopeCls c;
c.tester;
}
Int testClassNonmemberNoDot() {
ScopeCls c;
// Note: since we don't have explicit c.tester(), the 'tester' function is a better match since
// it is closer to us.
tester(c);
}
Int testClassMemberNoDot() {
ScopeCls c;
c.testScopeNoDot();
}
Int testClassNoThis() {
ScopeCls c;
c.testScopeNoThis();
}
Str testClassCollision() {
ScopeCls c;
c.testClassCollision();
}
|