Crystal: Compiler bug

Created on 21 May 2018  路  3Comments  路  Source: crystal-lang/crystal

Code below should produce a compiler error, but it doesn't:

module ExceptionTag
end

# This definition breaks things
class TaggedException < Exception
  include ExceptionTag
end

arr = [] of Exception.class
arr << ExceptionTag

Removing TaggedException class definition makes it error out as expected:

Error in line 5: no overload matches 'Array(Exception:Class)#<<' with type ExceptionTag:Module
Overloads are:
 - Array(T)#<<(value : T)
bug compiler

Most helpful comment

@asterite You nailed it again, your compiler-pr-foo is strong! 鉂わ笍

All 3 comments

I suspect bug is somewhere inside Crystal::Call#lookup_matches_in_type, WDYT @asterite?

@Sija More like in restrictions.cr

@asterite You nailed it again, your compiler-pr-foo is strong! 鉂わ笍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lgphp picture lgphp  路  3Comments

TechMagister picture TechMagister  路  3Comments

Papierkorb picture Papierkorb  路  3Comments

ArthurZ picture ArthurZ  路  3Comments

relonger picture relonger  路  3Comments