Skip to content

Fields still cause compile-time dependencies #38

@axelson

Description

@axelson

Modules referenced as fields still create compile-time dependencies. e.g. this is an issue:

defmodule Person do
  use TypedEctoSchema

  typed_schema "people" do
    field(:country, Country, enforce: true, null: false)
  end
end

While this is not an issue:

defmodule Person do
  use TypedEctoSchema

  typed_schema "people" do
    belongs_to(:company, Company)
  end
end

I've created a simple phoenix project that serves as a reproduction of this issue: https://github.com/axelson/typed_struct_compile_repro

In it I expect this command to not show any compile-time dependencies, but instead it shows one compile-time dependency:

mix xref graph --source lib/typed_demo/person.ex
lib/typed_demo/person.ex
├── lib/typed_demo/company.ex
└── lib/typed_demo/country.ex (compile)

I believe this is a subset that was not fixed with #18 (original issue filed as #6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions