Qqwy / elixir-type_check

TypeCheck: Fast and flexible runtime type-checking for your Elixir projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UndefinedFunctionError with TypeCheck.conforms

dvic opened this issue · comments

Given

defmodule User do
  use TypeCheck

  @type! t :: %{
           :name => binary,
           optional(atom()) => term()
         }
end

and running TypeCheck.conforms(%{}, User.t()), I get

** (UndefinedFunctionError) function Code.Identifier.inspect_as_key/1 is undefined or private
    (elixir 1.14.0) Code.Identifier.inspect_as_key(:name)
    (type_check 0.12.1) lib/type_check/builtin/compound_fixed_map.ex:78: TypeCheck.Protocols.Inspect.TypeCheck.Builtin.CompoundFixedMap.to_map_kv/2
    (elixir 1.14.0) lib/inspect/algebra.ex:472: Inspect.Algebra.container_each/6
    (elixir 1.14.0) lib/inspect/algebra.ex:449: Inspect.Algebra.container_doc/6
    (type_check 0.12.1) lib/type_check/builtin/compound_fixed_map.ex:63: TypeCheck.Protocols.Inspect.TypeCheck.Builtin.CompoundFixedMap.inspect/2
    (type_check 0.12.1) lib/type_check/protocols/inspect.ex:105: TypeCheck.Inspect.inspect/2
    (type_check 0.12.1) lib/type_check/protocols/inspect.ex:122: TypeCheck.Inspect.inspect_binary/2
    iex:13: (file)

Just to double check, the above map syntax should work with the latest version of type_check, right?

Yes, the syntax is correct!

This is a compatibility problem with Elixir v1.14, where Code.Identifier.inspect_as_key no longer exists (it was an internal API), as it was moved to the Macro module. There is a PR in the works to allow Elixir v1.14 support. ( #150 )

Yes, the syntax is correct!

This is a compatibility problem with Elixir v1.14, where Code.Identifier.inspect_as_key no longer exists (it was an internal API), as it was moved to the Macro module. There is a PR in the works to allow Elixir v1.14 support. ( #150 )

I see, thanks for explaining!