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
According to the documentation on AnyVal, Strings are not value types, so I believe the following shouldn't compile:
vala:AnyVal="foo"
Here is how scalac complains:
$ echo'val a: AnyVal = ""'| scala
Welcome to Scala 2.13.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_201).
scala> val a: AnyVal = ""
^
error: the result type of an implicit conversion must be more specific than AnyVal
$ echo'val a: AnyVal = ""'| scala -Yno-predef
Welcome to Scala 2.13.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_201).
scala> val a: AnyVal = ""
^
error: type mismatch;
found : String("")
required: AnyVal
The text was updated successfully, but these errors were encountered:
It inserts Predef.augmentString as an implicit conversion. Once we move to extension methods this problem is gone. Until then it would be good to bring back the restrictions that implicit conversions can't convert to Any, AnyVal, or AnyRef.
Uh oh!
There was an error while loading. Please reload this page.
According to the documentation on AnyVal, Strings are not value types, so I believe the following shouldn't compile:
Here is how scalac complains:
The text was updated successfully, but these errors were encountered: