Skip to content

A file named after a Base family (Word.bend) resolves bare names into that family: Nil becomes Word.Nil #1124

Closed

Description

@nicolas-abril

What you did

bend main.bend

with three files in one directory.

What happened

SOME PROOFS FAIL
Error:
- expected : a declared constructor (List declares Nil, Con)
- observed : Nil{}
Location: f
3 | def f() -> Nat:
4>|   List.length(&1, U32, Nil{})
  |                        ^^^^^

A file's namespace is its path, so Word.bend is Word, one of Base's own family prefixes. Inside it the bare Nil{} resolves to Base's Word.Nil instead of List's Nil (an unknown name is the file's own, and Word.Nil exists). Likewise String.bend's bare eq, which neither file declares, binds Base's String.eq. I expected the bare Base name (Nil is List's), or the layout refused as a clash with Base.

The file

main.bend:

import Base
import ./Word.bend as W
import ./String.bend as S

def main() -> Nat:
  W.f()

Word.bend:

import Base

def f() -> Nat:
  List.length(&1, U32, Nil{})

String.bend:

import Base

def k() -> Bool:
  eq("a", "a")

bend --version

Bend 2.0.32 (main d2066a52); also on 2.0.31 (af569d48)

uname -sm

Darwin arm64

clang --version (the first line)

Apple clang version 17.0.0 (clang-1700.6.4.2)

Found by the bend2 differential fuzzer.

Activity

  1. added
    bug
    on Sep 27, 2026
  2. changed the title [-]One expression of 86 nested U32 operators passes clang's bracket nesting limit (U32_BIN)[/-] [+]A file named after a Base family (Word.bend) resolves bare names into that family: Nil becomes Word.Nil[/+] on Sep 27, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions