Shopify / Shopify/type_toolkit
Ensure making a class abstract doesn't change the visibility of its `.new`
Open
Nobody has claimed this yet.
good first issue
- Dominant language
- Ruby
- Stars
- 3
- Forks
- 5
- Avg merge
- 8d 23h
- Merged PRs (30d)
- 8
Description
The implementation in #3 will always make new public, regardless of the visibility it had previously.
Desired behaviour:
class PrivateNew
private_class_method :new
end
class MyAbstractClass < PrivateNew
abstract!
end
p MyAbstractClass.singleton_class.public_method_defined?(:new)
# is true, should be false
class MySubclass < MyAbstractClass; end
p MySubclass.singleton_class.public_method_defined?(:new)
# is true, should be false
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the abstract-class implementation introduced in issue #3 and trace how abstract! changes the class's singleton methods. Reproduce the visibility checks with PrivateNew, MyAbstractClass, and MySubclass from this issue; done means both checks remain false when inherited .new was private.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100