golo-lang
golo-lang copied to clipboard
Bug when decorating an overloaded function
This is probably linked to #326 in some way...
given test.golo as:
module golo.bugs.test.OverloadedDecoration
function idDeco = |f| -> f
@idDeco
function foo = |a| -> "foo: " + a
@idDeco
function foo = |a, b| -> "foo2: " + a + b
function main = |args| {
println(foo(42))
println(foo(4, 2))
}
then:
$ golo golo --files test.golo
Exception in thread "main" java.lang.invoke.WrongMethodTypeException: cannot convert MethodHandle(Object,Object)Object to (Object)Object
at java.lang.invoke.MethodHandle.asTypeUncached(MethodHandle.java:775)
at java.lang.invoke.MethodHandle.asType(MethodHandle.java:761)
at java.lang.invoke.Invokers.checkGenericType(Invokers.java:321)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.eclipse.golo.runtime.FunctionCallSupport.fallback(FunctionCallSupport.java:196)
cc @Artpej