自定义属性在 Erlang 模块中的位置有什么要求?

What are the requirements for position of custom attributes in an Erlang module?

好像是:

Shell 会话演示:

~ cat sample.erl
-my_attr(my_value).
-module(sample).
-compile([export_all, nowarn_export_all]).

main(_) ->
    ok.

~ erlc sample.erl
sample.erl:1:2: no module definition
%    1| -my_attr(my_value).
%     |  ^

~ dialyzer sample.erl
  Checking whether the PLT /Users/mheiber/Library/Caches/erlang/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
dialyzer: Analysis failed with error:
Could not scan the following file(s):
/Users/mheiber/sample.erl:1:2: no module definition

Last messages in the log cache:
  Reading files and computing callgraph...

是否在任何地方记录了用户定义属性的顺序合同?或者这是一个错误?

我在文档中只能找到预定义的属性必须在函数声明之前:

https://www.erlang.org/doc/reference_manual/modules.html#pre-defined-module-attributes

-module(Module).

Module declaration, defining the name of the module. The name Module, an atom, is to be same as the file name minus the extension .erl. Otherwise code loading does not work as intended.

This attribute is to be specified first and is the only mandatory attribute.