rescript-lang / tree-sitter-rescript

ReScript parser for Tree-Sitter
MIT License
50 stars 15 forks source link

Module unpack fails #251

Open CarlOlson opened 4 months ago

CarlOlson commented 4 months ago
module type T = {
  type t
}

module T = {
  type t
}

let make = (): module(T) => module(T)

module T2 = unpack(make(): T)

Playground

(source_file [0, 0] - [11, 0]
  (module_declaration [0, 0] - [2, 1]
    (module_binding [0, 12] - [2, 1]
      name: (module_identifier [0, 12] - [0, 13])
      definition: (block [0, 16] - [2, 1]
        (type_declaration [1, 2] - [1, 8]
          (type_binding [1, 7] - [1, 8]
            name: (type_identifier [1, 7] - [1, 8]))))))
  (module_declaration [4, 0] - [6, 1]
    (module_binding [4, 7] - [6, 1]
      name: (module_identifier [4, 7] - [4, 8])
      definition: (block [4, 11] - [6, 1]
        (type_declaration [5, 2] - [5, 8]
          (type_binding [5, 7] - [5, 8]
            name: (type_identifier [5, 7] - [5, 8]))))))
  (let_declaration [8, 0] - [8, 37]
    (let_binding [8, 4] - [8, 37]
      pattern: (value_identifier [8, 4] - [8, 8])
      body: (function [8, 11] - [8, 37]
        parameters: (formal_parameters [8, 11] - [8, 13])
        return_type: (type_annotation [8, 13] - [8, 24]
          (module_pack [8, 15] - [8, 24]
            (module_identifier [8, 22] - [8, 23])))
        body: (module_pack [8, 28] - [8, 37]
          (module_identifier [8, 35] - [8, 36])))))
  (module_declaration [10, 0] - [10, 29]
    (module_binding [10, 7] - [10, 29]
      name: (module_identifier [10, 7] - [10, 9])
      definition: (module_unpack [10, 12] - [10, 29]
        (call_expression [10, 19] - [10, 25]
          function: (value_identifier [10, 19] - [10, 23])
          arguments: (arguments [10, 23] - [10, 25]))
        (ERROR [10, 25] - [10, 28])))))
Test.res           0.31 ms         401 bytes/ms (ERROR [10, 25] - [10, 28])