Skip to content

with -e: a program of only let statements links with no main ("_main" undefined) instead of running as an implicit main #1816

Closed

Description

@ehartford

with v0.15.2.1-g99939352f:

$ with -e 'let x = 1'
Undefined symbols for architecture arm64:
  "_main", referenced from:
      <initial-undefines>
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1
$ with -e 'let x = 1
print(x)'
1

A -e program whose top-level statements are all lets (a realistic one: use std.fs / let text = read_file(...) / let _ = write_file(...)) is read as module-level globals and gets no implicit main, so the link fails — a raw linker error with no With diagnostic. AGENTS.md: "a .w file needs no fn main; top-level statements ARE the program". Either the statements are the implicit main, or the compiler says why not before the linker does (No Silent Fallbacks: a raw ld error is not a diagnostic).

Found while writing a commit message with a with -e transform (fix-emitc, #1484).

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