Open
Description
Compiler version
3.4.0-RC1-bin-20231223-938d405-NIGHTLY
Minimized code
//> using scala 3.4.0-RC1-bin-20231223-938d405-NIGHTLY
class Foo {
inline def bar(x: String) = x + "bar"
}
object Foo {
given Foo = {
println("gimme")
new Foo
}
// implicit def foo: Foo = {
// println("foops")
// new Foo
// }
}
class Bar {
def baz() = {
val foobar = summon[Foo].bar("foo")
println(foobar)
}
}
Output
/*
* Decompiled with CFR 0.151.
*/
import scala.Predef$;
public class Bar {
public void baz() {
String foobar = "foobar";
Predef$.MODULE$.println(foobar);
}
}
Expectation
If we replace given
with implicit def foo
:
/*
* Decompiled with CFR 0.151.
*/
import scala.Predef$;
public class Bar {
public void baz() {
Foo x$proxy1 = Foo$.MODULE$.foo();
String foobar = "foobar";
Predef$.MODULE$.println(foobar);
}
}