unisonweb / unison

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

`run` with a return type that's not in the codebase can cause a crash that mentions kind inference #5448

Open aryairani opened 2 weeks ago

aryairani commented 2 weeks ago

Describe and demonstrate the bug Please attach a ucm transcript if possible, calling out the unexpected behavior in the text. e.g.

Input:

``` unison :hide
type NewType = NewType
main = do
  NewType
scratch/main> run main

Output:

Uh oh, an unexpected exception brought the process down! That should never happen. Please file a bug report.

Here's a stringy rendering of the exception:

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



**Screenshots**

**Environment (please complete the following information):**
 - 0.5.27

**Additional context**