From d699dabef89baf3d12c769edef8ab79fb2247bd0 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sun, 9 Jun 2024 22:35:05 +0000 Subject: [PATCH] Remove unconditional mutation to super() 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] --- Changelog.md | 6 ++++++ lib/mutant/mutator/node/super.rb | 1 - meta/super.rb | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 80ef46595..0ebfa6637 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +# v0.12.1 2024-06-09 + ++ [#1445](https://github.com/mbj/mutant/pull/1444) + + Remove invalid mutation operator. + # v0.12.1 2024-05-11 * [#1444](https://github.com/mbj/mutant/pull/1444) diff --git a/lib/mutant/mutator/node/super.rb b/lib/mutant/mutator/node/super.rb index e9db4ecd7..7fe04b31c 100644 --- a/lib/mutant/mutator/node/super.rb +++ b/lib/mutant/mutator/node/super.rb @@ -13,7 +13,6 @@ class Super < self def dispatch emit_singletons - emit(N_EMPTY_SUPER) children.each_index do |index| mutate_child(index) delete_child(index) diff --git a/meta/super.rb b/meta/super.rb index e6243f5c6..9092dd574 100644 --- a/meta/super.rb +++ b/meta/super.rb @@ -17,7 +17,6 @@ source 'super(foo, bar)' singleton_mutations - mutation 'super()' mutation 'super(foo)' mutation 'super(bar)' mutation 'super(foo, nil)'