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
sealedtraitMyGADT[T]
finalcaseclassVariantInt(value: Int) extendsMyGADT[Int]
finalcaseclassVariantString(value: String) extendsMyGADT[String]
defdoStuff[T](gadt: MyGADT[T]):T= {
gadt match {
caseVariantInt(value) => value
caseVariantString(value) => value
}
}
Produces the following false positives:
[error] MyGADT.scala:7:34: [scapegoat] Use of asInstanceOf
[error] Use of asInstanceOf is considered a bad practice - consider using pattern matching instead.
[error] value.asInstanceOf[T]
[error] case VariantInt(value) => value
[error] MyGADT.scala:8:34: [scapegoat] Use of asInstanceOf
[error] Use of asInstanceOf is considered a bad practice - consider using pattern matching instead.
[error] value.asInstanceOf[T]
[error] case VariantInt(value) => value
The text was updated successfully, but these errors were encountered:
This code:
Produces the following false positives:
The text was updated successfully, but these errors were encountered: