Skip to content

bug: info generators choke on %{} #101

@frankdugan3

Description

@frankdugan3

Describe the bug

When I try to use the info generator like so:

defmodule Pyro.Info do
  @moduledoc "Introspection for pyro."

  use Spark.InfoGenerator, extension: Pyro.Component, sections: [:global, :components]

I get the following error:

error: invalid quoted expression: %{}

Please make sure your quoted expressions are made of valid AST nodes. If you would like to introduce a value into the AST, such as a four-element tuple or a map, make sure to call Macro.escape/1 before
└─ deps/spark/lib/spark/info_generator.ex


== Compilation error in file lib/pyro/info.ex ==
** (CompileError) deps/spark/lib/spark/info_generator.ex: cannot compile file (errors have been logged)
    (stdlib 6.0) lists.erl:2343: :lists.mapfoldl_1/3

Runtime

Elixir v1.17.0-rc.1 (OTP 27)
Erlang 27.0
OS Arch BTW
Spark 2.1.24

Additional context

I suspect it could either be related to this schema that is an option on all sections/entities:

defmodule Pyro.Schema.Variable do
  @moduledoc false

  @schema [
    type: {:map, :atom, :any},
    default: %{},
    doc: "variables to merge into scope"
  ]
  @doc false
  def schema, do: @schema
end

Or possibly this struct property default that I add to all entities:

  defstruct [
    # ...
    variables: %{}
  ]

Those are the only ways I'm using %{} in the schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions