-
Notifications
You must be signed in to change notification settings - Fork 21
super[T] not working inside an anonymous function (e.g. for loop) #4300
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4300?orig=1 |
@axel22 said: |
Manos Koukoutos (manoskouk) said: ===== This code reproduces the problem ===== class C
trait Foo {
this: C =>
def fun(x:Int) = x + 1
}
trait Bar extends Foo {
this: C =>
super[Foo].fun(42) // OK
( (x : Int) => super[Foo].fun(x) ) // Buggy
val foo = super[Foo].fun _
( (x : Int) => foo(x) ) // Also buggy
} ===== Compiler output =====
== Source file context for tree position ==
exception when typing $anonfun.this.$outer.super[Foo].fun(x)/class scala.reflect.internal.Trees$Apply =========== |
Can't reproduce with Manos's reproducer. |
To clarify, the Manos reproducer crashes 2.11.12 but not 2.12.18. |
=== What steps will reproduce the problem? ===
=== What is the expected behavior? ===
The expected output is
=== What do you see instead? ===
ClassCastException
is thrown, as the compiler tries to cast the anonymous function to A.=== Additional information ===
http://groups.google.com/group/scala-user/browse_thread/thread/757e3c5efb85c607
=== What versions of the following are you using? ===
The text was updated successfully, but these errors were encountered: