Singleton does not have method `instance`
Typechecking for singletons (the pattern) doesn't seem to work as expected.
E.g. given an rb file
# frozen_string_literal: true
require "singleton"
module A
module Example
class TestClass
include Singleton
end
end
end
A::Example::TestClass.instance
and and RBS file:
module A
module Example
VERSION: String
class TestClass
include Singleton
end
end
end
steep complains about: Type singleton(::A::Example::TestClass) does not have method instance.
The simples possible Steepfile i could come up with for the repro case:
target :lib do
signature "sig"
check "lib"
library "singleton"
end
Given that there are some moving parts involved but also there's still active development going on, I wonder whether this supposed to even work right now?
In the original project The class including Singleton also extends Forwardable and so i was somehow hoping that it's just some weirdness. But even in this simple repro case it just doesn't work as expected.
I'm also running into this, and I can fix it by adding the following additional signature:
module A
module Example
class TestClass
def self.instance: () -> singleton(A::Example::TestClass)
end
end
end
But then I get a new error:
Type `singleton(::A::Example::TestClass)` does not have method `example`