You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A repl session in 2.11 (works the same way in 2.10):
scala>defnoisyIdentity(x: AnyRef): x.type= {
| println("got "+ x)
| x
| }
noisyIdentity: (x: AnyRef)x.type
scala> noisyIdentity("test")
res0:String= test
// Even more weird:
scala> noisyIdentity(new java.lang.String("test"))
got test
res1:String= test
As you see, println did not get executed: the body of the method got replaced by the inhabitant of the ConstantType.
The text was updated successfully, but these errors were encountered:
Copying from the discussion here: https://groups.google.com/forum/#!topic/scala-internals/QBjjb5gTQKI
A repl session in 2.11 (works the same way in 2.10):
As you see, println did not get executed: the body of the method got replaced by the inhabitant of the ConstantType.
The text was updated successfully, but these errors were encountered: