Reputation: 12306
Given classes
object A {
type URLT = String
}
case class A(url : URLT)
class ForeignStreamWriter {
def writeString(str: String) {}
}
trait WriterA {
val writer : ForeignStreamWriter
def write(src: A) {
writer.write(src.url)
}
}
how can I tell the compiler that I'm working with String - not URLT - in writer.write(src.url)? I can not modify signature of ForeignStreamWriter.
UPD
As for now I found the only solution
def write(src: A) {
writer.write(src.url.asInstanceOf[String])
}
but I don't really like it.
Upvotes: 0
Views: 107
Reputation: 6930
You need to import A._
in scope. By the way, your sample didn't compile without it.
Upvotes: 1