Skip to content

Unified: shorthand returns - #22854

Draft
asgerf wants to merge 6 commits into
github:mainfrom
asgerf:unified/shorthand-returns
Draft

asgerf wants to merge 6 commits into
github:mainfrom
asgerf:unified/shorthand-returns

Conversation

@asgerf

@asgerf asgerf commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Implements data flow support for Swift's short-hand returns.

When the body of a function consists of a single expression that resolves to a value, that value is implicitly the return value of the function. For example,

func foo() -> String { "42" }

is the same as

func foo() -> String { return "42" }

This is currently implemented on the QL side as the desugaring rule can't be implemented nicely with Yeast, but we might want to desugar it in the future, when Yeast offers better support for subtype checks.

Comment thread unified/ql/lib/codeql/unified/internal/FacadeAst.qll Fixed
Comment thread unified/ql/lib/codeql/unified/internal/FacadeAst.qll Fixed
@asgerf
asgerf force-pushed the unified/shorthand-returns branch 2 times, most recently from c1d2b1d to 20991fc Compare October 21, 2026 06:38
@asgerf
asgerf force-pushed the unified/shorthand-returns branch from 20991fc to 14d2cd8 Compare October 22, 2026 09:37
@asgerf
asgerf force-pushed the unified/shorthand-returns branch from 14d2cd8 to a3cdc86 Compare October 22, 2026 09:41
@asgerf
asgerf force-pushed the unified/shorthand-returns branch from a3cdc86 to 65001f0 Compare October 22, 2026 09:54

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants