Skip to content

Synthesised main emits a stray trailing space vs explicit main (breaks byte-exact goldens) #157

Description

@MelbourneDeveloper

Summary

A program whose main is synthesised from trailing top-level statements
emits output that differs from the byte-identical-looking explicit-main version
by a single trailing space on the last line. This breaks the byte-for-byte
golden comparison the differential harness relies on.

Repro

examples/tested/effects/algebraic_effects_comprehensive — de-maining the
.ospml/.osp pair (removing the fn main() / main () = wrapper and letting
main be synthesised from the trailing statements) produces output that is
identical to the .expectedoutput golden except for one trailing space on the
final line
. Diff is whitespace-only:

< ...last line>·
---
> ...last line>

(· = trailing space present only in the synthesised-main output.)

Expected

Synthesised main and explicit main must emit byte-identical bytes, including
trailing whitespace / final-newline handling. No spurious trailing space.

Impact

  • Blocks de-maining algebraic_effects_comprehensive (kept its explicit main
    only to avoid corrupting the golden).
  • Any program relying on synthesised main may carry a stray trailing space,
    silently failing byte-exact output assertions.

Notes

Surfaced while removing needless main wrappers. Likely in the codegen path that
synthesises main from trailing statements (crates/osprey-codegen, the
trailing-statement → synthesised-main lowering). Low severity but a correctness
/ reproducibility bug for the differential harness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions