Skip to content

Commit 3f69a4e

Browse files
Merge pull request #4684 from dotty-staging/fix-#4674
Fix #4674: Do not emit waring if types are the same
2 parents 8c3f3b9 + 93a5ccc commit 3f69a4e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,12 @@ object messages {
20972097

20982098
case class TypeTestAlwaysSucceeds(foundCls: Symbol, testCls: Symbol)(implicit ctx: Context) extends Message(TypeTestAlwaysSucceedsID) {
20992099
val kind = "Syntax"
2100-
val msg = s"The highlighted type test will always succeed since the scrutinee type ($foundCls) is a subtype of ${testCls}"
2100+
val msg = {
2101+
val addendum =
2102+
if (foundCls != testCls) s" is a subtype of $testCls"
2103+
else " is the same as the tested type"
2104+
s"The highlighted type test will always succeed since the scrutinee type ($foundCls)" + addendum
2105+
}
21012106
val explanation = ""
21022107
}
21032108
}

0 commit comments

Comments
 (0)