crystal icon indicating copy to clipboard operation
crystal copied to clipboard

Interpreter: Error: BUG: missing upcast_distinct from A+ to B (Crystal::VirtualType to Crystal::NonGenericClassType)

Open cyangle opened this issue 3 years ago • 1 comments

Bug Report

Below code works fine in compiled mode but fails with interpreter.

abstract class A
end

class B < A
end

def validate(b : B)
  puts b
end

b = B.new.as(A)
puts b.is_a?(B)

validate(b)

Error from interpreter:

In bin/bugs/virtual.cr:14:10

 14 | validate(b)
               ^
Error: BUG: missing upcast_distinct from A+ to B (Crystal::VirtualType to Crystal::NonGenericClassType)

Crystal version:

Crystal 1.6.0-dev [474129b54] (2022-08-02)

LLVM: 14.0.6
Default target: x86_64-pc-linux-gnu

OS: Ubuntu 22.04

cyangle avatar Aug 03 '22 00:08 cyangle

This bug might be related to #12350

cyangle avatar Aug 05 '22 19:08 cyangle