hugopl/gi-crystal

Error: undefined local variable or method 'start' for Generator::ModuleGen

phil294 opened this issue · 2 comments

Hi!

echo 'name: testi
version: 0.0.1
dependencies:
  gtk4:
    github: hugopl/gtk4.cr' > shard.yml
shards install --error-trace

->

Resolving dependencies
Fetching https://github.com/hugopl/gtk4.cr.git
Fetching https://github.com/hugopl/gi-crystal.git
Fetching https://github.com/hugopl/version_from_shard.git
Installing version_from_shard (1.2.5)
Installing gi-crystal (0.14.0)
Postinstall of gi-crystal: shards build
Failed postinstall of gi-crystal on shards build:
Resolving dependencies
Fetching https://github.com/hugopl/version_from_shard.git
Using version_from_shard (1.2.5)
Writing shard.lock
Building: gi-crystal
Error target gi-crystal failed to compile:
Showing last frame. Use --error-trace for full trace.

There was a problem expanding macro 'macro_139794426358304'

Code in macro 'embed'

 1 | {{ run("ecr/process", "ecr/module.ecr", "io") }}
     ^
Called macro defined in macro 'embed'

 1 | {{ run("ecr/process", "ecr/module.ecr", "io") }}

Which expanded to:

 > 1 | self  # => "\n" + "require \"../"
 > 2 | start # => 1
       ^----
Error: undefined local variable or method 'start' for Generator::ModuleGen

Honestly I have no idea what is going on all of a sudden, it used to be fine before. It doesn't seem you changed anything, and it's broken with previous commits too.

I also got this error

Error target gi-crystal failed to compile:
Showing last frame. Use --error-trace for full trace.

There was a problem expanding macro 'declare'

Code in src/generator/main.cr:10:1

 10 | VersionFromShard.declare
      ^
Called macro defined in lib/version_from_shard/src/version_from_shard.cr:2:3

 2 | macro declare(dir = "")

Which expanded to:

 > 1 | self  # => "0.4.1-54-ga5ade1f"
       ^---
Error: there's no self in this scope

but when I tried to narrow it down on a reproduction case, I got the first one... it somehow suddenly stopped working without me upgrading anything (also not Crystal itself). Do you have any idea what's going on? Other dependencies install fine, so I assume it's somehow related to this one.

I have no idea, what's the output of crystal env?

CRYSTAL_CACHE_DIR=/home/phi/.cache/crystal
CRYSTAL_PATH=lib:/usr/lib/crystal
CRYSTAL_VERSION=1.7.2
CRYSTAL_LIBRARY_PATH=/usr/bin/../lib/crystal
CRYSTAL_OPTS=''

manjaro xfce linux 5.4

I just reinstalled Crystal and now the error is gone! I really have no idea what's going on. I would blame some kind of local system error on this and just pretend this never happened? Thus I'll just close just because now I can't even reproduce...

Thank you for your time.