unison/unison-src/transcripts/universal-cmp.output.md
Dan Doel c735ef216b Fix universal eq/compare for links
It seems that optimizations cause problems together with the combination
of coercing and unsafe IO involved in reference equality. I'm not
exactly sure what goes wrong, but it causes segfaults. Defining a
noinline function for the equalities (instead of just `(==)@Reference`)
seems to fix the problem.

I got the same problem to happen for term links, so both of those use a
noinline function now. Other foreign values don't seem to be affected,
which I assume is due to them having pure primitive functions for
equality.
2022-01-13 14:06:17 -05:00

1.2 KiB

File for test cases making sure that universal equality/comparison cases exist for built-in types. Just making sure they don't crash.

unique type A = A

threadEyeDeez _ =
  t1 = forkComp '()
  t2 = forkComp '()
  t1 == t2 
  t1 < t2
  ()

  I found and typechecked these definitions in scratch.u. If you
  do an `add` or `update`, here's how your codebase would
  change:
  
    ⍟ These new definitions are ok to `add`:
    
      unique type A
      threadEyeDeez : ∀ _. _ ->{IO} ()

.> add

  ⍟ I've added these definitions:
  
    unique type A
    threadEyeDeez : ∀ _. _ ->{IO} ()

.> run threadEyeDeez

> typeLink A == typeLink A
> typeLink Text == typeLink Text
> typeLink Text == typeLink A
> termLink threadEyeDeez == termLink threadEyeDeez

  ✅
  
  scratch.u changed.
  
  Now evaluating any watch expressions (lines starting with
  `>`)... Ctrl+C cancels.

    1 | > typeLink A == typeLink A
          ⧩
          true
  
    2 | > typeLink Text == typeLink Text
          ⧩
          true
  
    3 | > typeLink Text == typeLink A
          ⧩
          false
  
    4 | > termLink threadEyeDeez == termLink threadEyeDeez
          ⧩
          true