Closed liufengyun closed 7 years ago
Feel free to merge if you think there is no problem, @valdisxp1 .
You mean the previous implementation of static? I don't know either, the previous implementation was completely wrong due to my misunderstanding of Dotty.
I mean before this PR I'd expect it to have failed in macro expansion.
The scope$$inline$
class does not have a method "mapTest". I would expect it to fail the reflection call with MethodNotFoundException
.
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
public final class scope$$inline$ {
public static final scope$$inline$ MODULE$;
static {
new scope$$inline$();
}
public scope$$inline$() {
MODULE$ = this;
}
public int scope$$inline$_sum$$$anonfun$1/* $FF was: scope$$inline$~sum$$$anonfun$1*/(int _$1) {
return _$1 * 2;
}
}
It is in the other class: scope$$inline
.
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
import scala.collection.TraversableOnce;
import scala.compat.java8.JFunction1.mcII.sp;
import scala.gestalt.Toolbox;
import scala.package.;
import scala.runtime.BoxesRunTime;
public class scope$$inline {
public scope$$inline() {
}
public static Object is(Toolbox toolbox, Object prefix, Object T, Object a) {
return toolbox.ApplyType().apply(toolbox.Select().apply(a, "isInstanceOf"), .MODULE$.List().apply(scala.Predef..MODULE$.wrapRefArray(new Object[]{T})));
}
public static Object both(Toolbox toolbox, Object prefix, Object S, Object T, Object a) {
return toolbox.Infix().apply(toolbox.ApplyType().apply(toolbox.Select().apply(a, "isInstanceOf"), .MODULE$.List().apply(scala.Predef..MODULE$.wrapRefArray(new Object[]{S}))), "&&", toolbox.ApplyType().apply(toolbox.Select().apply(a, "isInstanceOf"), .MODULE$.List().apply(scala.Predef..MODULE$.wrapRefArray(new Object[]{T}))));
}
public static Object mapTest(Toolbox toolbox, Object prefix) {
int sum = BoxesRunTime.unboxToInt(((TraversableOnce)scala.runtime.RichInt..MODULE$.to$extension0(scala.Predef..MODULE$.intWrapper(1), 5).map(scope$$inline$.MODULE$::scope$$inline$~sum$$$anonfun$1, scala.collection.immutable.IndexedSeq..MODULE$.canBuildFrom())).sum(scala.math.Numeric.IntIsIntegral..MODULE$));
return toolbox.Lit().apply(BoxesRunTime.boxToInteger(sum));
}
}
The static implementation is now fixed, the new artefact released. Review @valdisxp1 .