Skip to content

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

Closed
@bishabosha

Description

@bishabosha

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions