Skip to content

Commit af95958

Browse files
committed
Decapitalize Erlang-style named variables in type specifications' annotations when converting to AST
1 parent 46b7317 commit af95958

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/elixir/lib/kernel/typespec.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,13 @@ defmodule Kernel.Typespec do
463463
end
464464

465465
defp typespec_to_ast({ :var, line, var }) do
466+
var =
467+
case atom_to_binary(var) do
468+
<<"_", c :: [binary, size(1)], rest :: binary>> ->
469+
binary_to_atom("_#{String.downcase(c)}#{rest}")
470+
<<c :: [binary, size(1)], rest :: binary>> ->
471+
binary_to_atom("#{String.downcase(c)}#{rest}")
472+
end
466473
{ var, line, nil }
467474
end
468475

0 commit comments

Comments
 (0)