We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Happens only when below macro is put inside #initialize method with splatted named arguments.
#initialize
class Foo def initialize(**attributes) {% for var in @type.instance_vars %} if arg = attributes[:{{var.name.id}}]? @{{var.name.id}} = arg end {% end %} end end class Bar < Foo def initialize(**attributes) @bar = true super end end Bar.new
Above code fails with:
Nil assertion failed 0x109ed2983: *raise<String>:NoReturn at ?? 0x109ed7f00: *Nil#not_nil!:NoReturn at ?? 0x10b459214: *Crystal::MainVisitor#bind_initialize_instance_vars<Crystal::Type+>:Nil at ?? 0x10b4604fe: *Crystal::Call#lookup_matches_in_type<Crystal::Type+, Array(Crystal::Type+), (Array(Crystal::NamedArgumentType) | Nil), Crystal::Type+, String, Bool>:Array(Crystal::Def+) at ?? 0x10b31417c: *Crystal::Call#lookup_matches_without_splat<Array(Crystal::Type+), (Array(Crystal::NamedArgumentType) | Nil)>:Array(Crystal::Def+) at ?? 0x10a090c7a: *Crystal::Call#recalculate:Nil at ?? 0x10a80d0e0: *Crystal::MainVisitor#visit<Crystal::Call>:Bool at ?? 0x10a5ecd8a: *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil at ?? 0x10a5ebcf7: *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil at ?? 0x10a5ebcf7: *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil at ?? 0x10b45590e: *Crystal::Call#instantiate<Crystal::Matches, Crystal::Type+, Nil, (Array(Crystal::NamedArgumentType) | Nil)>:Array(Crystal::Def+) at ?? 0x10b44d44d: *Crystal::Call#lookup_matches_in_type<Crystal::Type+, Array(Crystal::Type+), (Array(Crystal::NamedArgumentType) | Nil), Nil, String, Bool>:Array(Crystal::Def+) at ?? 0x10a090c7a: *Crystal::Call#recalculate:Nil at ?? 0x10a80d0e0: *Crystal::MainVisitor#visit<Crystal::Call>:Bool at ?? 0x10a5ecd8a: *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil at ?? 0x10a5ebcf7: *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil at ?? 0x10b45590e: *Crystal::Call#instantiate<Crystal::Matches, Crystal::Type+, Nil, (Array(Crystal::NamedArgumentType) | Nil)>:Array(Crystal::Def+) at ?? 0x10b44d44d: *Crystal::Call#lookup_matches_in_type<Crystal::Type+, Array(Crystal::Type+), (Array(Crystal::NamedArgumentType) | Nil), Nil, String, Bool>:Array(Crystal::Def+) at ?? 0x10a090c7a: *Crystal::Call#recalculate:Nil at ?? 0x10a80d0e0: *Crystal::MainVisitor#visit<Crystal::Call>:Bool at ?? 0x10a5ecd8a: *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil at ?? 0x10a5ebcf7: *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil at ?? 0x10ab8cb09: *Crystal::Program#visit_main<Crystal::ASTNode+, Crystal::MainVisitor, Bool, Bool>:Crystal::ASTNode+ at ?? 0x10a9cf4c5: *Crystal::Program#semantic<Crystal::ASTNode+, Bool, Bool>:Crystal::ASTNode+ at ?? 0x10b51a5aa: *Crystal::Command#run_command<Bool>:Nil at ?? 0x109f2c493: *Crystal::Command#run:(Bool | Crystal::Compiler::Result | IO::FileDescriptor | Nil) at ?? 0x109ef9077: main at ??
The text was updated successfully, but these errors were encountered:
d94bb7e
No branches or pull requests
Happens only when below macro is put inside
#initialize
method with splatted named arguments.Above code fails with:
The text was updated successfully, but these errors were encountered: