Skip to content

everywhere: Add pattern matching for optionals#1627

Merged
alimpfard merged 4 commits into
SerenityOS:mainfrom
robryanx:enum-infer-and-optional-match
Feb 16, 2026
Merged

everywhere: Add pattern matching for optionals#1627
alimpfard merged 4 commits into
SerenityOS:mainfrom
robryanx:enum-infer-and-optional-match

Conversation

@robryanx

Copy link
Copy Markdown
Contributor

Support matches of the form:

fn valueOrDefault(anon value: i64?) -> i64 {
    return match value {
        Some(v) => v
        None => 0
    }
}

Update the stage0 bootstrap then refactor each instance in the compiler codebase where we can now match direction on the optional instead of on the bool has_value().

@BuggieBot

Copy link
Copy Markdown
Member

Hello!

One or more of the commit messages in this PR do not match the Jakt code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

@robryanx
robryanx force-pushed the enum-infer-and-optional-match branch from 270db56 to 4a67b5b Compare February 15, 2026 23:00
@alimpfard

Copy link
Copy Markdown
Member

Nice, looks good!

@alimpfard
alimpfard merged commit b43ebe2 into SerenityOS:main Feb 16, 2026
5 of 6 checks passed
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.

3 participants