implements PR-039
This commit is contained in:
+26
@@ -72,6 +72,32 @@ class PbsFrontendCompilerTest {
|
||||
assertEquals(2, fileBackend.functions().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldLowerExecutableFunctionsWithCallsiteCategories() {
|
||||
final var source = """
|
||||
fn b(x: int) -> int {
|
||||
return x;
|
||||
}
|
||||
|
||||
fn a() -> int {
|
||||
return b(1);
|
||||
}
|
||||
""";
|
||||
|
||||
final var diagnostics = DiagnosticSink.empty();
|
||||
final var compiler = new PbsFrontendCompiler();
|
||||
final var fileBackend = compiler.compileFile(new FileId(42), source, diagnostics);
|
||||
|
||||
assertTrue(diagnostics.isEmpty(), "Valid program should not report diagnostics");
|
||||
assertEquals(2, fileBackend.executableFunctions().size());
|
||||
final var executableA = fileBackend.executableFunctions().stream()
|
||||
.filter(fn -> fn.callableName().equals("a"))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
assertTrue(executableA.instructions().stream().anyMatch(i ->
|
||||
i.kind() == p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.CALL_FUNC));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotLowerWhenSyntaxErrorsExist() {
|
||||
final var source = """
|
||||
|
||||
Reference in New Issue
Block a user