- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
this.type strangeness
Sat, 2009-02-28, 23:16
Hi, all:
===
class A {
def b(): this.type = {
val r = this
r
}
}
===
Fails to compile: found : r.type (with underlying type A) required:
A.this.type. Is it a bug, or I don't understand how this.type work?
I know workaround:
===
class A {
def b(): this.type = {
val r: this.type = this
r
}
}
===
S.