diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index 40a3e193546a..dc2d263678f2 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -78,7 +78,7 @@ import transform.SymUtils._ def kind = "Reference" abstract class EmptyCatchOrFinallyBlock(tryBody: untpd.Tree, errNo: ErrorMessageID)(using Context) - extends SyntaxMsg(EmptyCatchOrFinallyBlockID) { + extends SyntaxMsg(errNo) { def explain = { val tryString = tryBody match { case Block(Nil, untpd.EmptyTree) => "{}" diff --git a/compiler/test-resources/repl/i13208.default.scala b/compiler/test-resources/repl/i13208.default.scala index 9a18f9a67c66..048ca522421f 100644 --- a/compiler/test-resources/repl/i13208.default.scala +++ b/compiler/test-resources/repl/i13208.default.scala @@ -1,6 +1,6 @@ scala> try 1 1 warning found --- [E000] Syntax Warning: ------------------------------------------------------ +-- [E002] Syntax Warning: ------------------------------------------------------ 1 | try 1 | ^^^^^ | A try without catch or finally is equivalent to putting diff --git a/tests/neg-custom-args/nowarn/nowarn-parser-error.check b/tests/neg-custom-args/nowarn/nowarn-parser-error.check index ce0d9113cf7f..8be545a288a6 100644 --- a/tests/neg-custom-args/nowarn/nowarn-parser-error.check +++ b/tests/neg-custom-args/nowarn/nowarn-parser-error.check @@ -4,7 +4,7 @@ | an identifier expected, but 'def' found | | longer explanation available when compiling with `-explain` --- [E000] Syntax Warning: tests/neg-custom-args/nowarn/nowarn-parser-error.scala:2:10 ---------------------------------- +-- [E002] Syntax Warning: tests/neg-custom-args/nowarn/nowarn-parser-error.scala:2:10 ---------------------------------- 2 | def a = try 1 // warn | ^^^^^ | A try without catch or finally is equivalent to putting