taylorfinnell / awscr-signer

AWS request signing in Crystal
MIT License
22 stars 15 forks source link

Issue with Crystal 0.30.0 #42

Closed acidtib closed 5 years ago

acidtib commented 5 years ago

Showing last frame. Use --error-trace for full trace.

In /usr/local/Cellar/crystal/0.30.0_1/src/comparable.cr:83:16

 83 | abstract def <=>(other : T)
                   ^--
Error: abstract `def Comparable(T)#<=>(other : T)` must be implemented by Awscr::Signer::Header```
snadon commented 5 years ago

I'm having the same issue.

I tried a quick fix based on the HeaderKey class, which implements the abstract method, by adding it to the Header class:

# src/awscr-signer/core/header.cr
def <=>(other)
  1
end

However, the output is a compiler error:

cast from Nil to Crystal::GenericInstanceType+ failed, at /private/tmp/crystal-20190805-7397-smhku/crystal-0.30.0/src/compiler/crystal/semantic/abstract_def_checker.cr:215:5:215 (TypeCastError)
  from Crystal::AbstractDefChecker#find_base_generic_instantiation<Crystal::Type+, (Crystal::GenericClassType+ | Crystal::GenericModuleType)>:Crystal::GenericInstanceType+
  from Crystal::AbstractDefChecker#implements?<Crystal::Type+, Crystal::Def+, Crystal::NamedType+>:Bool
  from Crystal::AbstractDefChecker#check_implemented_in_subtypes<Crystal::NamedType+, Crystal::NamedType+, Crystal::Def+>:Nil
  from Crystal::AbstractDefChecker#check_single<Crystal::NamedType+>:Nil
  from Crystal::Program#top_level_semantic<Crystal::ASTNode+>:Tuple(Crystal::ASTNode+, Crystal::TypeDeclarationProcessor)
  from Crystal::Program#semantic<Crystal::ASTNode+, Bool>:Crystal::ASTNode+
  from Crystal::Compiler#compile<Array(Crystal::Compiler::Source), String>:Crystal::Compiler::Result
  from Crystal::Command#run_command<Bool>:Nil
  from Crystal::Command#run:(Bool | Crystal::Compiler::Result | Nil)
  from main
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues
acidtib commented 5 years ago

@snadon yup I'm having same results, hopefully, @taylorfinnell has a better clue

Im looking over https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/semantic/abstract_def_checker.cr for more clues

taylorfinnell commented 5 years ago

Should be fixed in #43, I'll do a release later tonight

acidtib commented 5 years ago

had time to test #43 and it's all good in my end, thanks @taylorfinnell

taylorfinnell commented 5 years ago

Closed by #43