Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Compiler crash on `distinct` types in `union` variants (Parapoly)

Open ap29600 opened this issue 3 years ago • 1 comments

Context

    Odin: dev-2022-01:b02f2953
    OS:   Arch Linux, Linux 5.15.12-arch1-1
    CPU:  AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx
    RAM:  7652 MiB

Expected Behavior

b is assigned a variable of type A

Current Behavior

the compiler crashes during type checking.

Failure Information (for bugs)

the compiler outputs the following error message and exits with error code 132

bug.main
lb_emit_conv: src -> dst
Not Identical []int != C
Not Identical []int != union {A, B}
Not Identical 7f00b0036c60 != 7f00b0038920
Not Identical 7f00b0036c60 != 7f00b00389a0
src/llvm_backend_expr.cpp(2113): Panic: Invalid type conversion: '[]int' to 'C' for procedure 'bug.main'

Steps to Reproduce

compile the following code

package bug

import "core:fmt"
import "core:slice"

A :: distinct []int
B :: distinct []int

C :: union { A, B } 


main :: proc() {
  
  a: C = A{}

  switch a in a {
    case A:
    b := A(slice.clone(([]int)(a)))
    case B:
    case:
  }
}

ap29600 avatar Jan 07 '22 22:01 ap29600

Hello!

I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue

  • open a PR referencing and resolving the issue;
  • leave a comment on it and discuss ideas how you could contribute towards resolving it;
  • leave a comment and describe in detail why this issue is critical for your use case;
  • open a new issue with updated details and a plan on resolving the issue.

The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..

github-actions[bot] avatar Jul 24 '22 22:07 github-actions[bot]