Skip to content

Commit e23bc4f

Browse files
committed
Clean up deprecation message
1 parent 818000f commit e23bc4f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/typer/CrossVersionChecks.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ class CrossVersionChecks extends MiniPhase:
7878

7979
def maybeWarn(annotee: Symbol, annot: Annotation) =
8080
if !skipWarning then
81-
val msg = annot.argumentConstant(0).map(": " + _.stringValue).getOrElse("")
82-
val since = annot.argumentConstant(1).map(" since " + _.stringValue).getOrElse("")
83-
report.deprecationWarning(em"${annotee.showLocated} is deprecated${since}${msg}", pos)
81+
val message = annot.argumentConstantString(0).filter(!_.isEmpty).map(": " + _).getOrElse("")
82+
val since = annot.argumentConstantString(1).filter(!_.isEmpty).map(" since " + _).getOrElse("")
83+
report.deprecationWarning(em"${annotee.showLocated} is deprecated${since}${message}", pos)
8484

8585
// Also check for deprecation of the companion class for synthetic methods in the companion module
8686
sym.getAnnotation(defn.DeprecatedAnnot) match

compiler/test-resources/repl/settings-command

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ scala> def f(thread: Thread) = thread.stop()
1111
-- Deprecation Warning: --------------------------------------------------------
1212
1 | def f(thread: Thread) = thread.stop()
1313
| ^^^^^^^^^^^
14-
|method stop in class Thread is deprecated since : see corresponding Javadoc for more information.
14+
|method stop in class Thread is deprecated: see corresponding Javadoc for more information.
1515
def f(thread: Thread): Unit
1616

1717
scala>

0 commit comments

Comments
 (0)