Skip to content

Typechecker no warn redundant case clause after %_{} #15635

Closed

Description

@AlexGx

Existing issue

  • I have searched existing issues and could not find a duplicate.

Elixir and Erlang/OTP versions

Erlang/OTP 29 [erts-17.0.3] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit] [dtrace]

Elixir 1.21.0-dev (34abdd4) (compiled with Erlang/OTP 29)

Operating system

any

Current behavior

Typechecker not warns on redundant case clauses after %_{}:

case x do
    %_{} -> :any # but this ok (warns): v when is_struct(v) -> :any
    %URI{} -> :uri
end

No warn during compilation.

Same for field-constrained and nested/composite variants:

%_{path: _}
{:ok, %_{}}

Expected behavior

Compiler should report

warning: the following clause is redundant:

        %URI{} ->

    previous clauses have already matched on the following types:

        %{..., __struct__: atom()}

    type warning found at:
    │
  6 │       %URI{} -> :uri 

Activity

  1. added a commit that references this issue on Jul 19, 2026
    aa3dbdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions