Skip to content

The @unsafe count is disclosed only on the no-main path: a harmless main, or any -o emit/build, reports nothing #805

Closed

Description

@phenomenon0

What you did

One fixture, three commands. main.bend imports PROOF.bend, which imports unsafe.bend (@unsafe def contradiction() -> {0n == 1n : Nat}):

  • bend PROOF.bend (no main)
  • bend main.bend (main = 7)
  • bend main.bend -o main.js and bend main.bend -o main (emit / build)

What happened

bend PROOF.bend:

1 term annotated as unsafe.
The code is well-typed, but may contain logical paradoxes.

bend main.bend:

7

-o main.js and -o main: no output at all. Exit 0 in every case.

The only @unsafe disclosure comes from the no-main path; a harmless main (or any -o) drops it while the unsafe def stays in the import graph. In bend2/main.ts at 0b7e2b1, cli_report (line 397) is the only place the count is printed, book_run calls it only in its no-main branch (lines 454-460), and cli_emit (line 196) never reports it. Reproduced on 2.0.4 and 2.0.5. (Related: #776 covers the proof-mode exit code; this one is the disclosure vanishing in run/emit.)

The file

import Base
import ./PROOF.bend as P

def main() -> U32:
  7

(the other two files: PROOF.bend states a law discharged by U.contradiction(); unsafe.bend holds the @unsafe def contradiction() -> {0n == 1n : Nat}: contradiction())

bend --version

bend 2.0.5 (2.0.4 the same)

uname -sm

Linux x86_64

clang --version (the first line)

clang version 21.1.7 (Fedora 21.1.7-1.fc43)

Activity

  1. VictorTaelin commented on Sep 18, 2026

    @VictorTaelin
    Contributor

    Shipped in 2.0.8: the unsafe count also prints on stderr before a run, an emit or a publish, so no path is silent about @unsafe. The no-main verdict is unchanged: "All terms check." or "All terms check, with N unsafe annotations."

    Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself.

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