// import StringInterpolationTest._
object Test extends App {
import StringInterpolationTest._
val x = 1
val s = cap"boo $x"
println(s)
}
object StringInterpolationTest {
implicit class X(val sc: StringContext) extends AnyVal {
def cap(args: Any*) = ???
}
}
When the import is outside the object definition, it cannot find the implicit class containing a method cap. However this code does compile.
Scala IDE version:
4.3.0.v-2_11-201512011536-499c89a
Scala compiler version:
2.11.7
Scala library version:
2.11.7
Eclipse version:
4.4.2.v20150204-1700
Class loader store: 1 entries
Compiler v. 2.11.7(/Applications/eclipse/plugins/org.scala-lang.scala-compiler_2.11.7.v20150622-112736-1fbce4612c.jar)
Leave a comment
on 2016-01-09 19:04 *
By Simon Schäfer
Description changed from // import StringInterpolati... to <pre><code>
// import Strin...
on 2016-01-09 19:05 *
By Simon Schäfer
Description changed from <pre><code>
// import Strin... to <pre><code>
// import Strin...
It works fine in the builder but not in the PC. Weird error.
No file chosen
You have an empty file field. Please select or remove it.
Name | Size |
---|