unison/unison-src/transcripts/fix2355.output.md
Dan Doel 34877da01c Don't relax type when doing an instantiateL during subtyping
This is the case of `a < T` for some structured T. By relaxing, we are
actually allowing `a` to be a _supertype_ of T as far as abilities go,
which is not correct. Seems like it was just erroneously mirrored from
the opposite case.
2024-06-25 15:54:10 -04:00

742 B
Raw Blame History

Tests for a loop that was previously occurring in the type checker.

structural ability A t g where 
  fork : '{g, A t g} a -> t a
  await : t a -> a
  empty! : t a
  put : a -> t a -> ()

example : '{A t {}} Nat
example = 'let
  r = A.empty!
  go u = 
    t = A.fork '(go (u + 1))
    A.await t
  
  go 0
  t2 = A.fork '(A.put 10 r)
  A.await r

  Loading changes detected in scratch.u.

  I tried to infer a cyclic ability.
  
  The expression in red was inferred to require the ability: 
  
      {A t25 {𝕖36, 𝕖18}}
  
  where `𝕖18` is its overall abilities.
  
  I need a type signature to help figure this out.
  
     10 |   go u = 
     11 |     t = A.fork '(go (u + 1))
     12 |     A.await t