Closed petr-fischer closed 3 years ago
Compiler error when requiring "crinja":
1 | require "crinja" ^ Error: while requiring "crinja" In lib/crinja/src/crinja.cr:63:1 63 | require "./lib/filter" ^ Error: while requiring "./lib/filter" In lib/crinja/src/lib/filter.cr:68:1 68 | require "./filter/*" ^ Error: while requiring "./filter/*" In lib/crinja/src/lib/filter/collections.cr:2:10 2 | Crinja.filter :list do ^----- Error: expanding macro In lib/crinja/src/lib/filter/collections.cr:2:3 2 | Crinja.filter :list do ^ Error: expanding macro There was a problem expanding macro 'filter' Called macro defined in lib/crinja/src/runtime/callable.cr:69:3 69 | macro filter(defaults = nil, name = nil, &block) Which expanded to: > 1 | Crinja.callable(Crinja::Filter, :list, nil) do > 2 | target = arguments.target! > 3 | > 4 | begin value = target.raw > 5 | case value > 6 | when String > 7 | value.chars > 8 | when Array > 9 | value > 10 | when .responds_to?(:to_a) > 11 | target.to_a > 12 | else > 13 | raise(TypeError.new("target for list filter cannot be converted to list")) > 14 | end > 15 | end > 16 | end > 17 | Error: expanding macro In lib/crinja/src/lib/filter/collections.cr:11:14 11 | target.to_a ^--- Error: instantiating 'Crinja::Value#to_a()' In lib/crinja/src/runtime/value.cr:399:5 399 | each do |item| ^--- Error: instantiating 'each()' In lib/crinja/src/runtime/value.cr:255:5 255 | raw_each do |raw| ^------- Error: instantiating 'raw_each()' In lib/crinja/src/runtime/value.cr:239:14 239 | object.each { |value| yield value.as(Value).raw } ^--- Error: instantiating '(Array(Crinja::Value) | Crinja::Function::Cycler | Crinja::Tuple | Iterator(Crinja::Value))#each()' In /usr/share/crystal/src/iterator.cr:597:7 597 | yield value ^ Error: argument #1 of yield expected to be Crinja::Value, not (Array(Crinja::Value) | Bool | Crinja::Callable | Crinja::Object | Crinja::SafeString | Crinja::Undefined | Float64 | Hash(Crinja::Value, Crinja::Value) | Int32 | Int64 | Iterator(Crinja::Value) | Proc(Crinja::Arguments, Crinja::Value) | String | Time | Nil)
Which version of crinja are you using? This should work in master.
I am using only released (tagged) versions - error above is from version 0.7, but everything is OK with fresh 0.8 version. Thanks! Closing...
Compiler error when requiring "crinja":