elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.59k stars 3.38k forks source link

Error while checking types, asked to report this bug #14015

Open instancer-kirik opened 4 days ago

instancer-kirik commented 4 days ago

Elixir and Erlang/OTP versions

Setting up umbrella app, accounts and setting namespaces

** (EXIT from #PID<0.95.0>) an exception was raised:
    ** (RuntimeError) found error while checking types for ResolvinatorWeb.UserRegistrationLive.mount/3:

** (UndefinedFunctionError) function Veix.Accounts.User.__info__/1 is undefined (module Veix.Accounts.User is not available)
The exception happened while checking this code:

def mount(_params, _session, socket) do
  changeset =
    Veix.Accounts.Registration.change_user_registration(%Veix.Accounts.User{
      __meta__: %{
        __struct__: Ecto.Schema.Metadata,
        context: nil,
        prefix: nil,
        schema: Veix.Accounts.User,
        source: "users",
        state: :built
      },
      confirmed_at: nil,
      deepscape_profile: %{
        __cardinality__: :one,
        __field__: :deepscape_profile,
        __owner__: Veix.Accounts.User,
        __struct__: Ecto.Association.NotLoaded
      },
      email: nil,
      first_name: nil,
      id: nil,
      inserted_at: nil,
      last_name: nil,
      live_beats_profile: %{
        __cardinality__: :one,
        __field__: :live_beats_profile,
        __owner__: Veix.Accounts.User,
        __struct__: Ecto.Association.NotLoaded
      },
      password: nil,
      password_confirmation: nil,
      password_hash: nil,
      pause_effect_profile: %{
        __cardinality__: :one,
        __field__: :pause_effect_profile,
        __owner__: Veix.Accounts.User,
        __struct__: Ecto.Association.NotLoaded
      },
      resolvinator_profile: %{
        __cardinality__: :one,
        __field__: :resolvinator_profile,
        __owner__: Veix.Accounts.User,
        __struct__: Ecto.Association.NotLoaded
      },
      role: "user",
      settings: %{},
      timetracker_profile: %{
        __cardinality__: :one,
        __field__: :timetracker_profile,
        __owner__: Veix.Accounts.User,
        __struct__: Ecto.Association.NotLoaded
      },
      tokens: %{
        __cardinality__: :many,
        __field__: :tokens,
        __owner__: Veix.Accounts.User,
        __struct__: Ecto.Association.NotLoaded
      },
      typer_profile: %{
        __cardinality__: :one,
        __field__: :typer_profile,
        __owner__: Veix.Accounts.User,
        __struct__: Ecto.Association.NotLoaded
      },
      updated_at: nil
    })

  socket =
    assign_form(
      Phoenix.Component.assign(socket, trigger_submit: false, check_errors: false),
      changeset
    )

  {:ok, socket, temporary_assigns: [form: nil]}
end

Please report this bug at: https://github.com/elixir-lang/elixir/issues

        (accounts 0.1.0) Veix.Accounts.User.__info__(:struct)
        (elixir 1.17.2) lib/module/types/of.ex:182: Module.Types.Of.struct/6
        (elixir 1.17.2) lib/module/types/helpers.ex:128: Module.Types.Helpers.do_map_reduce_ok/3
        (elixir 1.17.2) lib/module/types/expr.ex:332: Module.Types.Expr.of_expr/3
        (elixir 1.17.2) lib/module/types/expr.ex:125: Module.Types.Expr.of_expr/3
        (elixir 1.17.2) lib/module/types/helpers.ex:128: Module.Types.Helpers.do_map_reduce_ok/3
        (elixir 1.17.2) lib/module/types/expr.ex:185: Module.Types.Expr.of_expr/3
        (elixir 1.17.2) lib/module/types.ex:56: Module.Types.warnings_from_clause/6

Operating system

6.10.13-3-MANJARO

Current behavior

configuring the accounts registration; just saw this in one of the steps

Expected behavior

warn or coerce correct namespacing? App.Accounts or ..

josevalim commented 4 days ago

Thank you. I assume the struct does exist, no? Is this happening in dev or tests? Can you provide a way to reproduce it?

instancer-kirik commented 3 days ago

during dev. It's not occurring now, the struct and references are now fully for Accounts.User, Accounts.Auth..

josevalim commented 3 days ago

Can you still reproduce it by doing changes to the code?