muter-mutation-testing / muter

🔎 Automated mutation testing for Swift 🕳️
MIT License
498 stars 39 forks source link

Removing a Never-returning side effect produces a false positive #158

Closed SlaunchaMan closed 1 year ago

SlaunchaMan commented 4 years ago

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 commented 4 years ago

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.

rakaramos commented 4 years ago

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

rakaramos commented 1 year ago

@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!