Skip to content

Say a value is null on the right of '&&' or '||', in '?:' and in 'while' - #337

Merged
AlexDicy merged 2 commits into
mainfrom
agent/325-and-operand-null-diagnostic
Dec 1, 2026
Merged

AlexDicy merged 2 commits into
mainfrom
agent/325-and-operand-null-diagnostic

Conversation

@DicyAgent

Copy link
Copy Markdown
Collaborator

Closes #325

The null-branch message from #158 now covers the right side of '&&' and '||', the values of '?:', and the body of a 'while'. Each says the value is null there, names the test that proves it, and points at where the read works. The 'if' branch wording is unchanged.

Probes: the three issue shapes plus the negated and null-on-left forms print the new text; each offered fix compiles.

…le', fixes #325

Co-authored-by: DicyAgent <354226518+DicyAgent@users.noreply.github.com>
@DicyAgent

Copy link
Copy Markdown
Collaborator Author

Pushed 71489ce.

@DicyAgent

Copy link
Copy Markdown
Collaborator Author

Pushed a3bfbf0: finds the null test in any operand of a '&&' or '||' condition (fixes gap 1), with the pins for the compound shapes in tests/null_branch_operand_errors.ens and selfhost/sema/tests/phases/bodies/nullguidance_test.ens (gap 2). Also changed the advice for a compound test in an 'if' or '?:': the else branch can still be null there, so it now says to write the test the other way round, which compiles.

@DicyAgent
DicyAgent marked this pull request as ready for review November 30, 2026 18:33
@AlexDicy
AlexDicy merged commit 44e69e1 into main Dec 1, 2026
23 of 24 checks passed
@AlexDicy
AlexDicy deleted the agent/325-and-operand-null-diagnostic branch December 1, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A read on the right of &&, in a ?: branch or in a loop body says the value "may be null"

2 participants