@retronym said:
According to the spec,* is only allowed on method parameters. The compiler also allows them in function types, but the behaviour is unspecified. Personally, I'd like to disallow this.
@som-snytt said (edited on Jan 16, 2017 2:29:36 AM UTC):
Surprise,
$ scala
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.
scala> val f: (Int*) => Int = _.size
f: Int* => Int = $$Lambda$1042/1092382020@1687eb01
scala> f(1,2,3)
res0: Int = 3
// the relevant definitions:
// <stable> <accessor> def f: Int* => Int = $iw.this.f
// <stable> <accessor> lazy val $result: Seq[Int] => Int = $line1.$read.$iw.$iw.f;
scabug commentedNov 9, 2014
There is a compilation error (only in the REPL) in the following example, where none should be:
The text was updated successfully, but these errors were encountered: