Skip to content

Commit b1a9fd7

Browse files
committed
Add unchecked marks for technically unsafe type tests
`Tree` here is `tpd.Tree` and we're checking against `tpd.Tree | (Context => tpd.Tree)`. Because `Function1` is a trait, we cannot rule out that there exists some subclass of `Tree` which extends it and is not a `tpd.Tree`. The unchecked warning started appearing after the first commit in this PR.
1 parent 3991198 commit b1a9fd7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/core/Annotations.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ object Annotations {
8686
myTree.asInstanceOf[Tree]
8787

8888
override def isEvaluating: Boolean = myTree == null
89-
override def isEvaluated: Boolean = myTree.isInstanceOf[Tree]
89+
override def isEvaluated: Boolean = myTree.isInstanceOf[Tree @unchecked]
9090
}
9191

9292
/** An annotation indicating the body of a right-hand side,
@@ -119,7 +119,7 @@ object Annotations {
119119
myTree.asInstanceOf[Tree]
120120

121121
override def isEvaluating: Boolean = myTree == null
122-
override def isEvaluated: Boolean = myTree.isInstanceOf[Tree]
122+
override def isEvaluated: Boolean = myTree.isInstanceOf[Tree @unchecked]
123123
}
124124

125125
object LazyBodyAnnotation {

0 commit comments

Comments
 (0)