From 1f89238fe4572bb81f706ca8cdb8156842e78407 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 31 Jan 2018 18:38:52 +0100 Subject: [PATCH 1/2] Kleiner Bug beseitigt. Ungetesteter Stand --- .../parser/SyntaxTreeGenerator/TypeGenerator.java | 4 +++- test/javFiles/Faculty.jav | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java index 1dd259d0..ccc7b327 100644 --- a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java +++ b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java @@ -114,7 +114,9 @@ public class TypeGenerator { if(referenceTypeContext.classOrInterfaceType() != null){ if(referenceTypeContext.classOrInterfaceType().classType_lfno_classOrInterfaceType()!= null){ Java8Parser.ClassType_lfno_classOrInterfaceTypeContext ctx = referenceTypeContext.classOrInterfaceType().classType_lfno_classOrInterfaceType(); - return convertTypeName(ctx.Identifier().toString(), ctx.typeArguments(),referenceTypeContext.getStart(), reg, generics); + //return convertTypeName(ctx.Identifier().toString(), ctx.typeArguments(),referenceTypeContext.getStart(), reg, generics); + if(ctx.typeArguments() != null)throw new NotImplementedException(); + return convertTypeName(referenceTypeContext.getText(), null,referenceTypeContext.getStart(), reg, generics); }else{ throw new NotImplementedException(); } diff --git a/test/javFiles/Faculty.jav b/test/javFiles/Faculty.jav index 50bd7e78..089d2f33 100644 --- a/test/javFiles/Faculty.jav +++ b/test/javFiles/Faculty.jav @@ -6,10 +6,14 @@ class Faculty { return x; } - m () { + Fun1 m () { var fact = (Integer x) -> { return mul(x, fact.apply(x)); }; return fact; } } + +interface Fun1{ + B apply(A a); +} \ No newline at end of file From 22499f09e850adff3f020f66c3663b647dfecf6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Thu, 1 Feb 2018 00:17:12 +0100 Subject: [PATCH 2/2] modified: src/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java Zeile 101 Dangling-else Problematik behoben War Fehler im Occurs-Cheeck von Montanari-Martelli. --- src/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java b/src/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java index dc90847b..482155fc 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java +++ b/src/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java @@ -98,9 +98,10 @@ public final class TypeParams implements Iterable{ */ public boolean occurs(PlaceholderType t) { for(UnifyType p : typeParams) - if(p instanceof PlaceholderType) + if(p instanceof PlaceholderType) {//PL 2018-01-31 dangeling else Problem { ... } eingefuegt. if(p.equals(t)) return true; + } else if(p.getTypeParams().occurs(t)) return true;