Skip to content

Instantly share code, notes, and snippets.

@seraphr seraphr/this.type
Created Nov 13, 2017

Embed
What would you like to do?
scala this.type
scala> class Hoge {
| def m1: this.type = this // OK
| def m2: this.type = new Hoge // NG
| }
<console>:9: error: type mismatch;
found : Hoge
required: Hoge.this.type
def m2: this.type = new Hoge // NG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.