luckyframework / luckyframework/avram

Possible issue with subclassing SaveOperations that have `needs`

Open
#479 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Working on another PR, so this will need to be investigated. It seems like if you have an SaveOperation that has `needs`, and you subclass that, it will duplicate the instance variable in the constructor causing a compile-time `Error: duplicated argument name: ...` error...

```crystal
class SavePost < Post::SaveOperation
needs rollback : Bool = false

# ...
end

class SubSavePost < SavePost

end

# Error: duplicated argument name: rollback
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown Crystal example with a SaveOperation that declares needs and a subclass of it. Trace how the needs declaration is turned into constructor arguments and verify the subclass no longer produces the duplicated rollback argument while preserving inherited behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.