Compiler bug in expanded macro _spectator_cast_stub_value
I have a very strange problem, unfortunately I haven't been able to narrow it down to a small reproducible example, but maybe someone still can figure out what's going on.
I started with me getting an error: Error: while requiring "./spec/some_spec.cr"
That's it. No more output.
Then I combined all spec files to one file and just tried to build it, then i get this:
BUG: `typeof(previous_def(other))` at expanded macro: _spectator_cast_stub_value:10:30 has no type (Exception)
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'raise<Exception>:NoReturn'
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'raise<String>:NoReturn'
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#type:Crystal::Type+'
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil'
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'Crystal::MainVisitor#visit<Crystal::If>:Bool'
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil'
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'Crystal::MainVisitor#visit<Crystal::Expressions>:Bool'
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::MainVisitor>:Nil'
from /opt/homebrew/Cellar/crystal/1.6.2/libexec/crystal in 'Crystal::MainVisitor@Crystal::SemanticVisitor#expand_macro<Crystal::Call, Bool, Bool, Bool>:Bool'
…
Any clue?
I think it's related to me having a mock with an empty constructor, but the class MyClass has two mandatory arguments in it's constructor
mock MyClass
def initialize
end
end
The error appeared when I added new specs where I instantiate the real class (MyClass).
Sorry for a very vague report, I've tried to reproduce it for hours...
Edited by Jon Börjesson