Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/elixir/lib/module/types/expr.ex
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ defmodule Module.Types.Expr do
of_expr(pos_head, term(), pos_head, %{stack | reverse_arrow: :cache}, acc_context)

# Reset the context vars, keep warnings, as we will infer with expected truthy
context = Of.reset_vars(context, acc_context)
# context = Of.reset_vars(context, acc_context)

context =
maybe_always_or_never_match_cond(pos_head_type, pos_head, pos_meta, stack, context, false)
Expand Down Expand Up @@ -355,7 +355,7 @@ defmodule Module.Types.Expr do
of_expr(head, term(), head, %{stack | reverse_arrow: :cache}, acc_context)

# Reset the context vars, keep warnings, as we will infer with expected truthy
context = Of.reset_vars(context, acc_context)
# context = Of.reset_vars(context, acc_context)

context =
maybe_always_or_never_match_cond(head_type, head, meta, stack, context, last?)
Expand Down
13 changes: 13 additions & 0 deletions lib/elixir/test/elixir/module/types/expr_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3261,5 +3261,18 @@ defmodule Module.Types.ExprTest do
)
) == dynamic() or binary()
end

test "case nested in cond" do
assert typecheck!(
[value],
cond do
(case float? = is_float(value) do
false -> is_integer(value)
true -> true
end) ->
float?
end
) == boolean()
end
end
end
Loading