implements PR-06.1

This commit is contained in:
2026-03-24 13:42:31 +00:00
parent 7ccdd7b7e2
commit 0ec5693b0d
7 changed files with 195 additions and 11 deletions
@@ -96,4 +96,49 @@ class LowerToIRVMPipelineStageTest {
assertNotNull(ctx.irvm);
assertEquals("experimental-v1", ctx.irvm.module().vmProfile());
}
@Test
void runMustAttachSourceAttributionForLoweringFailure() {
final var callSpan = new Span(new FileId(9), 12, 24);
final var ctx = BuilderPipelineContext.compilerContext(new BuilderPipelineConfig(false, "."));
ctx.irBackend = IRBackend.builder()
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
new FileId(9),
"app",
"main",
new CallableId(1),
10,
30,
0,
0,
0,
1,
ReadOnlyList.from(
new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
"app",
"missing",
new CallableId(99),
null,
null,
callSpan),
new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.RET,
"",
"",
null,
null,
Span.none())),
new Span(new FileId(9), 10, 30))))
.build();
final var issues = new LowerToIRVMPipelineStage().run(ctx, LogAggregator.empty());
final var firstIssue = issues.asCollection().iterator().next();
assertTrue(issues.hasErrors());
assertEquals("LOWER_IRVM_MISSING_CALLEE", firstIssue.getCode());
assertEquals(9, firstIssue.getFileId());
assertEquals(12, firstIssue.getStart());
assertEquals(24, firstIssue.getEnd());
}
}