Skip to content

Std fails to build against latest Rux dev after #136: untyped int literals passed to typed parameters #43

@FeliceMente

Description

@FeliceMente

Summary

Std no longer compiles against the latest Rux compiler dev. After rux-lang/Rux#136 (fix: LookupFunction no longer silently falls back to first overload, commit 4d3b0a8), the overload resolver enforces IsAssignableTo for the arguments of a call. Many Std call sites pass an untyped integer literal (type int) to a parameter of a different integer type (uint32, int32, uint). Those conversions are not implicitly allowed (signed→unsigned and narrowing require an explicit as), so they now fail to resolve and Std does not build.

Before #136 the resolver silently returned the (only/first) overload without checking argument assignability, so these latent mismatches compiled. Nothing in Std changed — the compiler stopped ignoring pre-existing type errors.

This is not macOS-specific: the affected files include platform-neutral code (Fatal.rux, String.rux), so every target's Std build is affected.

Reproduction

Build any Std-dependent package with a Rux compiler at or after #136 (merge 78059a7):

error: no matching overload for 'Exit' with argument types (int)     Src/Fatal.rux:18
error: no matching overload for 'Set' with argument types (*opaque, uint, int)   Src/Memory.rux
error: no matching overload for 'Alloc' with argument types (int)    Src/String.rux

(The frontend stops at the first error per file, so the list above is not exhaustive — more sites surface once each is fixed.)

Representative failing call sites

  • Src/Fatal.rux:18Exit(1) but Exit(code: uint32) (Src/System.rux).
  • Src/Memory.rux Zero (all byte-loop targets, e.g. line 323) — Set(ptr, size, 0) but Set(ptr: *opaque, size: uint, value: int32).
  • Src/String.rux:165Alloc(0) but Alloc(size: uint).

Suggested fix

Give the literals the parameter's type (matches the repo convention that typed integer literals are explicit, e.g. 0u64, -1i32):

  • Exit(1u32)
  • Set(ptr, size, 0i32)
  • Alloc(0u)

and likewise for the other untyped-literal arguments throughout Std.

Environment

  • Rux dev at 2935404 (post-#136) — fails. Pre-#136 (e.g. 29c59ec) — builds fine.
  • Reproduced building Std on macOS (arm64 host, x86-64 Mach-O output), but the root cause is platform-independent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions