Skip to content

List.join is declared in the standard library for List[str] and its built-in is deleted (#3483); a Never type argument is not the wrong instantiation (#3508, D143) - #3510

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

ehartford merged 3 commits into
mainfrom
builtin-bodies-7

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Part of #3483 (D110), and a fix to #3509.

List.join is declared in std.collections in an impl List[str] block, over the runtime's join. Deleted from the compiler: its entry in builtin_method_intrinsic, the name-based return-type entry, its special case in the built-in call check, the BuiltinSigs row, the MirIntrinsic and CcBuiltin members and the arms in both code generators. The C header's prototype now matches the runtime source (uint8_t *, as the other list functions).

A list that does not hold text keeps the sentence that says what to do (List.join joins str elements, and this List holds i32; turn each element into text first …, err_vec_join_non_str), ahead of the general refusal.

A regression #3509 introduced, found by the battery. examples/json-parser has a function with an inferred return type that joins its own results. In the open pass over a self-calling body (D143) a call of the function itself reads Never, so the receiver is a List[Never], and the check added in #3509 refused it as another instantiation. The same held on main for any user type (Box { v: f(n - 1) }.shout() with shout declared for Box[str]). A type argument that is Never is a self-call the open pass has not typed yet: the check lets it through, and the pass that follows checks the real instantiation. The example is unchanged.

Tests: behav_3483_list_join_declared (no leaks under the debug allocator), behav_3483_join_in_a_self_calling_function (join and a user type's instantiation method in self-calling functions); the C-backend tests and the examples lane pass.

Fourteen built-ins have moved (three on List, eleven on str).

Battery green; :release-checks green.

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