scry icon indicating copy to clipboard operation
scry copied to clipboard

`flag?` crashes compiler

Open Proximyst opened this issue 6 years ago • 4 comments

When one hovers over the flag? call in this minimal example, the compiler crashes:

{% if flag?(:x86_64) %}
  puts "x86_64!"
{% end %}

The following is the crash log:

[Error - 13:48:28] A error was found while searching contexts
Unexpected char 'B' at 1:1
BUG: `flag?(:x86_64)` at /hdd0/Work/cr-sizes/spec/cr-sizes_spec.cr:5:11 has no type (Exception)
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
  from ???
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

Although it says it's a bug in the Crystal compiler, I believe this is not the case, and is rather how scry does hovers.

Proximyst avatar Jan 05 '19 12:01 Proximyst

@Proximyst I am trying to recreate, what version of Scry are you using and which IDE?

bmulvihill avatar Jan 06 '19 18:01 bmulvihill

@bmulvihill scry 0.8.0 and code 1.30.1, dea8705087adb1b5e5ae1d9123278e178656186a

Proximyst avatar Jan 08 '19 16:01 Proximyst

@Proximyst under the hood the hover functionality uses crystal tool context. I cloned you're repo and ran crystal tool context -f json -c spec/size_t_spec.cr:5:11 spec/size_t_spec.cr and get the same error.

bmulvihill avatar Jan 17 '19 18:01 bmulvihill

Also to note, when I hover over the flags outside of the spec I do not see the error (in src/size_t.cr).

bmulvihill avatar Jan 17 '19 18:01 bmulvihill