unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

Cannot decompile #3035

Open pchiusano opened 2 years ago

pchiusano commented 2 years ago
pull git@github.com:pchiusano/sketches:#5j1dlsf0qt

And then do display article, which yields

.distributed.p2p.storage> display article

  cannot decompile an application to a local recursive binding

The doc in question has some embedded definitions. I could convert them to use @source instead, so I'm not blocked, but I thought this would make a decent bug report since it would be nice if this worked.

dolio commented 2 years ago

Here's a smaller test case:

doc1 = {{
  @typecheck ```
  oa : Set Text
  oa = Set.fromList ["alice", "bob", "carol"]
  contains "alice" oa
  ```

  @typecheck ```
  recur : [Nat] -> Nat
  recur = cases
    [] -> 0
    [n] -> n
    ns ->
      (l,r) = halve ns
      recur l + recur r
  ```
}}

Has something to do with floating things in the first snippet. Note that switching the order of the snippets avoids the problem.

dolio commented 2 years ago

I think this might no longer be relevant, because there is no more 'local recursive' floating. At least, my 'smallter test case' no longer causes an error.