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

Sema: rewrite peer type resolution #15726

Merged
merged 3 commits into from
Jun 14, 2023

Commits on Jun 13, 2023

  1. Sema: rewrite peer type resolution

    The existing logic for peer type resolution was quite convoluted and
    buggy. This rewrite makes it much more resilient, readable, and
    extensible. The algorithm works by first iterating over the types to
    select a "strategy", then applying that strategy, possibly applying peer
    resolution recursively.
    
    Several new tests have been added to cover cases which the old logic did
    not correctly handle.
    
    Resolves: ziglang#15138
    Resolves: ziglang#15644
    Resolves: ziglang#15693
    Resolves: ziglang#15709
    Resolves: ziglang#15752
    mlugg committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    c9531eb View commit details
    Browse the repository at this point in the history
  2. Sema: allow in-memory coercion of tuples

    This allows tuples whose fields are in-memory coercible to themselves be
    coerced in memory. No InMemoryCoercionResult field has been added, so in
    future one could be added to improve error messages.
    mlugg committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    588f45a View commit details
    Browse the repository at this point in the history
  3. Sema: move all in-memory coercion logic to InternPool

    Previously, this logic was split between Sema.coerceValueInMemory and
    InternPool.getCoerced. This led to issues when trying to coerce e.g. an
    optional containing an aggregate, because we'd call through to
    InternPool's version which only recurses on itself so could not coerce
    aggregates. Unifying them is fairly simple, and also simplified a bit of
    logic in Sema.
    
    Also fixes a key lifetime bug in aggregate coercion.
    mlugg committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    8a92beb View commit details
    Browse the repository at this point in the history