Skip to content

Commit 5c8ed8f

Browse files
committed
add 'Fix all failing unit tests' task to prd.json
1 parent 3a60e73 commit 5c8ed8f

28 files changed

+427
-401
lines changed

prd.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,17 @@
555555
"priority": 33,
556556
"passes": true,
557557
"notes": "COMPLETED (2026-02-23):\n\n- Updated README-source.adoc to reflect hand-written recursive descent parser (replaced ANTLR4 references)\n- Updated README-EN-source.adoc with same changes\n- Updated CLAUDE.md with comprehensive new parser architecture documentation\n- Added detailed section 5 describing the new parser architecture, package structure, token types, AST nodes, visitor pattern, and parsing flow\n- Noted that aparser package still exists for backward compatibility\n\nThe documentation now accurately reflects the new hand-written parser while acknowledging the legacy aparser package."
558+
},
559+
{
560+
"id": "US-034",
561+
"title": "Fix all failing unit tests",
562+
"description": "As a developer, I need all 644 unit tests to pass so that the new hand-written parser is fully production-ready. Currently 52 tests fail (25 failures + 27 errors) across multiple categories.",
563+
"acceptanceCriteria": [
564+
"All 644 tests pass with mvn test"
565+
],
566+
"priority": 34,
567+
"passes": false,
568+
"notes": "Current state (2026-02-23): 644 tests total, 592 pass, 25 failures + 27 errors = 52 failing.\n\nFailure categories:\n1. Parser SYNTAX_ERRORs: BIT_AND, GT in generics, COMMA spread, DOT chain, CATCH_ALL wildcard import, FUNCTION as identifier\n2. InstructionGenerator: IfNode and TryCatchNode visitor methods broken\n3. ScriptChecker/OperatorLimit: operator count logic off\n4. Error position reporting: line/column numbers incorrect\n5. Macro support: macro definition/invocation returning null\n6. Function registry: getOutFunctions returning built-ins\n7. Spread operator: list spread not expanding\n8. Number/string literals: edge case parsing\n9. Variable detection: qualified paths (a.b.c) not tracked\n10. Import aliases and static imports\n11. Operator alias/extension functions\n12. Short-circuit evaluation options\n13. Reflection: class fields, default interface methods\n14. Timeout detection\n15. Suite test failures"
558569
}
559570
]
560571
}

src/main/java/com/alibaba/qlexpress4/Express4Runner.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -685,10 +685,10 @@ private Future<QCompileCache> getParseFuture(String script) {
685685
private QCompileCache parseDefinition(String script) {
686686
ProgramNode programNode = parseToSyntaxTree(script);
687687
ImportManager importManager = inheritDefaultImport();
688-
688+
689689
// Process import statements from the program
690690
importManager = processImports(programNode, importManager);
691-
691+
692692
try {
693693
if (initOptions.isTraceExpression()) {
694694
// Compile with trace points
@@ -710,7 +710,7 @@ private QCompileCache parseDefinition(String script) {
710710
throw new RuntimeException("Compilation failed", e);
711711
}
712712
}
713-
713+
714714
/**
715715
* Process import statements from a ProgramNode and add them to the ImportManager.
716716
*
@@ -722,13 +722,13 @@ private ImportManager processImports(ProgramNode programNode, ImportManager impo
722722
// Create a new ImportManager with all the existing imports
723723
// Note: ImportManager is mutable, so we need to be careful
724724
// We'll add imports to the existing manager
725-
725+
726726
for (StatementNode statement : programNode.getStatements()) {
727727
if (statement instanceof com.alibaba.qlexpress4.parser.ast.ImportNode) {
728728
com.alibaba.qlexpress4.parser.ast.ImportNode importNode =
729729
(com.alibaba.qlexpress4.parser.ast.ImportNode)statement;
730730
String importPath = importNode.getImportPath();
731-
731+
732732
if (importNode.isWildcard()) {
733733
// Wildcard import: import com.example.*
734734
importManager.addImport(ImportManager.importCls(importPath + ".*"));
@@ -739,10 +739,10 @@ private ImportManager processImports(ProgramNode programNode, ImportManager impo
739739
}
740740
}
741741
}
742-
742+
743743
return importManager;
744744
}
745-
745+
746746
private ImportManager inheritDefaultImport() {
747747
return new ImportManager(initOptions.getClassSupplier(), initOptions.getDefaultImport());
748748
}

src/main/java/com/alibaba/qlexpress4/aparser/compiletimefunction/CodeGenerator.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@
2121
*/
2222
@Deprecated
2323
public interface CodeGenerator {
24-
24+
2525
void addInstruction(QLInstruction qlInstruction);
26-
26+
2727
void addInstructionsByTree(Object tree);
28-
28+
2929
QLSyntaxException reportParseErr(String errCode, String errReason);
30-
31-
QLambdaDefinition generateLambdaDefinition(Object expressionContext,
32-
List<QLambdaDefinitionInner.Param> params);
33-
30+
31+
QLambdaDefinition generateLambdaDefinition(Object expressionContext, List<QLambdaDefinitionInner.Param> params);
32+
3433
ErrorReporter getErrorReporter();
35-
34+
3635
ErrorReporter newReporterWithToken(Object token);
3736
}

src/main/java/com/alibaba/qlexpress4/aparser/compiletimefunction/CompileTimeFunction.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
@Deprecated
2323
public interface CompileTimeFunction {
24-
24+
2525
/**
2626
* Create instructions for function at compile time.
2727
*
@@ -31,7 +31,7 @@ public interface CompileTimeFunction {
3131
* @param codeGenerator tool for code generation (currently not supported)
3232
* @throws UnsupportedOperationException always - feature not yet migrated
3333
*/
34-
void createFunctionInstruction(String functionName, Object arguments,
35-
OperatorFactory operatorFactory, Object codeGenerator);
36-
34+
void createFunctionInstruction(String functionName, Object arguments, OperatorFactory operatorFactory,
35+
Object codeGenerator);
36+
3737
}

src/main/java/com/alibaba/qlexpress4/common/BuiltInTypesSet.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
package com.alibaba.qlexpress4.common;
22

33
public class BuiltInTypesSet {
4-
4+
55
public static final String BYTE = "byte";
6-
6+
77
public static final String SHORT = "short";
8-
8+
99
public static final String INT = "int";
10-
10+
1111
public static final String LONG = "long";
12-
12+
1313
public static final String FLOAT = "float";
14-
14+
1515
public static final String DOUBLE = "double";
16-
16+
1717
public static final String BOOLEAN = "boolean";
18-
18+
1919
public static final String CHAR = "char";
20-
20+
2121
public static Class<?> getCls(String lexeme) {
2222
switch (lexeme) {
2323
case BYTE:

src/main/java/com/alibaba/qlexpress4/common/GeneratorScope.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
* Author: DQinYuan
88
*/
99
public class GeneratorScope {
10-
10+
1111
private final GeneratorScope parent;
12-
12+
1313
private final String name;
14-
14+
1515
private final Map<String, MacroDefine> macroDefineMap;
16-
16+
1717
public GeneratorScope(GeneratorScope parent, String name, Map<String, MacroDefine> macroDefineMap) {
1818
this.parent = parent;
1919
this.name = name;
2020
this.macroDefineMap = macroDefineMap;
2121
}
22-
22+
2323
public GeneratorScope(String name, GeneratorScope parent) {
2424
this.parent = parent;
2525
this.name = name;
2626
this.macroDefineMap = new HashMap<>();
2727
}
28-
28+
2929
/**
3030
* @param name macro name
3131
* @param macroDefine macro definition
@@ -34,16 +34,16 @@ public GeneratorScope(String name, GeneratorScope parent) {
3434
public boolean defineMacroIfAbsent(String name, MacroDefine macroDefine) {
3535
return macroDefineMap.putIfAbsent(name, macroDefine) == null;
3636
}
37-
37+
3838
public void defineMacro(String name, MacroDefine macroDefine) {
3939
macroDefineMap.put(name, macroDefine);
4040
}
41-
41+
4242
public MacroDefine getMacroInstructions(String macroName) {
4343
MacroDefine qlInstructions = macroDefineMap.get(macroName);
4444
return qlInstructions != null ? qlInstructions : parent != null ? parent.getMacroInstructions(macroName) : null;
4545
}
46-
46+
4747
public String getName() {
4848
return name;
4949
}

src/main/java/com/alibaba/qlexpress4/common/ImportManager.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
* Author: DQinYuan
1212
*/
1313
public class ImportManager {
14-
14+
1515
private final ClassSupplier classSupplier;
16-
16+
1717
private final List<QLImport> importedPacks;
18-
18+
1919
private final Map<String, Class<?>> importedClses;
20-
20+
2121
public ImportManager(ClassSupplier classSupplier, List<QLImport> imports) {
2222
this.classSupplier = classSupplier;
2323
this.importedPacks = new ArrayList<>();
2424
this.importedClses = new HashMap<>();
2525
imports.forEach(this::addImport);
2626
}
27-
27+
2828
public ImportManager(ClassSupplier classSupplier, List<QLImport> importedPacks,
2929
Map<String, Class<?>> importedClses) {
3030
this.classSupplier = classSupplier;
3131
this.importedPacks = importedPacks;
3232
this.importedClses = importedClses;
3333
}
34-
34+
3535
public boolean addImport(QLImport anImport) {
3636
switch (anImport.getScope()) {
3737
case PACK:
@@ -53,11 +53,11 @@ public boolean addImport(QLImport anImport) {
5353
return false;
5454
}
5555
}
56-
56+
5757
public Class<?> loadQualified(String qualifiedCls) {
5858
return classSupplier.loadCls(qualifiedCls);
5959
}
60-
60+
6161
public LoadPartQualifiedResult loadPartQualified(List<String> fieldIds) {
6262
Class<?> qualifiedCls = null;
6363
List<String> qualifiedPath = null;
@@ -151,7 +151,7 @@ public LoadPartQualifiedResult loadPartQualified(List<String> fieldIds) {
151151
break;
152152
}
153153
}
154-
154+
155155
switch (state) {
156156
case continueState:
157157
return new LoadPartQualifiedResult(null, 0);
@@ -169,29 +169,29 @@ public LoadPartQualifiedResult loadPartQualified(List<String> fieldIds) {
169169
return new LoadPartQualifiedResult(null, 0);
170170
}
171171
}
172-
172+
173173
public static class LoadPartQualifiedResult {
174174
private final Class<?> cls;
175-
175+
176176
/**
177177
* first no class path field index
178178
*/
179179
private final int restIndex;
180-
180+
181181
public LoadPartQualifiedResult(Class<?> cls, int restIndex) {
182182
this.cls = cls;
183183
this.restIndex = restIndex;
184184
}
185-
185+
186186
public Class<?> getCls() {
187187
return cls;
188188
}
189-
189+
190190
public int getRestIndex() {
191191
return restIndex;
192192
}
193193
}
194-
194+
195195
public enum ImportScope {
196196
// import java.lang.*;
197197
PACK,
@@ -202,19 +202,19 @@ public enum ImportScope {
202202
// for Code Obfuscation Use Cases
203203
ALIAS
204204
}
205-
205+
206206
public static QLImport importInnerCls(String clsPath) {
207207
return new QLImport(ImportScope.InnerCls, clsPath);
208208
}
209-
209+
210210
public static QLImport importPack(String packPath) {
211211
return new QLImport(ImportScope.PACK, packPath);
212212
}
213-
213+
214214
public static QLImport importCls(String clsPath) {
215215
return new QLImport(ImportScope.CLS, clsPath);
216216
}
217-
217+
218218
public static QLImport importClsAlias(Class<?> cls, String alias) {
219219
if (cls == null) {
220220
throw new IllegalArgumentException("Class cannot be null");
@@ -227,40 +227,40 @@ public static QLImport importClsAlias(Class<?> cls, String alias) {
227227
}
228228
return new QLImport(cls, alias);
229229
}
230-
230+
231231
public static class QLImport {
232232
private final ImportScope scope;
233-
233+
234234
private String target;
235-
235+
236236
private Class<?> cls;
237-
237+
238238
private String alias;
239-
239+
240240
public QLImport(ImportScope scope, String target) {
241241
this.scope = scope;
242242
this.target = target;
243243
this.cls = null;
244244
}
245-
245+
246246
public QLImport(Class<?> cls, String alias) {
247247
this.scope = ImportScope.ALIAS;
248248
this.cls = cls;
249249
this.alias = alias;
250250
}
251-
251+
252252
public ImportScope getScope() {
253253
return scope;
254254
}
255-
255+
256256
public String getTarget() {
257257
return target;
258258
}
259-
259+
260260
public Class<?> getCls() {
261261
return cls;
262262
}
263-
263+
264264
public String getAlias() {
265265
return alias;
266266
}

src/main/java/com/alibaba/qlexpress4/common/MacroDefine.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
* Author: DQinYuan
99
*/
1010
public class MacroDefine {
11-
11+
1212
private final List<QLInstruction> instructions;
13-
13+
1414
private final boolean lastStmtExpress;
15-
15+
1616
public MacroDefine(List<QLInstruction> instructions, boolean lastStmtExpress) {
1717
this.instructions = instructions;
1818
this.lastStmtExpress = lastStmtExpress;
1919
}
20-
20+
2121
public List<QLInstruction> getMacroInstructions() {
2222
return instructions;
2323
}
24-
24+
2525
public boolean isLastStmtExpress() {
2626
return lastStmtExpress;
2727
}

0 commit comments

Comments
 (0)