Last active
February 9, 2019 20:29
-
-
Save taisukeoe/f9d8ab182d6a10aa430eb7fda09d5a90 to your computer and use it in GitHub Desktop.
ax:A#X = a.x
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
Welcome to Scala 2.12.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_201). | |
Type in expressions for evaluation. Or try :help. | |
scala> trait A {val x:AnyRef = null;type X = x.type} | |
defined trait A | |
scala> val a = new A{} | |
a: A = $anon$1@36417a54 | |
scala> val ax:a.type#X = a.x | |
ax: a.X = null | |
scala> val ax2:A#X = a.x | |
ax2: _1.x.type forSome { val _1: A } = null |
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
//dotr -version | |
//Starting dotty REPL... | |
//Dotty compiler version 0.12.0-RC1 -- Copyright 2002-2019, LAMP/EPFL | |
Starting dotty REPL... | |
scala> trait A {val x:AnyRef = null;type X = x.type} | |
// defined trait A | |
scala> val a = new A{} | |
val a: A = anon$1@3050ac2f | |
scala> val ax:a.type#X = a.x | |
val ax: a.X = null | |
scala> val ax2:A#X = a.x | |
1 |val ax2:A#X = a.x | |
| ^^^ | |
| Found: AnyRef(a.x) | |
| Required: A#X |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment