From c51c35bfe418d4543255c6e6a87c81f360682894 Mon Sep 17 00:00:00 2001 From: Kacper Marzecki Date: Sat, 12 Jul 2025 12:53:59 +0200 Subject: [PATCH] debug --- lib/debug.ex | 9 +++++++++ lib/til.ex | 9 +++------ test/til_test.exs | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/debug.ex b/lib/debug.ex index 4845418..5621414 100644 --- a/lib/debug.ex +++ b/lib/debug.ex @@ -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}):") diff --git a/lib/til.ex b/lib/til.ex index 680c486..23b50db 100644 --- a/lib/til.ex +++ b/lib/til.ex @@ -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) diff --git a/test/til_test.exs b/test/til_test.exs index d125289..cb4a9cc 100644 --- a/test/til_test.exs +++ b/test/til_test.exs @@ -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