Skip to content

Struct update causes crash #32

@turion

Description

@turion

Related to #31 #29.

defmodule Foo do
  defstruct [:foo]
  @spec foo(t) :: %Foo{ foo: t } when t: any()

  def foo(t) do
    %Foo{foo(23) | foo: t}
  end
end
$ mix type
Compiling 1 file (.ex)
** (FunctionClauseError) no function clause matching in anonymous fn/1 in ExType.Checker.eval/2    
    
    The following arguments were given to anonymous fn/1 in ExType.Checker.eval/2:
    
        # 1
        {:|, [line: 6], [{:foo, [line: 6], [23]}, [foo: {:t, [line: 6], nil}]]}
    
    lib/ex_type/checker.ex:66: anonymous fn/1 in ExType.Checker.eval/2
    (elixir 1.10.4) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
    lib/ex_type/checker.ex:66: ExType.Checker.eval/2
    lib/ex_type/typespec.ex:795: anonymous fn/3 in ExType.Typespec.match_typespec/3
    (elixir 1.10.4) lib/enum.ex:3343: Enum.flat_map_list/2
    lib/ex_type/typespec.ex:778: anonymous fn/4 in ExType.Typespec.match_typespec/3
    (elixir 1.10.4) lib/enum.ex:3343: Enum.flat_map_list/2
    lib/ex_type/typespec.ex:776: ExType.Typespec.match_typespec/3

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