Skip to content

Instantly share code, notes, and snippets.

@romac
Last active December 1, 2015 21:10
Show Gist options
  • Select an option

  • Save romac/7a904c41fba196780aad to your computer and use it in GitHub Desktop.

Select an option

Save romac/7a904c41fba196780aad to your computer and use it in GitHub Desktop.
/*
* Decompiled with CFR 0_108.
*
* Could not load the following classes:
* const$$anonfun
* const$$anonfun$lamConst
* scala.Function1
* scala.runtime.AbstractFunction1
*/
import scala.Function1;
import scala.runtime.AbstractFunction1;
public final class const$ {
public static final const$ MODULE$;
public static {
new const$();
}
public <A, B> A defConst(A x, B y) {
return x;
}
public <A, B> Function1<B, A> lamConst(A x) {
return new scala.Serializable(x){
public static final long serialVersionUID = 0;
private final Object x$1;
public final A apply(B y) {
return (A)this.x$1;
}
};
}
public void test() {
AbstractFunction1<Object, String> defRetFoo = new scala.Serializable(){
public static final long serialVersionUID = 0;
public final String apply(Object y) {
return const$.MODULE$.defConst("foo", y);
}
};
String defFoo = (String)defRetFoo.apply((Object)"bar");
Function1<B, String> lamRetFoo = this.lamConst("foo");
String lamFoo = (String)lamRetFoo.apply((Object)"bar");
}
private const$() {
MODULE$ = this;
}
}
object const {
@inline
def defConst[A, B](x: A)(y: B): A = x
@inline
def lamConst[A, B](x: A): B => A = y => x
def test = {
val defRetFoo = defConst("foo") _
val defFoo = defRetFoo("bar")
val lamRetFoo = lamConst("foo")
val lamFoo = lamRetFoo("bar")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment