Skip to content

Typing violation on return case when calling function in macro #14300

@nulian

Description

@nulian

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Elixir 1.18.2 (compiled with Erlang/OTP 25)

Operating system

fedora

Current behavior

Compile error with while calling a function in a macro that has 2 different return types. That is implemented in a behaviour in different module that uses the module. While the module itself only has 1 of the 2 possible return types implemented.

I made a very simple example repo where to reproduce you just have to call compile on it with elixir 1.18

https://github.com/nulian/simpel_case

    warning: the following clause will never match:

        :ok

    because it attempts to match on the result of:

        do_process_event(name, state)

    which has type:

        dynamic({:ok, term()})

    typing violation found at:
    │
 18 │           :ok ->
    │           ~~~~~~
    │
    └─ lib/simpel_case.ex:18: SimpelCase.Logger.process_event/2

Expected behavior

I expect to be no compile warning or an ability to be able to disable the incorrect typing violation.

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