The Wayback Machine - https://web.archive.org/web/20200908023019/https://github.com/scala-js/scala-js/issues/3737
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

Cannot use annotations inside @JSGlobal annotation #3737

Open
fdietze opened this issue Aug 3, 2019 · 4 comments
Open

Cannot use annotations inside @JSGlobal annotation #3737

fdietze opened this issue Aug 3, 2019 · 4 comments
Labels

Comments

@fdietze
Copy link

@fdietze fdietze commented Aug 3, 2019

I have this facade code:

import scala.scalajs.js
import scala.scalajs.js.annotation._

@js.native
@JSGlobal("$crisp")
object crisp extends js.Object

But I'm getting a possible missing interpolator waring. Therefore I tried to suppress the warning using https://github.com/ghik/silencer:

import scala.scalajs.js
import scala.scalajs.js.annotation._
import com.github.ghik.silencer.silent

@js.native
@JSGlobal("$crisp": @silent)
object crisp extends js.Object

But then ScalaJs complains that "$crisp": @silent is not a string literal anymore.

See ghik/silencer#32

@sjrd
Copy link
Member

@sjrd sjrd commented Aug 4, 2019

See the discussion on gitter starting at https://gitter.im/scala-js/scala-js?at=5d416cdf20f75e7ba55aa4fc

Also see the workaround proposed at ghik/silencer#32 (comment)

@sjrd sjrd added the enhancement label Nov 28, 2019
@sjrd
Copy link
Member

@sjrd sjrd commented Jun 6, 2020

I believe this should be addressed upstream in constantAtIndex at
https://github.com/scala/scala/blob/2.12.x/src/reflect/scala/reflect/internal/AnnotationInfos.scala#L339-L343
to handle Annotated trees that (recursively) contain a Literal arg.

@sjrd
Copy link
Member

@sjrd sjrd commented Jun 6, 2020

@fdietze Perhaps you'd like to submit a PR to scala/scala for this?

@fdietze
Copy link
Author

@fdietze fdietze commented Jun 6, 2020

Sorry, I'm too busy right now. And this feature is currently not that important for my work.

But moving the bug to the scala compiler makes sense, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.