Reversing alone would disturb the parameters (#298)
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 1m2s

This commit is contained in:
Daniel Holle 2024-03-27 14:52:15 +01:00
parent 82b4450857
commit 877e5ed38a
2 changed files with 9 additions and 2 deletions

View File

@ -906,7 +906,6 @@ public class RuleSet implements IRuleSet{
var fiArgs = fc.getFunctionalInterfaceTypeArguments(refType); var fiArgs = fc.getFunctionalInterfaceTypeArguments(refType);
var retType = fiArgs.getFirst(); var retType = fiArgs.getFirst();
System.out.println(lhsType.getName());
var lhsArgs = fc.getFunctionalInterfaceTypeArguments(lhsType); var lhsArgs = fc.getFunctionalInterfaceTypeArguments(lhsType);
var lhsRet = lhsArgs.getFirst(); var lhsRet = lhsArgs.getFirst();

View File

@ -4,6 +4,7 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.sql.Array;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -613,7 +614,14 @@ implements IFiniteClosure {
@Override @Override
public List<UnifyType> getFunctionalInterfaceTypeArguments(UnifyType t) { public List<UnifyType> getFunctionalInterfaceTypeArguments(UnifyType t) {
if (t instanceof FunNType) return Arrays.asList(t.getTypeParams().get()).reversed(); if (t instanceof FunNType) {
var ret = new ArrayList<UnifyType>();
if (t.getTypeParams().size() > 0) {
ret.add(t.getTypeParams().get(t.getTypeParams().size() - 1));
ret.addAll(Arrays.asList(t.getTypeParams().get()).subList(0, t.getTypeParams().size() - 1));
}
return ret;
}
var clazz = compiler.getClass(new JavaClassName(t.getName())); var clazz = compiler.getClass(new JavaClassName(t.getName()));
var intfMethod = clazz.getMethods().stream().filter(m -> Modifier.isAbstract(m.modifier)).findFirst().orElseThrow(); var intfMethod = clazz.getMethods().stream().filter(m -> Modifier.isAbstract(m.modifier)).findFirst().orElseThrow();