-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Trying to compile this code will cause a compilation error
object Main {
def fun(op: implicit erased (Int) => Unit) = op(0)
fun { }
}sbt:dotty-simple> compile
[info] Compiling 1 Scala source to /home/glavo/Projects/dotty-projects/test/target/scala-0.8/classes ...
[error] -- [E007] Type Mismatch Error: /home/glavo/Projects/dotty-projects/test/src/main/scala/org/glavo/Main.scala:5:9
[error] 5 | fun { }
[error] | ^
[error] | found: Unit
[error] | required: erased implicit Int => Unit
[error] |
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 0 s, completed 2018-5-11 2:05:16
But this code can be compiled:
object Main {
def fun(op: implicit (Int) => Unit) = op(0)
fun { }
}