crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.22k stars 1.61k forks source link

Compiler complains that an implemented abstract module method must be implemented when calling `super` #14387

Open spuun opened 3 months ago

spuun commented 3 months ago

Bug Report

module BaseInterface
  abstract def implement_this
end

class BaseImplementation
  include BaseInterface

  def implement_this
    true    
  end
end

class SubImplementation < BaseImplementation
  include BaseInterface

  def implement_this
    super
  end
end 

SubImplementation.new.implement_this

results in

error in line 17
Error: abstract `def BaseInterface#implement_this()` must be implemented by BaseInterface

Line 17 is the super call.

# crystal -v
Crystal 1.11.2 (2024-01-18)

LLVM: 17.0.6
Default target: aarch64-apple-darwin23.4.0
Blacksmoke16 commented 3 months ago

Seems to work if you remove the redundant include BaseInterface in SubImplementation. Could use that as a workaround for now if this is a blocker for you.

spuun commented 3 months ago

Seems to work if you remove the redundant include BaseInterface in SubImplementation. Could use that as a workaround for now if this is a blocker for you.

Yeah, but I have a SubInterface that includes BaseInterface, and SubImplementation includes SubInterface. I can probably still do a decent work around.