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

Kind inference crash #5566

Open
pchiusano opened this issue Feb 4, 2025 · 1 comment
Open

Kind inference crash #5566

pchiusano opened this issue Feb 4, 2025 · 1 comment

Comments

@pchiusano
Copy link
Member

To reproduce, clone @pchiusano/arcella/@pchiusano/kind-inference-bug blah, then put the following in a scratch file:

main1 : '{IO, Exception} Text
main1 = Cloud.main do 
  t = Cloud.submit Environment.default() do 
    N = 20000
    t0 = time.monotonic!
    ns = List.range 0 N |> List.map (i -> (tokenize (nat i), i))
    _ = MemTrie.fromList ns
    t1 = time.monotonic! 
    t1 - t0 |> Duration.toText
  t

type TokenTrie a 
  = TokenTrie (Optional a) 
              (TokenTrie a) 
              (TokenTrie a) 
              (Map Bytes (TokenTrie a))  
  | Empty

Save, then do run main1, you'll get:

Encountered exception:
[typeConstraintTree] Ref lookup failure: ReferenceDerived (Id "nk9jfsoidsc5h3nhcf1p6528t6c5hqui3hridbvaqnruel4jns3qo6plgups2sgi82c9jgt9ba1qlkum1bdjdgp75h7si2thbo7tcfg" 0)
CallStack (from HasCallStack):
  error, called at src/Unison/KindInference/Generate.hs:97:22 in unison-parser-typechecker-0.0.0-JliU30UQmMa2dDW5SxUdL:Unison.KindInference.Generate

Tested on mac with version 0.5.32

@pchiusano
Copy link
Member Author

pchiusano commented Feb 4, 2025

FYI, the hash mentioned in the error message is Map from base:

arcella/kind-inference-bug> view #nk9j                 

  type lib.unison_base_3_30_0.data.Map k v
    = internal.Bin
        Nat
        k
        v
        (lib.unison_base_3_30_0.data.Map k v)
        (lib.unison_base_3_30_0.data.Map k v)
    | internal.Tip

Removing the TokenTrie declaration from the file causes it to work. Also doing an update then a run main1 works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant