From 395c9b93e7a084615ac76e64ca86b1d914bde604 Mon Sep 17 00:00:00 2001 From: Jakub Melkowski <9402720+Blatts12@users.noreply.github.com> Date: Tue, 10 Oct 2023 08:24:32 +0200 Subject: [PATCH] Fix type formatting for bitstrings --- lib/contexted/module_analyzer.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/contexted/module_analyzer.ex b/lib/contexted/module_analyzer.ex index 1e7e60b..81ae3f9 100644 --- a/lib/contexted/module_analyzer.ex +++ b/lib/contexted/module_analyzer.ex @@ -118,6 +118,12 @@ defmodule Contexted.ModuleAnalyzer do defp format_type({:type, _, :range, [{:integer, _, from}, {:integer, _, to}]}, _module), do: "#{from}..#{to}" + defp format_type({:type, _, :binary, [{:integer, _, size}, {:integer, _, 0}]}, _module), + do: "<<_::#{size}>>" + + defp format_type({:type, _, :binary, [{:integer, _, size}, {:integer, _, unit}]}, _module), + do: "<<_::#{size}, _::_*#{unit}>>" + defp format_type({:type, _, type_name, _}, _module), do: "#{type_name}()" defp format_type({:integer, _, integer}, _module), do: "#{integer}"