Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious "module name must not be empty" diagnostics #7655

Closed
alanz opened this issue Sep 15, 2023 · 0 comments · Fixed by #7660
Closed

Spurious "module name must not be empty" diagnostics #7655

alanz opened this issue Sep 15, 2023 · 0 comments · Fixed by #7660
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@alanz
Copy link

alanz commented Sep 15, 2023

Describe the bug

When a file does not have a module declaration, a module name must not be empty diagnostic is generated for each spec in it.

To Reproduce
Steps to reproduce the behavior.

-export([test1/0,test2/0]).
-spec test1() -> ok.
test1() -> ok.

-spec test2() -> ok.
test2() -> ok.

./homebrew/Cellar/erlang/26.0.2/bin/erlc -Wall foo.erl

Result

foo.erl:2:2: no module definition
%    2| -export([test1/0,test2/0]).
%     |  ^

foo.erl:3:2: the module name must not be empty
%    3| -spec test1() -> ok.
%     |  ^

foo.erl:6:2: the module name must not be empty
%    6| -spec test2() -> ok.
%     |  ^

Expected behavior

Only foo.erl:2:2: no module definition reported

Affected versions
I tested with 26.0.2

Additional context
Add any other context about the problem here. If you wish to attach Erlang code you can either write it directly in the post using code tags, create a gist, or attach it as a zip file to this post.

@alanz alanz added the bug Issue is reported as a bug label Sep 15, 2023
@bjorng bjorng added the team:VM Assigned to OTP team VM label Sep 15, 2023
@bjorng bjorng self-assigned this Sep 15, 2023
@bjorng bjorng linked a pull request Sep 18, 2023 that will close this issue
bjorng added a commit that referenced this issue Sep 18, 2023
@bjorng bjorng closed this as completed in 0a3a022 Sep 18, 2023
facebook-github-bot pushed a commit to WhatsApp/erlang-language-platform that referenced this issue Sep 20, 2023
Summary: Port the fix from erlang/otp#7655 to elp_lint.erl

Reviewed By: robertoaloi

Differential Revision: D49367307

fbshipit-source-id: afc2c9911914ebe08c224b5b4a29afa9f92d2e27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants