Skip to content
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

Setters in raw JS type with varargs are allowed #1706

Closed
gzm0 opened this issue Jun 8, 2015 · 6 comments
Closed

Setters in raw JS type with varargs are allowed #1706

gzm0 opened this issue Jun 8, 2015 · 6 comments
Assignees
Labels
bug Confirmed bug. Needs to be fixed.
Milestone

Comments

@gzm0
Copy link
Contributor

gzm0 commented Jun 8, 2015

The following compiles but probably shouldn't:

trait A extends js.Object {
  def a_=(x: Int*): Unit = js.native
}

The @JSExport equivalent does fail:

A method ending in _= will be exported as setter. But foo_= does not have the right signature to do so (single argument, unit return type).
@gzm0 gzm0 added this to the v0.6.4 milestone Jun 8, 2015
@gzm0 gzm0 added the bug Confirmed bug. Needs to be fixed. label Jun 8, 2015
@gzm0 gzm0 self-assigned this Jun 8, 2015
@gzm0
Copy link
Contributor Author

gzm0 commented Jun 8, 2015

@sjrd, please confirm this.

@sjrd
Copy link
Member

sjrd commented Jun 8, 2015

It should definitely not compile. The compiler wouldn't know what to do with a call site x.a_=(a, b, c)!

@gzm0
Copy link
Contributor Author

gzm0 commented Jun 8, 2015

I'm pretty sure it will set the Seq on the property...

Shall I make this a hard fail or should we make it warn?

@sjrd
Copy link
Member

sjrd commented Jun 8, 2015

Hard fail. There's no reason not to.

@gzm0
Copy link
Contributor Author

gzm0 commented Jun 8, 2015

Ok

gzm0 added a commit to gzm0/scala-js that referenced this issue Jun 12, 2015
This commit enforces the following on interop setters (facades and
exported). An interop setter is any method ending in `_=`.

* Return Unit
* Only a single parameter (1)
* No default parameter (1,2)
* No vararg parameter (1)

(1) Breaking change for facade types.
(2) Only a warning for exports due to compatibility.

Fixes scala-js#1704, scala-js#1706, scala-js#1707.
gzm0 added a commit to gzm0/scala-js that referenced this issue Jun 12, 2015
This commit enforces the following on interop setters (facades and
exported). An interop setter is any method ending in `_=`.

* Return Unit
* Only a single parameter (1)
* No default parameter (1,2)
* No vararg parameter (1)

(1) Breaking change for facade types.
(2) Only a warning for exports due to compatibility.

Fixes scala-js#1704, scala-js#1706, scala-js#1707.
@sjrd
Copy link
Member

sjrd commented Jun 13, 2015

Fixed in 7cacc30

@sjrd sjrd closed this as completed Jun 13, 2015
nicolasstucki pushed a commit to nicolasstucki/scala-js that referenced this issue Jun 15, 2015
This commit enforces the following on interop setters (facades and
exported). An interop setter is any method ending in `_=`.

* Return Unit
* Only a single parameter (1)
* No default parameter (1,2)
* No vararg parameter (1)

(1) Breaking change for facade types.
(2) Only a warning for exports due to compatibility.

Fixes scala-js#1704, scala-js#1706, scala-js#1707.
nicolasstucki pushed a commit to nicolasstucki/scala-js that referenced this issue Jun 17, 2015
This commit enforces the following on interop setters (facades and
exported). An interop setter is any method ending in `_=`.

* Return Unit
* Only a single parameter (1)
* No default parameter (1,2)
* No vararg parameter (1)

(1) Breaking change for facade types.
(2) Only a warning for exports due to compatibility.

Fixes scala-js#1704, scala-js#1706, scala-js#1707.
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

2 participants