Skip to content

Codegen fails for struct fields typed as usize/isize #3

Closed

Description

@ehartford

Summary

usize and isize work in with check, but using them as struct field types fails during codegen/build.

Reproduction

Compiler version:

with version
# with 0.0.1

Minimal repro:

type Shape = {
    d0: usize,
    s0: isize,
}

fn main:
    let x = Shape { d0: 1, s0: 2 }
    assert(x.d0 == 1)

Commands:

with check repro.w
# ok

with test repro.w
# error: unresolved type for field 'd0' in struct 'Shape'
# error: unresolved type for field 's0' in struct 'Shape'
# error: code generation failed
# error: test build failed

Expected

If usize / isize are accepted by the type checker, codegen should also support them as struct field types.

Actual

Codegen rejects those fields as unresolved.

Notes

This came up while bootstrapping a With library that follows the current docs and implementation notes, which use usize / isize heavily for shape/stride metadata.

Activity

  1. ehartford commented on Mar 21, 2026

    @ehartford
    ContributorAuthor

    Fixed on main in d8bb583. This was the same codegen primitive-resolution bug as #7: usize/isize struct fields now lower correctly, with regression coverage in test/cases/behav_struct_usize_fields.w.

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