Skip to content

Reject known generic containers as string concatenation operands #1121

Closed

Description

@ehartford

Spec §15.4.9 requires non-str operands of ++ to fail at compile time.

Minimal reproduction:

fn value() -> Result[str, i32]: "hello"
fn main: print(value() ++ "!")

check and analyze ... audit:all accept this (audit: facts=11369,
violations=0). An equivalent file-read probe crashes in with_str_concat_ref
when it interprets the Result representation as a string.

Exact proof on the fnabi-phase0 stage1: LLDB Sema.check_binary+5452 has
w24=14 (TY_GENERIC_INST). The comparison against 10 and branch at +5456 skip
the left-operand diagnostic, landing at +5624. Source: src/SemaCheck.w:8607
(the right-side predicate at 8609 has the same omission). The predicate
confuses an unresolved type parameter with a known instantiated container.

Runtime proof: debug allocator enabled, WITH_ALLOC_NO_REUSE=1; native LLDB
stops in rt_memcpy at rt_core.w:309 via with_str_concat_ref at 2057, reading
the Result payload as a string address/length. Local logs:
out/fnabi-validation/concat-result-sema-proof.txt and
out/fnabi-validation/phase0-audit-tool-native-crash.txt.

A fix and both operand-side regressions are in progress in the current batch.
The file-writing probe now explicitly unwraps read_file's Result; it is no
longer relying on the stale read_file-returning-str assumption in AGENTS.md.

Activity

  1. added a commit that references this issue on Sep 14, 2026
    5809ac1
  2. added a commit that references this issue on Sep 16, 2026
    936c1a0
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