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

selectStatic phase generates incorrect prefix - fails genSJSIR phase, -Ycheck:all #17332

Closed
bishabosha opened this issue Apr 24, 2023 · 0 comments · Fixed by #19400
Closed

selectStatic phase generates incorrect prefix - fails genSJSIR phase, -Ycheck:all #17332

bishabosha opened this issue Apr 24, 2023 · 0 comments · Fixed by #19400

Comments

@bishabosha
Copy link
Member

bishabosha commented Apr 24, 2023

Compiler version

3.2.2

Minimized code

Compile with scala js mode on

package foo

import annotation.static

class MirrorHelpers

object MirrorHelpers:

  @static
  def throwStuff(i: Int): Any = throw new NoSuchElementException(String.valueOf(i))

@main def Test =
  MirrorHelpers.throwStuff(23)

Output

This is what you get with JVM generation

[[syntax trees at end of                  genBCode]] // /Users/jamie/workspace/scripts/bar/test.scala
package foo {
  @SourceFile("test.scala") final module class test$package extends Object {
    // ...
    @main def Test(): Object = MirrorHelpers.this.throwStuff(23) // <---- SHOULD NOT BE `MirrorHelpers.this`
  }

Expectation

There probably should be a static reference to MirrorHelpers, or the check in genSJSIR and -Ycheck:all should forgive this format for static methods.

@main def Test(): Object = foo.MirrorHelpers.throwStuff(23)
@bishabosha bishabosha added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 24, 2023
@jchyb jchyb added area:scala.js area:transform and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 26, 2023
@dwijnand dwijnand self-assigned this Jan 12, 2024
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants