Skip to content

Commit ab9450d

Browse files
committed
Don't print the underlying type for @opaque
Closes #2612
1 parent a4a23b9 commit ab9450d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/iex/lib/iex/introspection.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,12 @@ defmodule IEx.Introspection do
311311
Enum.map(specs, &{tag, &1})
312312
end
313313

314+
defp print_type({:opaque, type}) do
315+
{:::, _, [ast, _]} = Kernel.Typespec.type_to_ast(type)
316+
IO.puts IEx.color(:eval_info, "@opaque #{Macro.to_string(ast)}")
317+
true
318+
end
319+
314320
defp print_type({kind, type}) do
315321
ast = Kernel.Typespec.type_to_ast(type)
316322
IO.puts IEx.color(:eval_info, "@#{kind} #{Macro.to_string(ast)}")

lib/iex/test/iex/helpers_test.exs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ defmodule IEx.HelpersTest do
6060
assert "@type t() :: " <> _
6161
= capture_io(fn -> t Enum.t end)
6262
assert capture_io(fn -> t Enum.t end) == capture_io(fn -> t Enum.t/0 end)
63+
64+
assert "@opaque t()\n" = capture_io(fn -> t Regex.t end)
65+
assert capture_io(fn -> t Regex.t end) == capture_io(fn -> t Regex.t/0 end)
6366
end
6467

6568
test "s helper" do

0 commit comments

Comments
 (0)