roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
3.86k stars 284 forks source link

Compiler bug: "Ambient functions don't unify" #6824

Open raymyers opened 1 week ago

raymyers commented 1 week ago

Hey all, super excited for the project. Stumbled across this bug looks unreported, hope this helps.

Version

roc_nightly-macos_apple_silicon-2024-06-18-41ea2bfbc7d

Minimal Reproduction

app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br" }

import pf.Stdout
import pf.Task

main =
    result : EvalResult # Removing this line works
    result = {v : 10}
    dbg {result} # Removing this line also works
    Stdout.line! "V $(Num.toStr result.v)"

EvalResult : { v : Num I32}

Error and Stacktrace

RUST_BACKTRACE=full roc dev

An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: https://github.com/roc-lang/roc/issues/new/choose
thread '<unnamed>' panicked at /Users/m1ci/actions-runner2/_work/roc/roc/crates/compiler/unify/src/unify.rs:201:18:
ambient functions don't unify
stack backtrace:
   0:        0x100e1fa04 - __mh_execute_header
   1:        0x10025894c - __mh_execute_header
   2:        0x100e1b9e8 - __mh_execute_header
   3:        0x100e1f7fc - __mh_execute_header
   4:        0x100e20f18 - __mh_execute_header
   5:        0x100e20c14 - __mh_execute_header
   6:        0x100e2151c - __mh_execute_header
   7:        0x100e212f8 - __mh_execute_header
   8:        0x100e1fe9c - __mh_execute_header
   9:        0x100e2108c - __mh_execute_header
  10:        0x1024fcc9c - __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm
  11:        0x10252d938 - __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm
  12:        0x100817724 - __mh_execute_header
  13:        0x10083f698 - __mh_execute_header
  14:        0x100a12778 - __mh_execute_header
  15:        0x100a0ddc8 - __mh_execute_header
  16:        0x100a0c000 - __mh_execute_header
  17:        0x10094671c - __mh_execute_header
  18:        0x1008cbdc0 - __mh_execute_header
  19:        0x1008b7fbc - __mh_execute_header
  20:        0x1008cd3f0 - __mh_execute_header
  21:        0x100e264e0 - __mh_execute_header
  22:        0x1987a2f94 - __pthread_joiner_wake