Skip to content

Map update syntax causes error #29

@turion

Description

@turion

Consider this example module:

defmodule Foo do
  @spec foo(t, map()) :: %{ :foo => t } when t: any()

  def foo(t, some_map) do
    %{some_map | foo: t}
  end
end

It causes this error:

$ mix type
** (CaseClauseError) no case clause matching: {%ExType.Context{}, %ExType.Type.List{type: %ExType.Type.Union{types: [%ExType.Type.TypedTuple{types: [%ExType.Type.Atom{literal: true, value: :foo}, %ExType.Type.Any{}]}, %ExType.Type.Map{key: %ExType.Type.Any{}, value: %ExType.Type.Any{}}]}}}
    lib/ex_type/checker.ex:37: 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
    lib/ex_type/custom_env.ex:164: ExType.CustomEnv.process_defs/5
    (elixir 1.10.4) lib/enum.ex:1400: anonymous fn/3 in Enum.map/2

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