You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wartremover version: 3.1.3 (more precise on the currentmaster)
Hey there. I found that org.wartremover.warts.ForbidInference behaves differently for Scala 2 and 3 with such nested types as Option[Option[_]]:
// Scala 2objectNestedOptionextendsForbidInference[Option[Option[_]]] {
defapply(u: WartUniverse): u.Traverser= applyForbidden(u)
}
// Scala 3objectNestedOptionextendsForbidInference[Option[Option[?]]]
// testsclassNestedOptionTestextendsAnyFunSuitewithResultAssertions {
test("Option[_] can be inferred") {
valresult=WartTestTraverser(NestedOption) {
Option(42)
}
assertEmpty(result)
}
test("Option[List[_]] can be inferred") {
valresult=WartTestTraverser(NestedOption) {
Option(List(42))
}
assertEmpty(result)
}
test("Option[Option[_]] can't be inferred") {
valresult=WartTestTraverser(NestedOption) {
Option(Option(42))
}
assertError(result)("Inferred type containing Option: Option[Int]")
}
test("Option[Option[Option[_]]] can't be inferred") {
valresult=WartTestTraverser(NestedOption) {
Option(Option(None))
}
assertError(result)("Inferred type containing Option: Option[None.type]")
}
test("NestedOption wart obeys SuppressWarnings") {
valresult=WartTestTraverser(NestedOption) {
@SuppressWarnings(Array("org.wartremover.warts.NestedOption"))
valx=Option(Option(42))
}
assertEmpty(result)
}
}
Using Scala 2, all tests are passed, but for using Scala 3, only NestedOption wart obeys SuppressWarnings is passed. I might miss something stupid and obvious, so feel free to point me at that.
The text was updated successfully, but these errors were encountered:
2.13.11
and3.3.0
master
)Hey there. I found that
org.wartremover.warts.ForbidInference
behaves differently for Scala 2 and 3 with such nested types asOption[Option[_]]
:Using Scala 2, all tests are passed, but for using Scala 3, only
NestedOption wart obeys SuppressWarnings
is passed. I might miss something stupid and obvious, so feel free to point me at that.The text was updated successfully, but these errors were encountered: