Skip to content

Commit 9a85ee9

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

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
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/reset-command

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

1818
scala> def resetNoArgsStillWorks = 1

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)