straight-shoota / crinja

Implementation of Jinja2 template language in Crystal
https://straight-shoota.github.io/crinja/
Other
127 stars 12 forks source link

Problem in expanding macro in crystal v- 0.36.1 #40

Closed ujjwalguptaofficial closed 3 years ago

ujjwalguptaofficial commented 3 years ago
In /home/warrior/projects/opensource/shivneri/src/providers/index.cr:2:1

 2 | require "./crinja_view_engine"
     ^
Error: while requiring "./crinja_view_engine"

In /home/warrior/projects/opensource/shivneri/src/providers/crinja_view_engine.cr:1:1

 1 | require "crinja"
     ^
Error: while requiring "crinja"

In lib/crinja/src/crinja.cr:61:1

 61 | require "./lib/tag"
      ^
Error: while requiring "./lib/tag"

In lib/crinja/src/lib/tag.cr:150:1

 150 | require "./tag/*"
       ^
Error: while requiring "./tag/*"

In lib/crinja/src/lib/tag/for.cr:129:1

 129 | require "../util/for_loop"
       ^
Error: while requiring "../util/for_loop"

In lib/crinja/src/lib/util/for_loop.cr:1:1

 1 | require "../function"
     ^
Error: while requiring "../function"

In lib/crinja/src/lib/function.cr:18:1

 18 | require "./function/*"
      ^
Error: while requiring "./function/*"

In lib/crinja/src/lib/function/joiner.cr:1:8

 1 | Crinja.function({sep: ", "}, :joiner) do
            ^-------
Error: expanding macro

In lib/crinja/src/lib/function/joiner.cr:1:1

 1 | Crinja.function({sep: ", "}, :joiner) do
     ^
Error: expanding macro

There was a problem expanding macro 'function'

Called macro defined in lib/crinja/src/runtime/callable.cr:89:3

 89 | macro function(defaults = nil, name = nil, &block)

Which expanded to:

 >  1 |     Crinja.callable(Crinja::Function, {sep: ", "}, :joiner) do
 >  2 |       called = false
 >  3 | sep = arguments["sep"]
 >  4 | ->(_args : Crinja::Arguments) do
 >  5 |   if called
 >  6 |     sep
 >  7 |   else
 >  8 |     called = true
 >  9 |     Crinja::Value.new("")
 > 10 |   end
 > 11 | end
 > 12 | 
 > 13 |     end
 > 14 |   
Error: expanding macro

In lib/crinja/src/lib/function/joiner.cr:3:18

 3 | sep = arguments["sep"]
                    ^
Error: instantiating 'Crinja::Arguments#[](String)'

In lib/crinja/src/arguments.cr:30:28

 30 | elsif index = defaults.key_index(name)
                             ^--------
Error: undefined method 'key_index' for Hash(String, Crinja::Value)

Did you mean 'get_index'?
straight-shoota commented 3 years ago

Compatibility with Crystal 0.36.0 only existed in master, but I've just released https://github.com/straight-shoota/crinja/releases/tag/v0.7.0 Please update your dependency and it should work.

ujjwalguptaofficial commented 3 years ago

fixed @straight-shoota . Thanks :).