scala - Missing parameter type for expanded function when not assigned to a variable -


this question has answer here:

i noticed strange behavior of scala compiler. code:

seq("?").toset foreach (println(_)) 

produces following error:

error: missing parameter type expanded function ((x$1) => println(x$1))         seq("?").toset foreach (println(_))                                         ^ 

same happens this:

seq("?").toset foreach (x => println(x)) 

i found 2 ways around this. ether specify type explicitly:

seq("?").toset[string] foreach (println(_)) 

or save variable:

val s = seq("?").toset s foreach (println(_)) 

is reasonable behavior or compiler bug? doesn't make lot of sense me. how explained?

it expands to:

seq("?").toset foreach (println(x=>x)) 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -