Skip to content

Eta-expansion working for implicit fails on implicit erased #4509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Glavo opened this issue May 10, 2018 · 2 comments
Closed

Eta-expansion working for implicit fails on implicit erased #4509

Glavo opened this issue May 10, 2018 · 2 comments

Comments

@Glavo
Copy link
Contributor

Glavo commented May 10, 2018

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 { }
}
@Blaisorblade Blaisorblade changed the title Compiler does not handle erased function correctly Eta-expansion working for implicit fails on implicit erased May 10, 2018
@Blaisorblade
Copy link
Contributor

@nicolasstucki can assign to you?

@nicolasstucki nicolasstucki self-assigned this May 10, 2018
@nicolasstucki nicolasstucki removed their assignment Jul 26, 2018
@b-studios
Copy link
Contributor

👍 I also ran into this issue :)

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 3, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 3, 2019
@odersky odersky closed this as completed in 363050d May 5, 2019
odersky added a commit that referenced this issue May 5, 2019
Fix #4509: Eta-expand as erased contextual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants