This commit is contained in:
Kacper Marzecki 2025-07-12 12:53:59 +02:00
parent 214b4b06ac
commit c51c35bfe4
3 changed files with 16 additions and 6 deletions

View File

@ -630,6 +630,15 @@ defmodule Tdd.Debug do
{:ok, {var, y_id, n_id, dc_id}} ->
IO.puts("#{prefix}ID #{id}: IF #{inspect(var)}")
case var do
{_, :c_head, nested_id, _} when nested_id != nil ->
print_tdd_graph(nested_id, "Var in #{id}")
_ ->
""
end
IO.puts("#{prefix} ├─ Yes (to ID #{y_id}):")
do_print_tdd_node(y_id, indent_level + 2, new_visited, store_module)
IO.puts("#{prefix} ├─ No (to ID #{n_id}):")

View File

@ -1453,6 +1453,7 @@ defmodule Tdd.Algo do
# TODO: Handle placeholder nodes encountered during co-inductive simplification.
# A placeholder is treated as `any` for the check, so its negation is `none`.
{:ok, {:placeholder, _spec}} ->
IO.inspect("RETURNING FALSE FOR NEGATE PLACEHOLDER")
Store.false_node_id()
end
@ -1470,12 +1471,6 @@ defmodule Tdd.Algo do
case Store.get_op_cache(cache_key) do
{:ok, result_id} ->
Logger.info("result #{inspect([result_id])}")
if result_id == 1 do
Logger.info("ASD #{inspect([tdd_id, assumptions])}")
end
result_id
:not_found ->
@ -1905,6 +1900,7 @@ defmodule Tdd.Compiler do
@spec spec_to_id(TypeSpec.t()) :: non_neg_integer()
def spec_to_id(spec) do
normalized_spec = TypeSpec.normalize(spec)
IO.inspect(normalized_spec, label: "NORMALIZED SPEC")
compile_normalized_spec(normalized_spec, %{})
end
@ -2090,6 +2086,7 @@ defmodule Tdd.Compiler do
Debug.print_tdd_graph(id1, "IS_SUBTYPE id1")
id2 = spec_to_id(spec2)
Debug.print_tdd_graph(id2, "IS_SUBTYPE id2")
IO.inspect("___________________________________")
neg_id2 = Algo.negate(id2)
Debug.print_tdd_graph(neg_id2, "IS_SUBTYPE neg_id2")
intersect_id = Algo.apply(:intersect, &op_intersect_terminals/2, id1, neg_id2)

View File

@ -428,5 +428,9 @@ defmodule TddSystemTest do
assert_equivalent_specs(list_of_int_from_apply, int_list)
end
test "negate list type" do
refute_subtype({:negation, {:list_of, :integer}}, :none)
end
end
end