org.wartremover.contrib.warts.SomeApply.scala Maven / Gradle / Ivy
The newest version!
package org.wartremover.contrib.warts
import org.wartremover.WartTraverser
import org.wartremover.WartUniverse
object SomeApply extends WartTraverser {
def apply(u: WartUniverse): u.Traverser = {
new u.Traverser(this) {
import q.reflect.*
override def traverseTree(tree: Tree)(owner: Symbol): Unit = {
tree match {
case _ if hasWartAnnotation(tree) =>
case _ if tree.isExpr =>
tree.asExpr match {
case '{ Some($x: Any) } =>
error(tree.pos, "Some.apply is disabled - use Option.apply instead")
case _ =>
super.traverseTree(tree)(owner)
}
case _ =>
super.traverseTree(tree)(owner)
}
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy