Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mccartney committed Oct 3, 2020
1 parent 5c690f6 commit aa99ba6
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,22 @@ class AsInstanceOfTest extends InspectionTest {
compileCodeSnippet(code)
compiler.scapegoat.feedback.warnings.size shouldBe 0
}
"should not warn on GADT pattern matching (#378)" in {
val code =
"""
|sealed trait MyGADT[T]
|final case class VariantInt(value: Int) extends MyGADT[Int]
|final case class VariantString(value: String) extends MyGADT[String]
|
|def doStuff[T](gadt: MyGADT[T]): T = {
| gadt match {
| case VariantInt(value) => value
| case VariantString(value) => value
| }
|}
|""".stripMargin
compileCodeSnippet(code)
compiler.scapegoat.feedback.warnings.size shouldBe 0
}
}
}

0 comments on commit aa99ba6

Please sign in to comment.