Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings about positional parameter mismatch #20

Conversation

straight-shoota
Copy link
Contributor

Implementations of abstract methods should use the same parameter names as the abstract def.

This patch fixes that and removes the respective warnings:

In structural/flyweight.cr:26:15

 26 | def draw_at(_pos : Position)
                  ^---
Warning: positional parameter '_pos' corresponds to parameter 'pos' of the overridden method FlyweightTree#draw_at(pos : Position), which has a different name and may affect named argument passing

A total of 1 warnings were found.
In behavioral/interpreter.cr:63:16

 63 | def evaluate(_press)
                   ^-----
Warning: positional parameter '_press' corresponds to parameter 'press' of the overridden method Evaluator#evaluate(press), which has a different name and may affect named argument passing

A total of 1 warnings were found.
In behavioral/mediator.cr:55:26

 55 | def perform_move(move, fighter)
                             ^------
Warning: positional parameter 'fighter' corresponds to parameter 'performer' of the overridden method MediatorBase#perform_move(move, performer), which has a different name and may affect named argument passing

A total of 1 warnings were found.
In behavioral/strategy.cr:38:14

 38 | def attack(ft, op)
                 ^-
Warning: positional parameter 'ft' corresponds to parameter 'fighter' of the overridden method FightStrategy#attack(fighter, opponent), which has a different name and may affect named argument passing

In behavioral/strategy.cr:38:18

 38 | def attack(ft, op)
                     ^-
Warning: positional parameter 'op' corresponds to parameter 'opponent' of the overridden method FightStrategy#attack(fighter, opponent), which has a different name and may affect named argument passing

In behavioral/strategy.cr:45:14

 45 | def attack(ft, op)
                 ^-
Warning: positional parameter 'ft' corresponds to parameter 'fighter' of the overridden method FightStrategy#attack(fighter, opponent), which has a different name and may affect named argument passing

In behavioral/strategy.cr:45:18

 45 | def attack(ft, op)
                     ^-
Warning: positional parameter 'op' corresponds to parameter 'opponent' of the overridden method FightStrategy#attack(fighter, opponent), which has a different name and may affect named argument passing

A total of 4 warnings were found.

Copy link
Member

@veelenga veelenga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🙏

@veelenga veelenga merged commit 0b67f3f into crystal-community:master Oct 20, 2022
@straight-shoota straight-shoota deleted the fix/positional-parameter-mismatch-warnings branch October 20, 2022 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants