Skip to content

Defining @Tributes starting with uppercase crashes compilation #9084

@fenollp

Description

@fenollp

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.8.2 (compiled with Erlang/OTP 21)
  • Operating system:
Darwin baobao 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64 i386 MacBookPro14,1 Darwin

Current behavior

defmodule M do
  @Bla 42

  def bla, do: @Bla
end
== Compilation error in file lib/m.ex ==
** (SyntaxError) lib/m.ex:2: syntax error before: "42"
    (elixir) lib/kernel/parallel_compiler.ex:208: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

Expected behaviour

Either

  1. handle module attributes that have the first grapheme of their name capitalized (if they are atoms underneath, quote them?) Both compiler & formatter are affected.
  2. report the error with a more specific message along the lines of Module attributes cannot be capitalized. See @Bla in lib/m.ex:2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions