I have never used Traits much in Scala, and I want to change that. I have this code:
import tools.nsc.io.Path
import java.io.File
trait ImageFileAcceptor extends FileAcceptor {
override def accept(f:File) = {
super.accept(f) match {
case true => {
}
case _ => false
}
}
}
The problem is that when compiling with sbtI get:
ImageFileAcceptor.scala:2: ';' expected but 'import' found.
If you add after import ;, the code compiles. Here FileAcceptor:
import java.io.File
trait FileAcceptor extends Acceptable {
override def accept(f:File):Boolean = f.isFile
}
And here Acceptable:
import java.io.File
trait Acceptable {
def accept(f:File):Boolean
}
I do not understand why I need semicolons after import.
EDIT: maybe sbt's output is useful:
[info] Building project tt 1.0 against Scala 2.8.1
[info] using sbt.DefaultProject with sbt 0.7.5 and Scala 2.7.7
source
share