Fix #298 maybe?
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 2m42s
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 2m42s
This commit is contained in:
parent
bc61fc2e1d
commit
8fdfbf875b
@ -2,6 +2,7 @@ import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.lang.Integer;
|
||||
import java.lang.System;
|
||||
import java.lang.Boolean;
|
||||
import java.io.PrintStream;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.function.Function;
|
||||
@ -10,5 +11,7 @@ public class Bug298 {
|
||||
public void m() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.stream().map(x -> 2 * x);
|
||||
|
||||
Function<Integer, Boolean> filter = x -> true;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
import de.dhbwstuttgart.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory;
|
||||
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
@ -905,7 +906,8 @@ public class RuleSet implements IRuleSet{
|
||||
|
||||
var fiArgs = fc.getFunctionalInterfaceTypeArguments(refType);
|
||||
var retType = fiArgs.getFirst();
|
||||
var lhsRet = lhsType.getTypeParams().get(0);
|
||||
var lhsArgs = fc.getFunctionalInterfaceTypeArguments(lhsType);
|
||||
var lhsRet = lhsArgs.getFirst();
|
||||
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
if (retType instanceof ExtendsType) {
|
||||
@ -917,7 +919,7 @@ public class RuleSet implements IRuleSet{
|
||||
}
|
||||
|
||||
for (var i = 1; i < fiArgs.size(); i++) {
|
||||
var lh = lhsType.getTypeParams().get(i);
|
||||
var lh = lhsArgs.get(i);
|
||||
var rh = fiArgs.get(i);
|
||||
|
||||
if (rh instanceof SuperType) {
|
||||
|
@ -75,7 +75,7 @@ public interface IFiniteClosure {
|
||||
public Set<UnifyType> getAllTypesByName(String typeName);
|
||||
|
||||
public boolean isFunctionalInterface(ReferenceType t);
|
||||
public List<UnifyType> getFunctionalInterfaceTypeArguments(ReferenceType t);
|
||||
public List<UnifyType> getFunctionalInterfaceTypeArguments(UnifyType t);
|
||||
|
||||
public int compare(UnifyType rhsType, UnifyType rhsType2, PairOperator pairop);
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ implements IFiniteClosure {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UnifyType> getFunctionalInterfaceTypeArguments(ReferenceType t) {
|
||||
public List<UnifyType> getFunctionalInterfaceTypeArguments(UnifyType t) {
|
||||
var clazz = compiler.getClass(new JavaClassName(t.getName()));
|
||||
var intfMethod = clazz.getMethods().stream().filter(m -> Modifier.isAbstract(m.modifier)).findFirst().orElseThrow();
|
||||
|
||||
@ -630,6 +630,7 @@ implements IFiniteClosure {
|
||||
i += 1;
|
||||
}
|
||||
|
||||
System.out.println(args);
|
||||
return args;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user