Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private String getAdaptedText(String text) {
private static int getBooleanToken(BSLParser.ExpressionContext expCtx) {

var tmpCtx = Optional.of(expCtx)
.filter(ctx -> ctx.children.size() == 1)
.filter(ctx -> ctx.getChildCount() == 1)
.map(ctx -> ctx.member(0))
.map(ctx -> ctx.getChild(0))
.filter(BSLParser.ConstValueContext.class::isInstance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,15 @@ void testQuickFix() {
.hasNewText("НЕ (Б=0)");
}

@Test
void testMalformedTernaryOperatorDoesNotThrowNPE() {
// Проверяем, что на некорректном синтаксисе не падает NullPointerException
// Пример из issue: Return ?(table.Count() = 1, undefined, );
var documentContext = getDocumentContext("UselessTernaryOperatorDiagnosticMalformed");

List<Diagnostic> diagnostics = getDiagnostics(documentContext);

assertThat(diagnostics).isEmpty();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Тест на некорректный синтаксис - не должен падать с NullPointerException
Возврат ?(таблица.Количество() = 1, Неопределено, );