-
Notifications
You must be signed in to change notification settings - Fork 1.1k
RuntimeError in backend when with implicit conversions on super #5007
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
The issue is that we try to find an implicit conversion for the tree of class I0 {
implicit def foo(any: Any): String = ()
super.+("")
} result of Foo.scala after frontend:
package <empty> {
class I0() extends Object() {
implicit def foo(any: Any): String = this.foo(())
this.foo(super).+("")
}
} I imagine that we simply should not try to do implicit conversions on |
https://github.com/lampepfl/dotty/blob/master/tests/untried/neg/t5063.scala |
@alexknvl Thanks for the pointer!
That's indeed the scalac fix to scala/bug#5063 (comment). |
And if we try the same thing: diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
index feb6bc391..546cce74a 100644
--- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
@@ -552,6 +552,7 @@ trait Implicits { self: Typer =>
|| (from.tpe isRef defn.NothingClass)
|| (from.tpe isRef defn.NullClass)
|| !(ctx.mode is Mode.ImplicitsEnabled)
+ || from.isInstanceOf[Super]
|| (from.tpe eq NoPrefix)) NoMatchingImplicitsFailure
else {
def adjust(to: Type) = to.stripTypeVar.widenExpr match { we get: scala> class I0 {
| super.+("")
| }
2 | super.+("")
| ^^^^^^^
| value `+` is not a member of Object - did you mean `Object(I0.super).eq`? |
Based on scala/scala@bed3304bf86 and Nicolas' suggestion.
Based on scala/scala@bed3304bf86 and Nicolas' suggestion.
RE-341cc574ffab7ad1cca7c0683c727f4cd8ca9f68
The text was updated successfully, but these errors were encountered: