Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lambda return type inference #793

Merged
merged 3 commits into from
Oct 16, 2023
Merged

Fix lambda return type inference #793

merged 3 commits into from
Oct 16, 2023

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented Oct 15, 2023

Previous fix for #510 incorrectly checked inferred lambda body type for unit instead of checking for convergence. This created two bugs: ambiguous types would be treated as unit improperly and implicit unit return would be treated as ambiguous.
Fixes #700
Fixes #790

Previous fix for #510 incorrectly checked inferred lambda body type for unit instead of checking for convergence.This created two bugs: ambigous bypes would be treated as unit improperly and implicit unit return would be treated as ambiguous.
Fixes #700
Fixes #790
@swernli swernli added this pull request to the merge queue Oct 16, 2023
Merged via the queue into main with commit 3ac4626 Oct 16, 2023
@swernli swernli deleted the swernli/issue700 branch October 16, 2023 23:17
swernli added a commit that referenced this pull request Feb 20, 2025
This fixes a quirk leftover from the fixes in #649 and #793. Those introduced and then updated a conditional that avoided unifying certain types during type checking, but it turns out it was always safe to unconditionally unify the types once #649 introduced the explicit return type tracking. With this fix, the lifted lambda callables with explicit returns have the correct output type instead of always being `Unit` and RCA is able to use that type information as expected, avoiding the panic.

Fixes #2186
github-merge-queue bot pushed a commit that referenced this pull request Feb 20, 2025
This fixes a quirk leftover from the fixes in #649 and #793. Those
introduced and then updated a conditional that avoided unifying certain
types during type checking, but it turns out it was always safe to
unconditionally unify the types once #649 introduced the explicit return
type tracking. With this fix, the lifted lambda callables with explicit
returns have the correct output type instead of always being `Unit` and
RCA is able to use that type information as expected, avoiding the
panic.

Fixes #2186
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.

Lambda Doesn't Recognize Unit Return Value Lambda type inference assumes unit return type
2 participants