implements PR-06.1
This commit is contained in:
+45
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user