Skip to content

Missing @JSName annotation warning after overriding a @ScalaJSDefined method #1983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xsistens opened this issue Oct 29, 2015 · 1 comment
Closed
Assignees
Labels
bug Confirmed bug. Needs to be fixed.
Milestone

Comments

@xsistens
Copy link

There should be at least an information that @JSName annotation has to be reapplied after overriding a method from a @ScalaJSDefined class. Best would be if the annotation is carried over, because I think it's a common pattern in @ScalaJSDefined classes to rename the scala method name from a facade to provide a custom method with the actual method name and call the renamed one.

@ScalaJSDefined
abstract class A extends js.Object {
  @JSName("_test")
  def test(): Int
  @JSName("test")
  def _test(): String = test().toString
}
val a = new A {
  override def test() = 1
}

This leads to a Conflicting properties and methods for ... Error because the @JSName annotation is not carried over.

@chandu0101
Copy link

👍

@sjrd sjrd added the bug Confirmed bug. Needs to be fixed. label Oct 29, 2015
@sjrd sjrd added this to the v0.6.6 milestone Oct 29, 2015
nicolasstucki added a commit to nicolasstucki/scala-js that referenced this issue Jan 11, 2016
@sjrd sjrd added the has-pr label Jan 12, 2016
nicolasstucki added a commit to nicolasstucki/scala-js that referenced this issue Jan 14, 2016
@sjrd sjrd closed this as completed in b2211e0 Jan 15, 2016
sjrd added a commit that referenced this issue Jan 15, 2016
…ides

Fix #1983: Warn if @ScalaJSDefined overrides js names differ.
@sjrd sjrd removed the has-pr label Jan 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug. Needs to be fixed.
Projects
None yet
Development

No branches or pull requests

4 participants