Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RefChecks partially disabled in case bodies under virtpatmat #7756

Closed
scabug opened this issue Aug 16, 2013 · 6 comments
Closed

RefChecks partially disabled in case bodies under virtpatmat #7756

scabug opened this issue Aug 16, 2013 · 6 comments

Comments

@scabug
Copy link

scabug commented Aug 16, 2013

object Test {
  def test: Unit = {
    trait TA[X <: CharSequence]
    0 match {
      case _ =>
        // the bounds violation isn't reported. RefChecks seems to be too broadly disabled under virtpatmat: see 65340ed4ad2e
        locally(null: TA[Object])
        ()
    }
  }
}
        // skip refchecks in patterns....
        result = result match {
          case CaseDef(pat, guard, body) =>
            inPattern = true
            val pat1 = transform(pat)
            inPattern = false
            treeCopy.CaseDef(tree, pat1, transform(guard), transform(body))
          case LabelDef(_, _, _) if treeInfo.hasSynthCaseSymbol(result) =>
            val old = inPattern
            inPattern = true
            val res = deriveLabelDef(result)(transform)
            inPattern = old
            res
          case ValDef(_, _, _, _) if treeInfo.hasSynthCaseSymbol(result) =>
            deriveValDef(result)(transform)
          case _ =>
            super.transform(result)
        }
@scabug
Copy link
Author

scabug commented Aug 16, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7756?orig=1
Reporter: @retronym
Affected Versions: 2.10.0
See #7716

@scabug
Copy link
Author

scabug commented Aug 16, 2013

@retronym said:
Discovered during investigations of #7716.

@scabug
Copy link
Author

scabug commented Aug 16, 2013

@retronym said:
Similarly:

scala> 1 == ""
<console>:8: warning: comparing values of types Int and String using `==' will always yield false
              1 == ""
                ^
res0: Boolean = false

scala> 0 match { case _ => 1 == "" }
res1: Boolean = false

Finer grains are called for.

@scabug
Copy link
Author

scabug commented Aug 16, 2013

@retronym said:
scala/scala#2840

@scabug
Copy link
Author

scabug commented Aug 19, 2013

@adriaanm said:
scala/scala#2840

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants