Skip to content

In "Desired/Found", using quote inside add_dep is printing the AST #338

@aifrak

Description

@aifrak

Code of Conduct

  • I agree to follow this project's Code of Conduct

AI Policy

  • I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.

Versions

Elixir: 1.18.4
Erlang: 27

Operating system

Ubuntu inside Windows WSL

Current Behavior

Trying to update dependency with add_dep like this:

|> Igniter.Project.Deps.add_dep(
  {:esbuild, "~> 0.10", runtime: quote(do: Mix.env() == :dev)},
)

Current behaviour

In "Desired" and "Found", we get this:

Desired: `{:esbuild, "~> 0.10", [runtime: {:==, [context: Phoenix.LiveView.Igniter.UpgradeTo1_1, imports: [{2, Kernel}]], [{{:., [], [{:__aliases__, [alias: false], [:Mix]}, :env]}, [], []}, :dev]}]}`
Found: `{:esbuild, "~> 0.8", [runtime: true]}`

For "Desired", the AST of quote(do: Mix.env() == :dev) is printed.

For "Found", Mix.env() == :dev has been evaluated.

Expected behaviour

Here is what we should have in best case:

Desired: `{:esbuild, "~> 0.10", runtime: Mix.env() == :dev}`
Found: `{:esbuild, "~> 0.8", runtime: Mix.env() == :dev}`

Related PR

Related to phoenixframework/phoenix_live_view#4011 (comment)

Reproduction

Trying to update a dependency with add_dep like this:

|> Igniter.Project.Deps.add_dep(
  {:esbuild, "~> 0.10", runtime: quote(do: Mix.env() == :dev)},
)

Dedicated branch with the issue in a fork of phoenix_live_view: phoenixframework/phoenix_live_view@main...aifrak:phoenix_live_view:igniter-issue-add-deps

Expected Behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    Soon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions