amnaredo / test

0 stars 0 forks source link

"match may not be exhaustive" in macroRW for case class #282

Open amnaredo opened 3 years ago

amnaredo commented 3 years ago

Hello, I was hoping to use sbt-tpolecat in a project of mine that depends on upickle, but it seems that macroRW is causing this compiler warning, so I can't make warnings fatal.

Minimized example: https://scastie.scala-lang.org/Pk7pFpgzT16Nccuyb7JKCA

import upickle.default._
case class Foo(num: Int)
val rw: ReadWriter[Foo] = macroRW

build.sbt

scalaVersion := "2.13.5"
scalacOptions ++= Seq("-Xlint",  "-Xfatal-warnings")
libraryDependencies += "com.lihaoyi" %% "upickle" % "1.3.8"

Result:

match may not be exhaustive. It would fail on the following input: (x: Int forSome x not in 0) ID: 345 Original Author: raquo

amnaredo commented 3 years ago

@raquo I also got this warning but I found that there is an option to suppress certain warnings since scala 2.13.2 (https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html), in my case I used annotations. This worked excellent for me with making warnings fatal. Original Author: pthorin