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

ERL-228: Defining type as a tuple containing a fun() followed by expression throws Emacs error #3129

Closed
OTP-Maintainer opened this issue Aug 24, 2016 · 2 comments
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community priority:low team:PS Assigned to OTP team PS

Comments

@OTP-Maintainer
Copy link

Original reporter: fenollp
Affected version: OTP-19.0.2
Component: tools
Migrated from: https://bugs.erlang.org/browse/ERL-228


Example code (erlang-indent-current-buffer):

{code:erlang}
-type b() :: {fun()}.
a(V) ->
    V.
{code}

{code:erlang}
-module(amqp_leader_proc).

-type routine() :: {fun((any()) -> any()), any()}.
-type routines() :: [].
{code}

Emacs error thrown:
Unbalanced parenthesis

Note: if no expression follows the first type definition no error is thrown.
Note: once the error is thrown indentation halts thus the rest of the file is not checked.

Minified test cases: https://github.com/fenollp/erlang-formatter/pull/8/files
Formatting code used: https://github.com/fenollp/erlang-formatter/blob/issue4/fmt.el

@OTP-Maintainer
Copy link
Author

mc_ said:

Looking at the (car (car stack)) in a sample I have, the value is 'fun. Adding before the (t (error "Unbalanced parenthesis")):

((eq (car (car stack)) 'fun)
(erlang-pop stack)
)
(t
(error "Unbalanced parenthesis"))


Resolved the parsing issue and the region was properly indented.

I haven't made the change outside of my local setup to see if it has broader implications; just a "this worked for me" datapoint.

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community team:PS Assigned to OTP team PS priority:low labels Feb 10, 2021
@dgud
Copy link
Contributor

dgud commented Feb 9, 2023

Can not reproduce

@dgud dgud closed this as completed Feb 9, 2023
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 help wanted Issue not worked on by OTP; help wanted from the community priority:low team:PS Assigned to OTP team PS
Projects
None yet
Development

No branches or pull requests

2 participants