Skip to content

Scalac report a deprecation warning inconsistently between var and def #11538

Closed
@exoego

Description

@exoego

Scalac report a warning on @deprecated(...) var if its type contains deprecated type.

@deprecated("Non-standard", "0.1")
class StreatmEvent {}

class RTCPeerConnection {
  @deprecated("Non-standard", "0.1")
  var onaddstream: js.Function1[StreatmEvent, _] = js.native
}

However, inconsitently, scalac does not report a warning on @deprecated(...) def that uses deprecated type.

@deprecated("Non-standard", "0.1")
class StreatmEvent {}

class RTCPeerConnection {
  @deprecated("Non-standard", "0.1")
  def onaddstream: js.Function1[StreatmEvent , _] = js.native

  @deprecated("Non-standard", "0.1")
  def onaddstream_= (handler: js.Function1[StreatmEvent , _]): Unit = js.native
}

For me working on scala-js/scala-js-dom#367, no warnings on member already marked as @deprecated is preferrable.
But it may depends on use case.

cc: @sjrd scala-js/scala-js-dom#367 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions