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

Mutation of super to super() should not happen for a method with no arguments #615

Closed
mvz opened this issue Jul 16, 2016 · 4 comments
Closed

Comments

@mvz
Copy link
Contributor

mvz commented Jul 16, 2016

(Follow-up from #309).

It looks like mutant wants to enforce super() as opposed to super, even when those two options are completely equivalent:

class Foo
  def bar
    # ...
  end
end

class Bar < Foo
  def bar
    # ...
    super
  end
end

Here, idiomatic Ruby would favor super over super(), but mutant wants me to use super(), and I see no way to write a spec to favor super.

@mbj
Copy link
Owner

mbj commented Jan 29, 2017

@mvz I believe this is a duplicate of an existing issue we agreed upon fixing. Till I've the time to reference the original I'll keep it open.

I agree on fixing it, while you cite #309 I do not agree its at all the same case. Even when this statement may spark new discussions on #309. Please do not, I do not want to lock down another discussion, hint, hint, hint.

@dgollahon
Copy link
Collaborator

dgollahon commented Jan 29, 2017

@mbj: I think this is the original issue for fixing super() when there are no arguments as it has been open for months (and i don't see another instance in the tracker). If it showed up in your github notifications again it is probably because I mistakenly commented on it last night (and then deleted my comment when I realized it was the wrong issue).

@mbj
Copy link
Owner

mbj commented Jan 30, 2017

If it showed up in your github notifications again it is probably because I mistakenly commented on it last night (and then deleted my comment when I realized it was the wrong issue).

Hah, I was actually curious on why that old issue showed up. Thx for clearing that up for me.

@dgollahon
Copy link
Collaborator

Yeah, sorry about that xD

mbj added a commit that referenced this issue Jun 9, 2024
This mutation only makes sense if the method was called with arguments in the first place.
If there are no arguments `super()` and `super` are semantically equivalent.
And there is no vector towards reduced semantics, which is required for an operator to be valid.

If mutant would be able to emit this mutation conditionally (on the presence of arguments) than this is
a valid operator. Until than we cannot emit it.

[fix #615]
@mbj mbj closed this as completed in 5f33eb9 Jun 9, 2024
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

No branches or pull requests

3 participants