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 returning [Type, false] from resolve_type #4412

Merged
merged 1 commit into from Mar 29, 2023

Commits on Mar 29, 2023

  1. Fix returning [Type, false] from resolve_type

    #4130 fixed returning
    `[Type, nil]` from a union's `resolve_type`, but it caused a regression
    for literal `false` values.
    
    `Schema#resolve_type` had a `if resolved_value` conditional would be false
    for `false` values causing it _always_ return a single value (the `resolve_type`).
    
    The runtime's `resolve_type` method would then _always_ return the tuple
    version (in non-lazy cases): `[type, value]`. However, since
    `Schema#resolve_type` was only returning a single value, the resolved
    value would be lost resulting in `[type, nil]` being passed on.
    
    The fix is to remove the `if resolved_value` conditional entirely and
    always return the two-value tuple ensuring the original resolved value
    is correctly passed along.
    
    Note: the runtime still has a branch to check if the `resolve_type`
    value is a tuple or not. The only case where this won't be true is for
    lazy resolved types.
    swalkinshaw committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    e755a35 View commit details
    Browse the repository at this point in the history