Preserve left element types in list subtraction - #15808
Open
lukaszsamson wants to merge 1 commit into
Open
Conversation
Teach the type system that list subtraction returns a possibly-empty sublist of its left operand while preserving proper-list validation for both operands. Assisted-by: Codex:GPT-5
josevalim
reviewed
Aug 29, 2026
| defp remote_apply(:erlang, :--, _info, [left, right], stack) do | ||
| case {list_of(left), list_of(right)} do | ||
| {{_, list_of}, {_, _}} -> | ||
| result = if list_of, do: list(list_of), else: empty_list() |
Member
|
@lukaszsamson ideally, we don't want to implement most of those, except for:
In that case, I am thinking the type signature of this would be |
Member
|
Actually, ignore me, it is an Erlang function, we need to type it anyway. We may have more precise signatures later, but we do need to type it, so the change is good. I updated my list above. Just check my comment in the code! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Teach the type system that list
--returns a possibly empty sublist of its left operand while preserving proper-list validation for both operands.Assisted-by: Codex:GPT-5.6 Sol, Claude Fable 5