Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63a9239d1a |
No files matched your search
@@ -0,0 +1,11 @@
|
|||||||
|
import java.lang.Integer;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
public class Bug460 {
|
||||||
|
public id(x) { return x; } // with "public <T> T id(T x)" it compiles
|
||||||
|
public run() {
|
||||||
|
Integer a = id(5);
|
||||||
|
String b = id("s"); // a single call (only Integer) compiles
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
import java.lang.Integer;
|
|
||||||
import java.lang.String;
|
|
||||||
|
|
||||||
sealed interface Token permits /*SEMICOLON, COMMA, DOT, ASSIGN, LESSTHEN, GREATERTHAN,
|
|
||||||
LESSEQUALS, GREATEREQUALS, EQUALS, NOTEQUALS, NOT,
|
|
||||||
ADD, SUB, MUL, DIV, */LBRACE, RBRACE, /* LBRACKET , RBRACKET, SBOPEN, SBCLOSE, ABSTRACT,
|
|
||||||
STATIC, PUBLIC, CLASS, INTERFACE,
|
|
||||||
FOR, WHILE, */IF,/*, ELSE, BREAK, SWITCH, CASE, RETURN, VOID, BOOLEAN, JNULL, INT, CHAR,
|
|
||||||
STRING, LONG, */ BOOLEANLITERALTRUE /*, BOOLEANLITERALFALSE,
|
|
||||||
INTLITERAL, LONGLITERAL, FLOATLITERAL, CHARLITERAL, STRINGLITERAL, MEMORYADRESSLITERAL, NAME,
|
|
||||||
WHITESPACE*/ { }
|
|
||||||
|
|
||||||
/*record SEMICOLON() implements Token {}
|
|
||||||
record COMMA () implements Token {}
|
|
||||||
record DOT() implements Token {}
|
|
||||||
record ASSIGN() implements Token {}
|
|
||||||
record LESSTHEN() implements Token {}
|
|
||||||
record GREATERTHAN() implements Token {}
|
|
||||||
record LESSEQUALS() implements Token {}
|
|
||||||
record GREATEREQUALS() implements Token {}
|
|
||||||
record EQUALS() implements Token {}
|
|
||||||
record NOTEQUALS() implements Token {}
|
|
||||||
record NOT() implements Token {}
|
|
||||||
record ADD () implements Token {}
|
|
||||||
record SUB() implements Token {}
|
|
||||||
record MUL() implements Token {}
|
|
||||||
record DIV() implements Token {}*/
|
|
||||||
record LBRACE() implements Token {}
|
|
||||||
record RBRACE() implements Token {}
|
|
||||||
/*
|
|
||||||
record LBRACKET () implements Token {}
|
|
||||||
record RBRACKET() implements Token {}
|
|
||||||
record SBOPEN() implements Token {}
|
|
||||||
record SBCLOSE() implements Token {}
|
|
||||||
record ABSTRACT() implements Token {}
|
|
||||||
record STATIC() implements Token {}
|
|
||||||
record PUBLIC() implements Token {}
|
|
||||||
record CLASS() implements Token {}
|
|
||||||
record INTERFACE() implements Token {}
|
|
||||||
record FOR () implements Token {}
|
|
||||||
record WHILE() implements Token {}*/
|
|
||||||
record IF() implements Token {}
|
|
||||||
/*record ELSE() implements Token {}
|
|
||||||
record BREAK() implements Token {}
|
|
||||||
record SWITCH() implements Token {}
|
|
||||||
record CASE() implements Token {}
|
|
||||||
record RETURN() implements Token {}
|
|
||||||
record VOID() implements Token {}
|
|
||||||
record BOOLEAN() implements Token {}
|
|
||||||
record JNULL() implements Token {}
|
|
||||||
record INT() implements Token {}
|
|
||||||
record CHAR() implements Token {}
|
|
||||||
record STRING() implements Token {}
|
|
||||||
record LONG() implements Token {}
|
|
||||||
*/
|
|
||||||
record BOOLEANLITERALTRUE () implements Token {}
|
|
||||||
/*
|
|
||||||
record BOOLEANLITERALFALSE() implements Token {}
|
|
||||||
record INTLITERAL (Integer i) implements Token {}
|
|
||||||
record LONGLITERAL (String Str) implements Token {}
|
|
||||||
record FLOATLITERAL (String Str) implements Token {}
|
|
||||||
record CHARLITERAL (String Str) implements Token {}
|
|
||||||
record STRINGLITERAL (String Str) implements Token {}
|
|
||||||
record MEMORYADRESSLITERAL (String Str) implements Token {}
|
|
||||||
record NAME (String Str) implements Token {}
|
|
||||||
record WHITESPACE() implements Token {}*/
|
|
||||||
|
|
||||||
public sealed interface List<T> permits Cons, Empty {}
|
|
||||||
|
|
||||||
public record Cons<T>(T a, List<T> l) implements List<T> {}
|
|
||||||
public record Empty<T>() implements List<T> {}
|
|
||||||
|
|
||||||
public class LLParser {
|
|
||||||
|
|
||||||
nach(f, g) {
|
|
||||||
return x -> f.apply(g.apply(x));
|
|
||||||
}
|
|
||||||
|
|
||||||
public stmt (Cons(fst, Cons<Token> rest)) {
|
|
||||||
return switch (fst) {
|
|
||||||
case IF a -> ifThenElsestatement(rest);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/*public stmt(IF()) { return new IF(); }
|
|
||||||
|
|
||||||
statement (Cons(IF(), rest)) {
|
|
||||||
return ifThenElsestatement(rest);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
ifThenElsestatement (Empty()) {
|
|
||||||
return new Empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
ifThenElsestatement (rest) {
|
|
||||||
return bexpression(rest);
|
|
||||||
}
|
|
||||||
|
|
||||||
bexpression (Cons(LBRACE fst, Cons<Token> rest)) {
|
|
||||||
return switch(rest) {
|
|
||||||
case Cons(BOOLEANLITERALTRUE t, rest2) -> switch (rest2) {
|
|
||||||
case Cons(RBRACE rb, rest3) -> rest3;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -57,9 +57,4 @@ public record TargetFunNType(String name, List<TargetType> funNParams, List<Targ
|
|||||||
}
|
}
|
||||||
return Objects.equals(name, otfn.name);
|
return Objects.equals(name, otfn.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return toSignature();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -51,8 +51,6 @@ public class Logger {
|
|||||||
defaultWriter = null;
|
defaultWriter = null;
|
||||||
try {
|
try {
|
||||||
FileUtils.cleanDirectory(logFolder);
|
FileUtils.cleanDirectory(logFolder);
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
// Ignore
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1365,14 +1365,6 @@ public class TestComplete {
|
|||||||
main.invoke(null, List.of());
|
main.invoke(null, List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLLParser() throws Exception {
|
|
||||||
ConsoleInterface.logLevel = LogLevel.INFO;
|
|
||||||
var classFiles = generateClassFiles(createClassLoader(), "LLParser.jav");
|
|
||||||
var clazz = classFiles.get("LLParser");
|
|
||||||
var instance = clazz.getDeclaredConstructor().newInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBug122() throws Exception {
|
public void testBug122() throws Exception {
|
||||||
var classFiles = generateClassFiles(createClassLoader(), "Bug122.jav");
|
var classFiles = generateClassFiles(createClassLoader(), "Bug122.jav");
|
||||||
@@ -1814,4 +1806,14 @@ public class TestComplete {
|
|||||||
var bnot = clazz.getDeclaredMethod("not", Integer.class);
|
var bnot = clazz.getDeclaredMethod("not", Integer.class);
|
||||||
assertEquals(-11, bnot.invoke(instance, 10));
|
assertEquals(-11, bnot.invoke(instance, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBug460() throws Exception {
|
||||||
|
ConsoleInterface.logLevel = LogLevel.INFO;
|
||||||
|
var classFiles = generateClassFiles(createClassLoader(), "Bug460.jav");
|
||||||
|
var clazz = classFiles.get("Bug460");
|
||||||
|
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||||
|
var run = clazz.getDeclaredMethod("run");
|
||||||
|
assertEquals("s", run.invoke(instance));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user