msz/hammox

`CaseClauseError` when Displaying Complex Types

cianyleow opened this issue · 0 comments

Ran into the following bug when a "complex" (see below) type was being rendered in Hammox.

The "complex" type in question is a parameter defined type:

@type car(wheel_type) :: %{
  # ...
  :wheels => [
    wheel_type,
    ...
  ],
  # ...
}

This resulted in the following error in Hammox:

** (CaseClauseError) no case clause matching: ["foo() ::\n  Garage.car(\n    Wheels.chrome_rims()\n  )"

Which occurred with the following stack trace:

(hammox 0.5.0) lib/hammox/type_match_error.ex:157: Hammox.TypeMatchError.type_to_string/1
(hammox 0.5.0) lib/hammox/type_match_error.ex:20: Hammox.TypeMatchError.human_reason/1
(hammox 0.5.0) lib/hammox/type_match_error.ex:123: anonymous fn/1 in Hammox.TypeMatchError.message_string/1
(elixir 1.13.1) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
(hammox 0.5.0) lib/hammox/type_match_error.ex:121: Hammox.TypeMatchError.message_string/1
(hammox 0.5.0) lib/hammox/type_match_error.ex:13: Hammox.TypeMatchError.exception/1
(hammox 0.5.0) lib/hammox.ex:355: Hammox.check_call/3
(hammox 0.5.0) lib/hammox.ex:338: Hammox.protected_code/3