Skip to content

Commit

Permalink
Merge branch 'topic/422' into 'master'
Browse files Browse the repository at this point in the history
lkql: improve ways errors messages are transmitted to the checker

See merge request eng/libadalang/langkit-query-language!383
  • Loading branch information
thvnx committed Jan 17, 2025
2 parents 40f2fa9 + 2b202bc commit 32d7df2
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected int executeScript(Context.Builder contextBuilder) {
try {
optionsBuilder.files(Files.readAllLines(Paths.get(this.args.filesFrom)));
} catch (IOException e) {
System.err.println("Could not read file: " + this.args.filesFrom);
System.err.println("WORKER_ERROR: Could not read file: " + this.args.filesFrom);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ public Object executeGeneric(VirtualFrame frame) {
visitList.addFirst(new VisitStep(stubBody, true, inSparkCode));
}
} catch (Libadalang.LangkitException e) {
context.println(
StringUtils.concat(
"Error during generic instantiation walking: ",
e.getMessage()));
context.getDiagnosticEmitter()
.emitDiagnostic(
CheckerUtils.MessageKind.ERROR,
e.getMessage(),
new LalLocationWrapper(currentNode, context.linesCache),
new SourceSectionWrapper(this.callNode.getSourceSection()),
rootUnit.getFileName(true));
continue;
}

Expand Down
3 changes: 3 additions & 0 deletions testsuite/tests/gnatcheck_errors/generic_inst_walking/prj.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project Test is

end Test;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
procedure Test is
package I is new PP (4);
begin
null;
end;
37 changes: 37 additions & 0 deletions testsuite/tests/gnatcheck_errors/generic_inst_walking/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Total gnatcheck failures: 1
1. Summary

fully compliant sources : 0
sources with exempted violations only : 0
sources with non-exempted violations : 0
unverified sources : 1
total sources : 1
ignored sources : 0

non-exempted violations : 0
rule exemption warnings : 0
compilation errors : 0
exempted violations : 0
internal errors : 1

2. Exempted Coding Standard Violations

no exempted violations detected

3. Non-exempted Coding Standard Violations

no non-exempted violations detected

4. Rule exemption problems

no rule exemption problems detected

5. Language violations

no language violations detected

6. Gnatcheck internal errors

test.adb:2:04: error: internal issue at checker.lkql:4:22: test.adb:2:4-2:28: dereferencing a null access [/test.adb]

>>>program returned status code 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: gnatcheck
project: prj.gpr
rules:
- +Rderiving_from_predefined_type

0 comments on commit 32d7df2

Please sign in to comment.