muter icon indicating copy to clipboard operation
muter copied to clipboard

Removing a Never-returning side effect produces a false positive

Open SlaunchaMan opened this issue 5 years ago • 2 comments
trafficstars

In one of my projects, I have a method that returns Never and calls another method that returns Never. Muter identifies this as a side effect and removes it, but then falsely identifies this mutant as having survived. If you comment out the line and run swift test, you get a build failure before the test suite even starts.

SlaunchaMan avatar Mar 29 '20 17:03 SlaunchaMan

The relevant log:

[1/2] Compiling ErrorAssertions PreconditionWrapper.swift
/private/var/folders/j_/p9cvq6tn5p19yplj1l7_m_580000gn/T/TemporaryItems/(A Document Being Saved By muter 16)/ErrorAssertions/Sources/ErrorAssertions/PreconditionWrapper.swift:66:1: error: function with uninhabited return type 'Never' is missing call to another never-returning function on all paths
}
^

If I comment out PreconditionWrapper.swift line 66 manually and run swift test, here’s the output:

/Users/jeff/Projects/Open-Source/ErrorAssertions/Sources/ErrorAssertions/PreconditionWrapper.swift:67:1: error: function with uninhabited return type 'Never' is missing call to another never-returning function on all paths
}
^
[5/6] Compiling ErrorAssertions AssertWrapper.swift

The exit status of swift test is 1.

SlaunchaMan avatar Mar 29 '20 17:03 SlaunchaMan

What a bummer :( Thanks for reporting it @SlaunchaMan, I'll try to reproduce and fix it!

rakaramos avatar Apr 16 '20 12:04 rakaramos

@SlaunchaMan we did a lot of improvements of the last version, could you please try with the latest version? I'm closing it for now, but feel free to reopen in case this still occurs. Thanks!

rakaramos avatar Oct 21 '23 20:10 rakaramos