crystal-lang / crystal

The Crystal Programming Language

Home Page:https://crystal-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

crystal compiler bug

stakach opened this issue · comments

I'll continue to investigate but currently I have the following issue:

BUG: called type_id for Hash(String, JSON::Any)+.class (Crystal::VirtualMetaclassType) (Exception)
  from /crystal/src/string.cr:5672 in 'type_id'
  from /crystal/src/compiler/crystal/codegen/type_id.cr:9:5 in 'type_id'
  from /crystal/src/compiler/crystal/codegen/primitives.cr:67:15 in 'visit'
  from /crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
  from /crystal/src/compiler/crystal/codegen/codegen.cr:2409:7 in 'visit'
#...
  from /crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
  from /crystal/src/compiler/crystal/codegen/codegen.cr:2392:9 in 'codegen_assign'
  from /crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
  from /crystal/src/enumerable.cr:510:7 in '??'
  from /crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
  from /crystal/src/compiler/crystal/codegen/codegen.cr:2362:7 in 'codegen'
  from /crystal/src/compiler/crystal/compiler.cr:202:16 in 'compile:combine_rpath'
  from /crystal/src/compiler/crystal/command.cr:358:5 in 'run'
  from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
  from /crystal/src/crystal/main.cr:129:5 in 'main'
  from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'
Error: you've found a bug in the Crystal compiler.

to reproduce (tested on 1.11.2 and 1.12.0)

git clone -b crystal-compiler-bug https://github.com/PlaceOS/rest-api.git
shards install
crystal build ./src/app.cr

I've created that branch so this continues to be reproducible

possibly related to #11668

resolved it by not inheriting generics
place-labs/redis_service_manager@0fa47ef

i.e. was doing:

class MyKlass < Hash(String, String)
  # ...
end

maybe that should be considered a syntax error?
Feel free to close unless you want the issue for tracking

related to #2665
will close as a duplicate