Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
test.scala on constructor parameter shadowing
class LegalPerson(name: String) {
def aaaaaaaaaa = name
}
class DoomedPerson(name: String) extends LegalPerson(name) {
def curName = name
}
class AAAAA(val xxxx: Int)
class BBBBBB(xxxx: Int) extends AAAAA(xxxx) {
def ppppp() { println(xxxx) }
}
[[syntax trees at end of cleanup]] // test.scala
package <empty> {
class LegalPerson extends Object {
<paramaccessor> private[this] val name: String = _;
def aaaaaaaaaa(): String = LegalPerson.this.name;
def <init>(name: String): LegalPerson = {
LegalPerson.this.name = name;
LegalPerson.super.<init>();
()
}
};
class DoomedPerson extends LegalPerson {
<paramaccessor> private[this] val name: String = _;
def curName(): String = DoomedPerson.this.name;
def <init>(name: String): DoomedPerson = {
DoomedPerson.this.name = name;
DoomedPerson.super.<init>(name);
()
}
};
class AAAAA extends Object {
<paramaccessor> private[this] val xxxx: Int = _;
<stable> <accessor> <paramaccessor> def xxxx(): Int = AAAAA.this.xxxx;
def <init>(xxxx: Int): AAAAA = {
AAAAA.this.xxxx = xxxx;
AAAAA.super.<init>();
()
}
};
class BBBBBB extends AAAAA {
def ppppp(): Unit = scala.this.Predef.println(scala.Int.box((BBBBBB.super.xxxx(): Int)));
def <init>(xxxx: Int): BBBBBB = {
BBBBBB.super.<init>(xxxx);
()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment