File tree 1 file changed +4
-3
lines changed
compiler/src/dotty/tools/dotc/transform
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -206,19 +206,20 @@ object TypeTestsCasts {
206
206
* can be true in some cases. Issues a warning or an error otherwise.
207
207
*/
208
208
def checkSensical (foundCls : Symbol )(using Context ): Boolean =
209
+ def exprType = i " type ${expr.tpe.widen.stripAnnots}"
209
210
if (! isCheckable(foundCls)) true
210
211
else if (foundCls.isPrimitiveValueClass && ! testCls.isPrimitiveValueClass) {
211
- ctx.error(" cannot test if value types are references " , tree.sourcePos)
212
+ ctx.error(i " cannot test if value of $exprType is a reference of $testCls " , tree.sourcePos)
212
213
false
213
214
}
214
215
else if (! foundCls.derivesFrom(testCls)) {
215
216
val unrelated = ! testCls.derivesFrom(foundCls) && (
216
217
testCls.is(Final ) || ! testCls.is(Trait ) && ! foundCls.is(Trait )
217
218
)
218
219
if (foundCls.is(Final ))
219
- unreachable(i " type ${expr.tpe.widen} is not a subclass of $testCls" )
220
+ unreachable(i " $exprType is not a subclass of $testCls" )
220
221
else if (unrelated)
221
- unreachable(i " type ${expr.tpe.widen} and $testCls are unrelated " )
222
+ unreachable(i " $exprType and $testCls are unrelated " )
222
223
else true
223
224
}
224
225
else true
You can’t perform that action at this time.
0 commit comments