Skip to content

typecheck: bare integer literals pin to I32 -- 27 tri-net specs false-fail on u32 assignments #1923

Description

@gHashTag

infer_expr types every integer literal as I32, so in u32-dominant specs every 'let x = 0; ... x = u32_expr;' and 'metric = 100 - value' raises a false 'cannot assign U32 to I32' -- 27 of tri-net's specs fail typecheck TODAY on exactly this (invisible until #1922 made typecheck matter, since the hook only checks staged files). Fix: a bare NON-NEGATIVE literal is context-polymorphic (Unknown); only explicitly negative literals commit to I32; and promote_types resolves Unknown+Known to the Known operand. tri-net sweep: 27 failing -> 2 (the two remaining are 'assign to immutable array element' singletons, tracked with the C-tail in #1919).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions