Skip to content

Add support for if expressions#446

Open
Bazooper-blip wants to merge 1 commit into
integrated-application-development:masterfrom
Bazooper-blip:claude/pr-440-upmerge-adjust-L8U0P
Open

Add support for if expressions#446
Bazooper-blip wants to merge 1 commit into
integrated-application-development:masterfrom
Bazooper-blip:claude/pr-440-upmerge-adjust-L8U0P

Conversation

@Bazooper-blip

Copy link
Copy Markdown

Resolves #407. Introduces parsing, type resolution, and control-flow modelling of Delphi 13's conditional if operator (e.g. X := if Foo then Bar else Baz). The branches are modelled as mutually-exclusive paths in the CFG.

The expression's type is the LUB of the then/else branch types: exact matches and unknown-side fallbacks are returned directly; if only one branch's type is assignable to the other, the more permissive one wins; if both are bidirectionally assignable, the wider one (higher conversion score) is chosen; for unrelated struct types, a shared ancestor in the parent chain is used; otherwise the result is the unknown type.

@cirras cirras left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you closed #440 and opened a new PR. If it's because there was a merge commit in that PR, that could have easily been cleaned up by rewriting the PR branch. 🤔

@cirras cirras left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolves #407. Introduces parsing, type resolution, and control-flow
modelling of Delphi 13's conditional if operator
(e.g. X := if Foo then Bar else Baz). The branches are modelled as
mutually-exclusive paths in the CFG.

The expression's type is the LUB of the then/else branch types:
exact matches and unknown-side fallbacks are returned directly; if
only one branch's type is assignable to the other, the more
permissive one wins; if both are bidirectionally assignable, the
wider one (higher conversion score) is chosen; for unrelated struct
types, a shared ancestor in the parent chain is used; otherwise
the result is the unknown type.

This whole commit message body looks like an AI-generated summary of implementation minutia and is not useful.

Resolves integrated-application-development#407.

Delphi 13 introduces an `if ... then ... else ...` expression. Parse it,
model the branches as mutually-exclusive paths in the control flow graph,
and resolve its type as the least upper bound of the branch types, as
determined by the Delphi compiler.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Bazooper-blip Bazooper-blip force-pushed the claude/pr-440-upmerge-adjust-L8U0P branch from fa3c967 to 60424f1 Compare June 9, 2026 08:45
@Bazooper-blip Bazooper-blip requested a review from cirras June 9, 2026 09:02
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.

Support if expressions

2 participants