Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: info generators choke on %{} #101

Open
frankdugan3 opened this issue Jun 10, 2024 · 0 comments
Open

bug: info generators choke on %{} #101

frankdugan3 opened this issue Jun 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@frankdugan3
Copy link
Contributor

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.

@frankdugan3 frankdugan3 added the bug Something isn't working label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant