You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type checker crashes (MatchError in Of.refine_body_var/5) when a for generator uses a variable bound in into: or reduce: #16102
$ elixir repro.exs
# main and v1.20.5:
** (RuntimeError) found error while checking types for A.f/1:
** (MatchError) no match of right hand side value:
%{
vars: %{
0 => %{name: :list, ...}
},
...
}
The exception happened while checking this code:
def f(list) do
for x <- items,
do: x,
into:
(
items = list
[]
)
end
Please report this bug at: https://github.com/elixir-lang/elixir/issues
(elixir 1.21.0-dev) lib/module/types/of.ex:114: Module.Types.Of.refine_body_var/5
(elixir 1.21.0-dev) lib/module/types/helpers.ex:583: Module.Types.Helpers.zip_map_reduce/5
(elixir 1.21.0-dev) lib/module/types/apply.ex:410: Module.Types.Apply.remote/8
(elixir 1.21.0-dev) lib/module/types/expr.ex:879: Module.Types.Expr.for_clause/3
(elixir 1.21.0-dev) lib/enum.ex:2643: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir 1.21.0-dev) lib/module/types/expr.ex:676: anonymous fn/6 in Module.Types.Expr.of_expr/5
Expected behavior
The module compiles and runs:
$ elixir repro.exs
# expected: A.f([1, 2]): [1, 2]
# main: ** (RuntimeError) found error while checking types for A.f/1: ** (MatchError) ...
This report and #16101 come from an agentic property-based testing framework I am working on called Ephyra, I have 7 more local reports, I can send file them if this style of report and the amount of information provided is useful for you. Please let me know how I should continue forward.
Btw, @alpaylan, could you write one paragraph or two (it is ok to ask AI to dump a summary of the session) about how you used Ephyra to find these bugs? My initial reaction was that it was a Rust project, so I am curious about how it found Elixir bugs! Thank you once again!
@josevalim will do! I can also share the harness if you would be interested in using it! It's definitionally slop, because I treat the generator code as an "observational artifact", so the generator is essentially judged not by its code but by its measurable metrics. I am working on a UX that makes it possible to hide the monstrous synthesized generator completely, but that'll take some time to nail I think.
Slop is fine, it is not meant to be a committed artifact anyway! And I agree the bugs it finds is what really matters! Anything you can share will be definitely useful!
Activity
alpaylan commentedon Nov 11, 2026
Hi @josevalim @gldubc,
This report and #16101 come from an agentic property-based testing framework I am working on called Ephyra, I have 7 more local reports, I can send file them if this style of report and the amount of information provided is useful for you. Please let me know how I should continue forward.
josevalim commentedon Nov 11, 2026
@alpaylan if you have 7 other, you can open up issues. That amount is manageable. And thank you for asking first, that's very kind.
alpaylan commentedon Nov 11, 2026
Thank you very much @josevalim, I filed the remaining 7. Please let me know if I can be helpful in any way.
josevalim commentedon Nov 11, 2026
Btw, @alpaylan, could you write one paragraph or two (it is ok to ask AI to dump a summary of the session) about how you used Ephyra to find these bugs? My initial reaction was that it was a Rust project, so I am curious about how it found Elixir bugs! Thank you once again!
alpaylan commentedon Nov 11, 2026
@josevalim will do! I can also share the harness if you would be interested in using it! It's definitionally slop, because I treat the generator code as an "observational artifact", so the generator is essentially judged not by its code but by its measurable metrics. I am working on a UX that makes it possible to hide the monstrous synthesized generator completely, but that'll take some time to nail I think.
josevalim commentedon Nov 11, 2026
Slop is fine, it is not meant to be a committed artifact anyway! And I agree the bugs it finds is what really matters! Anything you can share will be definitely useful!
alpaylan commentedon Nov 11, 2026
@josevalim
You can view it here #16113
Type check for options before generators