Skip to content

str.contains, starts_with and ends_with are declared in the standard library and their built-ins are deleted (#3483); six contract help fixtures (#3129) - #3495

Merged
ehartford merged 5 commits into
mainfrom
builtin-bodies-3
Nov 21, 2026
Merged

ehartford merged 5 commits into
mainfrom
builtin-bodies-3

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Part of #3483 (D110) and of #3129.

Three str methods move to std.string, each over the runtime call its built-in made (with_str_contains_ref, with_str_starts_with_ref, with_str_ends_with_ref), and the compiler's copies are deleted: the table entries, three BuiltinSigs rows, the MirIntrinsic and CcBuiltin members and the arms in both code generators.

What :release-checks taught (the first attempt was red there, not in the battery). A unit compiled without the prelude (the Clang bridge object, the STC corpus's hand-written test harness) called these methods. The built-in table was gone, but a second, name-based return-type table still typed the call as bool, so it type-checked with nothing to call and lowering aborted with an internal error. Fixed at the cause:

  • the second table's entries are deleted, so the library declaration is the one place that knows these methods;
  • such a unit now gets unknown method 'starts_with' for type '&str' with the help "str methods are declared in std.string, which this unit does not import (it is compiled without the prelude): add use std.string"; a plain typo keeps the ordinary error;
  • the Clang bridge and the STC harness import std.string.

Tests: behav_3483_str_predicates_declared (a call, at compile time, in, as a method value, on a view, in a pipeline); the C-backend tests pass.

Six fixtures (#3129) pinning a contract refusal with its help line: the five buffer-field refusals and a fixed argument on an in-place initializer.

Battery green; :release-checks green (twice, on successive bases).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant