According to the spec, the type checker should reject this:
object foobar {
print(foobar.hash);
}
It does reject this:
object foobar {
print(hash);
}
And this:
object foobar {
print(this.hash);
}
Interestingly, it also rejects this:
class Foobar {
shared new foobar {}
print(foobar.hash);
}
However, the code path for, and specification of why, this should be rejected is totally separate. It should be unified, and treated as a "self reference".
According to the spec, the type checker should reject this:
It does reject this:
And this:
Interestingly, it also rejects this:
However, the code path for, and specification of why, this should be rejected is totally separate. It should be unified, and treated as a "self reference".