Skip to content

Commit

Permalink
Clean up deprecation message
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Jun 7, 2023
1 parent 818000f commit 9a85ee9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/dotc/typer/CrossVersionChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class CrossVersionChecks extends MiniPhase:

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

// Also check for deprecation of the companion class for synthetic methods in the companion module
sym.getAnnotation(defn.DeprecatedAnnot) match
Expand Down
2 changes: 1 addition & 1 deletion compiler/test-resources/repl/reset-command
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ scala> def f(thread: Thread) = thread.stop()
-- Deprecation Warning: --------------------------------------------------------
1 | def f(thread: Thread) = thread.stop()
| ^^^^^^^^^^^
|method stop in class Thread is deprecated since : see corresponding Javadoc for more information.
|method stop in class Thread is deprecated: see corresponding Javadoc for more information.
def f(thread: Thread): Unit

scala> def resetNoArgsStillWorks = 1
Expand Down
2 changes: 1 addition & 1 deletion compiler/test-resources/repl/settings-command
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ scala> def f(thread: Thread) = thread.stop()
-- Deprecation Warning: --------------------------------------------------------
1 | def f(thread: Thread) = thread.stop()
| ^^^^^^^^^^^
|method stop in class Thread is deprecated since : see corresponding Javadoc for more information.
|method stop in class Thread is deprecated: see corresponding Javadoc for more information.
def f(thread: Thread): Unit

scala>

0 comments on commit 9a85ee9

Please sign in to comment.