Created
September 19, 2014 15:27
-
-
Save wfaler/7dc5e34695c1f7eb10d9 to your computer and use it in GitHub Desktop.
WTF-SCALA.scala
This file contains hidden or 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
class Foo{ | |
val foo = List(bar) | |
val bar = baz | |
val baz = "foo" | |
} | |
// compiles |
I think this should be clearly an error not a warning. Any reason to allow it? @viktorklang
scala> val troll = new { override val bar = "oh-really" } with Foo
troll: Foo = $anon$1@2f4854d6
scala> troll.foo
res13: List[String] = List(oh-really)
scala> troll.bar
res14: String = oh-really
scala> troll.baz
res15: String = foo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scala> class Foo{
| val foo = List(bar)
| val bar = baz
| val baz = "foo"
| }
:9: warning: Reference to uninitialized value bar
val foo = List(bar)
^
:10: warning: Reference to uninitialized value baz
val bar = baz
^
defined class Foo