error: No ClassTag available for String

208 views
Skip to first unread message

Erik Bruchez

unread,
Nov 15, 2012, 8:58:44 PM11/15/12
to scala-i...@googlegroups.com
All,

With 2.10.RC2:

scala> def foo(f: String => Array[String])(s: String) = ()
foo: (f: String => Array[String])(s: String)Unit

scala> foo _
res3: (String => Array[String]) => (String => Unit) = <function1>

scala> foo(Array(_)) _
<console>:9: error: No ClassTag available for String
foo(Array(_)) _
^

This passed with 2.9.2. Bug?

Thanks,

-Erik

Paul Phillips

unread,
Nov 15, 2012, 10:25:22 PM11/15/12
to scala-i...@googlegroups.com


On Thu, Nov 15, 2012 at 5:58 PM, Erik Bruchez <er...@bruchez.org> wrote:
scala> foo(Array(_)) _
<console>:9: error: No ClassTag available for String
              foo(Array(_)) _
                       ^

This passed with 2.9.2. Bug?

Probably, although the trailing _ is not the most specified candle in the candelabrum. This works:

scala> foo(Array(_))(_)
res0: String => Unit = <function1>

Erik Bruchez

unread,
Nov 15, 2012, 11:28:50 PM11/15/12
to scala-i...@googlegroups.com
Thanks for the workaround! I didn't realize the trailing _ was frowned
upon in this case.

-Erik

Eugene Burmako

unread,
Nov 16, 2012, 5:51:04 AM11/16/12
to scala-internals
Just opened a bug: https://issues.scala-lang.org/browse/SI-6673. Will
look into it after lunch.

On Nov 16, 5:29 am, Erik Bruchez <ebruc...@orbeon.com> wrote:
> Thanks for the workaround! I didn't realize the trailing _ was frowned
> upon in this case.
>
> -Erik
>
>
>
>
>
>
>
> On Thu, Nov 15, 2012 at 7:25 PM, Paul Phillips <pa...@improving.org> wrote:
>
Reply all
Reply to author
Forward
0 new messages