All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wartremover.warts.MapUnit.scala Maven / Gradle / Ivy

There is a newer version: 3.2.4
Show newest version
package org.wartremover
package warts

import scala.quoted.Expr
import scala.quoted.Type
import scala.quoted.Quotes
import scala.quoted.quotes

object MapUnit
    extends ExprMatch({
      import quotes.reflect.*

      val f: PartialFunction[Expr[Any], String] = {
        case '{
              type t1
              type t2
              ($x: collection.Iterable[`t1`]).map($f: Function1[`t1`, `t2`])
            } if TypeRepr.of[t2] =:= TypeRepr.of[Unit] =>
          "Maybe you should use `foreach` instead of `map`"
      }

      f
    })




© 2015 - 2024 Weber Informatics LLC | Privacy Policy