Created
November 13, 2017 07:46
-
-
Save seraphr/cdee852ce90efab7fd6c40b81efbb5b6 to your computer and use it in GitHub Desktop.
scala this.type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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