Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crystal compiler bug #14476

Closed
stakach opened this issue Apr 11, 2024 · 3 comments
Closed

crystal compiler bug #14476

stakach opened this issue Apr 11, 2024 · 3 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. status:duplicate topic:compiler:codegen

Comments

@stakach
Copy link
Contributor

stakach commented Apr 11, 2024

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

@stakach stakach added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Apr 11, 2024
@stakach
Copy link
Contributor Author

stakach commented Apr 11, 2024

possibly related to #11668

@stakach
Copy link
Contributor Author

stakach commented Apr 11, 2024

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

@stakach
Copy link
Contributor Author

stakach commented Apr 11, 2024

related to #2665
will close as a duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. status:duplicate topic:compiler:codegen
Projects
None yet
Development

No branches or pull requests

3 participants