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

Support recursive modules #160

Closed
aspeddro opened this issue Nov 13, 2022 · 0 comments · Fixed by #161
Closed

Support recursive modules #160

aspeddro opened this issue Nov 13, 2022 · 0 comments · Fixed by #161

Comments

@aspeddro
Copy link
Collaborator

module rec A: X = {
  let x = () => 1
  let y = () => B.y() + 1
}
and B: X = {
  let x = () => A.x() + 2
  let y = () => 2
}
(source_file [0, 0] - [8, 0]
  (ERROR [0, 0] - [4, 10]
    (module_declaration [0, 0] - [3, 1]
      name: (module_identifier [0, 11] - [0, 12])
      signature: (module_identifier [0, 14] - [0, 15])
      definition: (block [0, 18] - [3, 1]
        (let_binding [1, 2] - [1, 17]
          (value_identifier [1, 6] - [1, 7])
          (function [1, 10] - [1, 17]
            parameters: (formal_parameters [1, 10] - [1, 12])
            body: (number [1, 16] - [1, 17])))
        (let_binding [2, 2] - [2, 25]
          (value_identifier [2, 6] - [2, 7])
          (function [2, 10] - [2, 25]
            parameters: (formal_parameters [2, 10] - [2, 12])
            body: (binary_expression [2, 16] - [2, 25]
              left: (call_expression [2, 16] - [2, 21]
                function: (value_identifier_path [2, 16] - [2, 19]
                  (module_identifier [2, 16] - [2, 17])
                  (value_identifier [2, 18] - [2, 19]))
                arguments: (arguments [2, 19] - [2, 21]))
              right: (number [2, 24] - [2, 25])))))))
  (expression_statement [4, 11] - [7, 1]
    (block [4, 11] - [7, 1]
      (let_binding [5, 2] - [5, 25]
        (value_identifier [5, 6] - [5, 7])
        (function [5, 10] - [5, 25]
          parameters: (formal_parameters [5, 10] - [5, 12])
          body: (binary_expression [5, 16] - [5, 25]
            left: (call_expression [5, 16] - [5, 21]
              function: (value_identifier_path [5, 16] - [5, 19]
                (module_identifier [5, 16] - [5, 17])
                (value_identifier [5, 18] - [5, 19]))
              arguments: (arguments [5, 19] - [5, 21]))
            right: (number [5, 24] - [5, 25]))))
      (let_binding [6, 2] - [6, 17]
        (value_identifier [6, 6] - [6, 7])
        (function [6, 10] - [6, 17]
          parameters: (formal_parameters [6, 10] - [6, 12])
          body: (number [6, 16] - [6, 17]))))))

Playground Example

aspeddro added a commit to aspeddro/tree-sitter-rescript that referenced this issue Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant