{"action":"created","issue":{"url":"https://api.github.com/repos/manastech/crystal/issues/1028","labels_url":"https://api.github.com/repos/manastech/crystal/issues/1028/labels{/name}","comments_url":"https://api.github.com/repos/manastech/crystal/issues/1028/comments","events_url":"https://api.github.com/repos/manastech/crystal/issues/1028/events","html_url":"https://github.com/manastech/crystal/issues/1028","id":96750354,"number":1028,"title":"Bug: self.is_a?(Reference) && other.is_a?(Reference) || other.is_a?(Nil) at crystal/src/comparable.cr:23:8 should have been expanded","user":{"login":"MakeNowJust","id":6679325,"avatar_url":"https://avatars.githubusercontent.com/u/6679325?v=3","gravatar_id":"","url":"https://api.github.com/users/MakeNowJust","html_url":"https://github.com/MakeNowJust","followers_url":"https://api.github.com/users/MakeNowJust/followers","following_url":"https://api.github.com/users/MakeNowJust/following{/other_user}","gists_url":"https://api.github.com/users/MakeNowJust/gists{/gist_id}","starred_url":"https://api.github.com/users/MakeNowJust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MakeNowJust/subscriptions","organizations_url":"https://api.github.com/users/MakeNowJust/orgs","repos_url":"https://api.github.com/users/MakeNowJust/repos","events_url":"https://api.github.com/users/MakeNowJust/events{/privacy}","received_events_url":"https://api.github.com/users/MakeNowJust/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/manastech/crystal/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-23T07:26:19Z","updated_at":"2015-07-24T13:38:57Z","closed_at":"2015-07-24T13:38:57Z","body":"I met this error when I run [crustache](https://github.com/MakeNowJust/crustache)'s spec by using HEAD compiler (__it wasn't occurred by 0.7.4 compiler__).\r\n\r\n```\r\nUsing compiled compiler at .build/crystal\r\n; ModuleID = 'UInt8'\r\n\r\n%String = type { i32, i32, i32, i8 }\r\n%\"(Nil | UInt8)\" = type { i32, [1 x i64] }\r\n\r\n@\":symbol_table\" = external global [4 x %String*]\r\n\r\ndefine i1 @\"*UInt8@Object#===<UInt8, (Nil | UInt8)>:Bool\"(i8 %self, %\"(Nil | UInt8)\"* byval %other) {\r\nalloca:\r\n\r\nentry:                                            ; No predecessors!\r\n  %0 = getelementptr inbounds %\"(Nil | UInt8)\"* %other, i32 0, i32 0\r\n  %1 = load i32* %0\r\n  %2 = icmp eq i32 112, %1\r\n  %3 = and i1 true, %2\r\n  br i1 %3, label %current_def, label %next_def\r\n\r\ncurrent_def:                                      ; preds = %entry\r\n  %4 = getelementptr inbounds %\"(Nil | UInt8)\"* %other, i32 0, i32 1\r\n  %5 = bitcast [1 x i64]* %4 to i8*\r\n  %6 = load i8* %5\r\n  %7 = icmp eq i8 %self, %6\r\n  br label %exit\r\n\r\nnext_def:                                         ; preds = %entry\r\n  %8 = icmp eq i32 112, %1\r\n  %9 = and i1 true, %8\r\n  br i1 %9, label %current_def1, label %next_def2\r\n\r\nexit:                                             ; preds = %current_def\r\n\r\ncurrent_def1:                                     ; preds = %next_def\r\n  %10 = getelementptr inbounds %\"(Nil | UInt8)\"* %other, i32 0, i32 1\r\n  %11 = bitcast [1 x i64]* %10 to i8*\r\n  %12 = load i8* %11\r\n\r\nnext_def2:                                        ; preds = %next_def\r\n}\r\n\r\ndefine i1 @\"*UInt8@Comparable(T)#==<UInt8, UInt8>:Bool\"(i8 %self, i8 %other) {\r\nalloca:\r\n  %__temp_94 = alloca i1\r\n\r\nentry:                                            ; No predecessors!\r\n\r\nthen:                                             ; No predecessors!\r\n\r\nelse:                                             ; No predecessors!\r\n}\r\nBug: self.is_a?(Reference) && other.is_a?(Reference) || other.is_a?(Nil) at crystal/src/comparable.cr:23:8 should have been expanded\r\n*Exception#initialize<Exception, String, Nil>:Array(String) +14 [1]\r\n*Exception::new<String>:Exception +89 [1]\r\n*raise<String>:NoReturn +6 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, (Crystal::And | Crystal::Or | Crystal::ArrayLiteral | Crystal::HashLiteral | Crystal::RegexLiteral | Crystal::RangeLiteral | Crystal::Case | Crystal::StringInterpolation | Crystal::MacroExpression | Crystal::MacroIf | Crystal::MacroFor)>:NoReturn +196 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +4935 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_cond<Crystal::CodeGenVisitor, Crystal::ASTNode+>:LLVM::Value +32 [1]\r\n*Crystal::CodeGenVisitor#codegen_cond_branch<Crystal::CodeGenVisitor, Crystal::ASTNode+, LLVM::BasicBlock, LLVM::BasicBlock>:Nil +49 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::If>:Bool +209 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +3056 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Expressions>:Bool +288 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +1488 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool, Bool>:LLVM::Function +1874 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+>:LLVM::Function +106 [1]\r\n*Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function +375 [1]\r\n*Crystal::CodeGenVisitor#codegen_call<Crystal::CodeGenVisitor, Crystal::Call, Crystal::Def+, Crystal::Type+, Array(LLVM::Value)>:(Nil | LLVM::Value) +260 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +1365 [1]\r\n*Crystal::Call@Crystal::ASTNode#accept<Crystal::Call, Crystal::CodeGenVisitor>:Nil +51 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::Call>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_dispatch<Crystal::CodeGenVisitor, Crystal::Call, (Array(Crystal::Def+) | Array(Crystal::External))>:Bool +8826 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +568 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +4986 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool, Bool>:LLVM::Function +1874 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+>:LLVM::Function +106 [1]\r\n*Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function +375 [1]\r\n*Crystal::CodeGenVisitor#codegen_call<Crystal::CodeGenVisitor, Crystal::Call, Crystal::Def+, Crystal::Type+, Array(LLVM::Value)>:(Nil | LLVM::Value) +260 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +1365 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +4986 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_cond<Crystal::CodeGenVisitor, Crystal::ASTNode+>:LLVM::Value +32 [1]\r\n*Crystal::CodeGenVisitor#codegen_cond_branch<Crystal::CodeGenVisitor, Crystal::ASTNode+, LLVM::BasicBlock, LLVM::BasicBlock>:Nil +49 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::If>:Bool +209 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +3056 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Expressions>:Bool +288 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +1488 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::While>:Bool +866 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +3154 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Expressions>:Bool +288 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +1488 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool, Bool>:LLVM::Function +1874 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+>:LLVM::Function +106 [1]\r\n*Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function +375 [1]\r\n*Crystal::CodeGenVisitor#codegen_call<Crystal::CodeGenVisitor, Crystal::Call, Crystal::Def+, Crystal::Type+, Array(LLVM::Value)>:(Nil | LLVM::Value) +260 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +1365 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +4986 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool, Bool>:LLVM::Function +1874 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+>:LLVM::Function +106 [1]\r\n*Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function +375 [1]\r\n*Crystal::CodeGenVisitor#codegen_call<Crystal::CodeGenVisitor, Crystal::Call, Crystal::Def+, Crystal::Type+, Array(LLVM::Value)>:(Nil | LLVM::Value) +260 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +1365 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +4986 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool, Bool>:LLVM::Function +1874 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+>:LLVM::Function +106 [1]\r\n*Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function +375 [1]\r\n*Crystal::CodeGenVisitor#codegen_call<Crystal::CodeGenVisitor, Crystal::Call, Crystal::Def+, Crystal::Type+, Array(LLVM::Value)>:(Nil | LLVM::Value) +260 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +1365 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +4986 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool, Bool>:LLVM::Function +1874 [1]\r\n*Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+>:LLVM::Function +106 [1]\r\n*Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function +375 [1]\r\n*Crystal::CodeGenVisitor#codegen_call<Crystal::CodeGenVisitor, Crystal::Call, Crystal::Def+, Crystal::Type+, Array(LLVM::Value)>:(Nil | LLVM::Value) +260 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +1365 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +4986 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Assign>:(Nil | Bool) +555 [1]\r\n*Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +3461 [1]\r\n*Crystal::CodeGenVisitor#accept<Crystal::CodeGenVisitor, Crystal::ASTNode+>:Nil +17 [1]\r\n*Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Expressions>:Bool +288 [1]\r\n*Crystal::Expressions@Crystal::ASTNode#accept<Crystal::Expressions, Crystal::CodeGenVisitor>:Nil +51 [1]\r\n*Crystal::Program#build<Crystal::Program, Crystal::Expressions, (Nil | String | Bool | Array(String)), Bool, LLVM::Module, Bool>:Hash(String, LLVM::Module) +145 [1]\r\n*Crystal::Program#build:debug:single_module:expose_crystal_main<Crystal::Program, Crystal::Expressions, Bool, (Nil | String | Bool | Array(String)), Bool>:Hash(String, LLVM::Module) +119 [1]\r\n*Crystal::Compiler#build<Crystal::Compiler, Crystal::Program, Crystal::Expressions, Array(Crystal::Compiler::Source), String>:(Nil | Int32 | Bool) +1286 [1]\r\n*Crystal::Compiler#compile<Crystal::Compiler, Array(Crystal::Compiler::Source), String>:Crystal::Compiler::Result +558 [1]\r\n*Crystal::Command::CompilerConfig#compile<Crystal::Command::CompilerConfig, String>:Crystal::Compiler::Result +100 [1]\r\n*Crystal::Command::run_command<Array(String)>:Nil +373 [1]\r\n*Crystal::Command::run<Array(String)>:(Nil | Bool | FileDescriptorIO+ | Crystal::Compiler::Result | Array(Crystal::Init::View+:Class)) +1342 [1]\r\n*Crystal::Command::run:(Nil | Bool | FileDescriptorIO+ | Crystal::Compiler::Result | Array(Crystal::Init::View+:Class)) +37 [1]\r\n__crystal_main +33900 [1]\r\nmain +55 [1]\r\n__libc_start_main +245 [1]\r\n_start +41 [1]\r\n +41 [1]\r\n\r\nError: you've found a bug in the Crystal compiler. Please open an issue: https://github.com/manastech/crystal/issues\r\n```\r\n\r\nI'm sorry for not finding small error case, I'm finding it now."},"comment":{"url":"https://api.github.com/repos/manastech/crystal/issues/comments/124522911","html_url":"https://github.com/manastech/crystal/issues/1028#issuecomment-124522911","issue_url":"https://api.github.com/repos/manastech/crystal/issues/1028","id":124522911,"user":{"login":"asterite","id":209371,"avatar_url":"https://avatars.githubusercontent.com/u/209371?v=3","gravatar_id":"","url":"https://api.github.com/users/asterite","html_url":"https://github.com/asterite","followers_url":"https://api.github.com/users/asterite/followers","following_url":"https://api.github.com/users/asterite/following{/other_user}","gists_url":"https://api.github.com/users/asterite/gists{/gist_id}","starred_url":"https://api.github.com/users/asterite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterite/subscriptions","organizations_url":"https://api.github.com/users/asterite/orgs","repos_url":"https://api.github.com/users/asterite/repos","events_url":"https://api.github.com/users/asterite/events{/privacy}","received_events_url":"https://api.github.com/users/asterite/received_events","type":"User","site_admin":false},"created_at":"2015-07-24T13:38:57Z","updated_at":"2015-07-24T13:38:57Z","body":"Fixed by https://github.com/manastech/crystal/commit/1d52f13ea69d483247b7ec064b2e545fab6d9bcd"}}