Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/type_toolkit/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def abstract(method_name)
# # is_singleton_method = true, owner is `Foo.singleton_class`
# abstract def self.foo; end
# end
method_owner = is_singleton_method ? singleton_class : self #: as Module[top] & HasAbstractMethods
method_owner = is_singleton_method ? raise(NotImplementedError, <<~MSG) : self
Abstract singleton methods are not supported yet.
MSG

# Register the fact that this method is meant to be abstract,
# used by APIs like `abstract_method_declared?` and `Method#abstract?`
Expand Down
14 changes: 14 additions & 0 deletions spec/interface_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,19 @@ def something_else; end
end
end
end

describe "Abstract class methods" do
it "are not yet supported" do
test_context = self

Module.new do
interface!

test_context.assert_raises(NotImplementedError) do
abstract def self.abstract_class_method; end # rubocop:disable Style/ClassMethodsDefinitions
end
end
end
end
end
end
Loading