Skip to content

eval: builtin edge cases - std.range(-1) panics, std.env empty-string default ignored #451

Description

@pskry

Found while writing negative goldens for #446.

  1. std.range(-1) panics the evaluator: makeslice: len out of range at eval.go:1290. A user typo in a range bound crashes scampi instead of raising a diagnostic. Needs a typed error (negative count) or clamp-to-empty, plus a golden.

  2. std.env("X", "") treats an explicit empty-string default as no default: the fallback check is def != "", so passing "" still errors with EnvVarNotSet. An explicit default should win regardless of value. Needs a presence-based check (arity) instead of a sentinel comparison.

Both are golden-testable once fixed (testdata/eval/errors_runtime/ for the first, a happy-path eval fixture for the second).

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact/mediumImproves a real workflowkind/bugSomething is not workingpriority/highThe priority is high

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions