roc icon indicating copy to clipboard operation
roc copied to clipboard

Compiler error: 'destructures cannot participate in a recursive group; it's always a type error

Open tankorsmash opened this issue 2 years ago • 4 comments

Hey! I'm trying out roc for AOC 2022 and don't know the syntax all that well, so that could be the cause. I'm coming from Elm and assuming most of the syntax carries through.

The 100 lines that crash is here, but I'm not doing any recursion as far as I can tell, so I'm not sure where the error is coming from.

Line 16 used RPS a = ... instead of RPS a : ... when defining a custom type, causing the crash.

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 'destructures cannot participate in a recursive group; it's always a type error', crates/compiler/can/src/def.rs:1635:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

tankorsmash avatar Dec 02 '22 05:12 tankorsmash

I also hit this. The repro is:

# Repro.roc
interface Repro
    exposes []
    imports []

T a b = (a, b)

I'm on roc version

roc nightly pre-release, built from commit ad78e04 on Mi 20 Mär 2024 09:02:16 UTC

I can reproduce with roc check Repro.roc, which hangs the compiler, and with RUST_BACKTRACE=full yields

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 'destructures cannot participate in a recursive group; it's always a type error', crates/compiler/can/src/def.rs:1655:29
stack backtrace:
   0:     0x557003375966 - <unknown>
   1:     0x5570026bf2cf - <unknown>
   2:     0x557003371127 - <unknown>
   3:     0x557003375775 - <unknown>
   4:     0x557003376f13 - <unknown>
   5:     0x557003376cd4 - <unknown>
   6:     0x557003377416 - <unknown>
   7:     0x5570033772f4 - <unknown>
   8:     0x557003375d66 - <unknown>
   9:     0x5570033770a2 - <unknown>
  10:     0x5570025bbe03 - <unknown>
  11:     0x55700296100c - <unknown>
  12:     0x557002dc65b1 - <unknown>
  13:     0x557002d48ed0 - <unknown>
  14:     0x557002d450ee - <unknown>
  15:     0x557002d485b7 - <unknown>
  16:     0x55700337cd25 - <unknown>
  17:     0x7ff1c711c609 - start_thread
                               at /build/glibc-wuryBv/glibc-2.31/nptl/pthread_create.c:477:8
  18:     0x7ff1c6bfe353 - clone
                               at /build/glibc-wuryBv/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  19:                0x0 - <unknown>

nathanielknight avatar Mar 21 '24 06:03 nathanielknight

Let's format this panic more nicely and add a tip to it for starters. The tip should state something like "Tip: did you try to use = instead of : to define a type?".

Anton-4 avatar Mar 22 '24 10:03 Anton-4