Skip to content

Support non string labels#39

Merged
princemaple merged 1 commit intoprincemaple:mainfrom
martosaur:am/inspectable_labels
Sep 28, 2024
Merged

Support non string labels#39
princemaple merged 1 commit intoprincemaple:mainfrom
martosaur:am/inspectable_labels

Conversation

@martosaur
Copy link
Contributor

Hi 👋

Non-string labels are passed to inspect result as-is which doesn't work for e.g. atoms:

iex(2)> DG.new() |> tap(& DG.add_vertex(&1, 1, :foo))
#Inspect.Error<
  got FunctionClauseError with message:

      """
      no function clause matching in Inspect.Algebra.concat/2
      """

  while inspecting:

      %{
        opts: [],
        __struct__: DG,
        dg: {:digraph, #Reference<0.220188636.626130951.253424>,
         #Reference<0.220188636.626130951.253425>,
         #Reference<0.220188636.626130951.253426>, true}
      }

  Stacktrace:

    (elixir 1.16.3) lib/inspect/algebra.ex:587: Inspect.Algebra.concat(:foo, "]")
    (elixir 1.16.3) lib/inspect/algebra.ex:946: Inspect.Algebra.fold_doc/2
    (dg 0.4.0) lib/inspect.ex:14: anonymous fn/2 in Inspect.DG.inspect/2
    (elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
    (dg 0.4.0) lib/inspect.ex:11: Inspect.DG.inspect/2
    (elixir 1.16.3) lib/inspect/algebra.ex:347: Inspect.Algebra.to_doc/2
    (elixir 1.16.3) lib/kernel.ex:2352: Kernel.inspect/2
    (iex 1.16.3) lib/iex/evaluator.ex:376: IEx.Evaluator.io_inspect/1

>

@princemaple princemaple merged commit 4332117 into princemaple:main Sep 28, 2024
@princemaple
Copy link
Owner

Thanks!

@martosaur martosaur deleted the am/inspectable_labels branch September 28, 2024 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants