Created
June 30, 2010 15:35
-
-
Save jsuereth/458803 to your computer and use it in GitHub Desktop.
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 Foo { | |
| type T = this.type | |
| def cloneit : T = { | |
| val x = new Foo | |
| x match { | |
| case y : T => y | |
| case _ => error("ZOMG") | |
| } | |
| } | |
| } | |
<console>:11: error: type mismatch; | |
found : y.type (with underlying type Foo.this.T) | |
required: Foo.this.T | |
case y : T => y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Locking down the abstract type T still results in the type error!