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

maybe block does not work in macro argument #8268

Closed
UlfNorell opened this issue Mar 15, 2024 · 1 comment · Fixed by #8270
Closed

maybe block does not work in macro argument #8268

UlfNorell opened this issue Mar 15, 2024 · 1 comment · Fixed by #8270
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@UlfNorell
Copy link

Describe the bug
Compilation fails with an "argument mismatch error" when using a maybe block in a macro call.

To Reproduce

-feature(maybe_expr, enable).

%% The particular macro definition is not important
-define(LOG(Tag, Code),
        begin
          logger:info("~s", [Tag]),
          Code
        end).

more_work() -> ok.
some_work() -> ok.

%% Fails with
%%   argument mismatch for macro 'LOG'
work() ->
  ?LOG("work",
       begin
         maybe
           ok ?= some_work()  %% The ?= match doesn't matter
         end,
         more_work()
       end).

Expected behavior
Successful compilation

Affected versions
OTP-25.3.2.8, OTP-26.2.3, OTP-27.0-rc1

@UlfNorell UlfNorell added the bug Issue is reported as a bug label Mar 15, 2024
@bjorng bjorng self-assigned this Mar 15, 2024
@bjorng bjorng added the team:VM Assigned to OTP team VM label Mar 15, 2024
@bjorng bjorng linked a pull request Mar 15, 2024 that will close this issue
@bjorng
Copy link
Contributor

bjorng commented Mar 15, 2024

Thanks! The linked pull requests resolves the issue.

@bjorng bjorng closed this as completed in d988c31 Mar 18, 2024
bjorng added a commit that referenced this issue Mar 18, 2024
* bjorn/stdlib/maybe-macro/GH-8268/OTP-19031:
  epp: Fix use of `maybe` in macro argument
rickard-green pushed a commit that referenced this issue Apr 12, 2024
* bjorn/stdlib/maybe-macro/GH-8268/OTP-19031:
  epp: Fix use of `maybe` in macro argument

# Conflicts:
#	lib/stdlib/test/epp_SUITE.erl
rickard-green pushed a commit that referenced this issue Apr 12, 2024
* bjorn/stdlib/maybe-macro/GH-8268/OTP-19031:
  epp: Fix use of `maybe` in macro argument
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