Skip to content

Infinite loop when printing error message with recursive type. #6863

Closed
@cristianoc

Description

@cristianoc
./bsc -uncurried test.res
// test.res
type rec tt = [
  | #List(list<tt>)
]
type sexp = tt

/* {2 Serialization (encoding)} */


let rec expr_starting_with = (c, k, t) =>
  switch c {
  | '(' => expr_list(list{}, k, t)
  | c => atom(k, t)
  }

/* parse list */
and expr_list = (acc, k, t) => {
  switch assert(false) {
  | ')' => k(None, #List(acc))
  | c =>
    expr_starting_with(
      c,
      (last, e) =>
        switch last {
        | _ => expr_list(list{e, ...acc}, k, t)
        },
      t,
    )
  }
}
/* parse atom */
and atom = (k, t) => {
  let _ = atom(k)
  assert(false)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions