implements PLN-0102
JaCoCo Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 61.37% (17351/28272) * Branch Coverage: 52.31% (6722/12850) * Lines of Code: 28272 * Cyclomatic Complexity: 11325 #### Quality Gates Summary Output truncated.
Test / Build skipped: 15, passed: 601
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
Intrepid/Prometeu/Studio/pipeline/head This commit looks good

This commit is contained in:
2026-07-15 07:22:58 +01:00
parent d8db99eb81
commit 725c28b3f5
4 changed files with 55 additions and 3 deletions
@@ -20,12 +20,20 @@ class PbsSemanticsDeclarationsTest {
[Doc(markdown = \"""
Holds player state.
\""")]
declare struct Player(x: int);
declare struct Player(x: int) {
[Doc(markdown = \"""
Updates player state.
\""")]
fn update() -> void { return; }
}
[Doc(markdown = \"""
Game services.
\""")]
declare service Game {
[Doc(markdown = \"""
Runs one game tick.
\""")]
fn tick() -> void { return; }
}
""";
@@ -72,6 +80,35 @@ class PbsSemanticsDeclarationsTest {
assertTrue(malformedCount >= 2);
}
@Test
void shouldRejectDocAliasesExtraArgumentsAndParameterTargets() {
final var source = """
[Document(markdown = \"""
Alias should not be accepted.
\""")]
fn alias() -> void { return; }
[Doc(markdown = \"""
Has an extra argument.
\""", format = \"""
markdown
\""")]
fn extra() -> void { return; }
fn parameter([Doc(markdown = \"""
Parameter docs are not allowed.
\""")] value: int) -> int { return value; }
""";
final var diagnostics = DiagnosticSink.empty();
new PbsFrontendCompiler().compileFile(new FileId(0), source, diagnostics);
assertTrue(diagnostics.stream().anyMatch(d ->
d.getCode().equals("E_PARSE_ATTRIBUTES_NOT_ALLOWED")));
assertTrue(diagnostics.stream().anyMatch(d ->
d.getCode().equals(PbsSemanticsErrors.E_SEM_MALFORMED_RESERVED_ATTRIBUTE.name())));
}
@Test
void shouldAllowFunctionOverloadsWithDifferentShapes() {
final var source = """