Skip to content

ICE: a user type named Result breaks std generic instantiation (f64.parse_text contract) #2758

Closed

Description

@ehartford

Summary

Declaring a user type named Result ICEs the compiler instead of compiling (or erroring in std the way type Option does, #750):

type Result = i32
fn main:
    let x: Result = 3
    print(x)
BUG: user generic call lacks a concrete contract: body=209(f64.parse_text) call=2 node=2181 sig=-1 mono=0 [src/MirLower.w:19522 MirModule.validate_generic_call_contracts]

Reproduced 2026-10-26 on the installed compiler reseeded from ec88cbcbf (with v0.15.3.0). The body named is from str.parse (#959, merged this week), so this may be a fresh exposure of the #750 flat-name lookup (the compiler resolving Result — or Option, via parse_text's return type — to the user's declaration while instantiating std generics) rather than a separate defect. Filed separately per the #750 ruling so the ICE is tracked even if the fix turns out to be the same one-line-owner change; close as a duplicate of the #750 fix if so.

Related matrix (same session): type Regex = i32 works; type Option { a: i32 } and type Option = i32 fail inside <embedded-std>/std/string.w:519 ("? operator requires an Option, Result, or a type implementing Try").

Activity

  1. added a commit that references this issue on Oct 28, 2026
  2. ehartford commented on Oct 28, 2026

    @ehartford
    ContributorAuthor

    Fixed by #2763 (6126049), the #750 template-identity fix: the ICE was the same flat-map displacement (a user type Result = i32 became the template std's generic machinery instantiated). Regression: test/behavior/behav_750_user_result_shadows_std.w. Battery-green on 4062c27.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions