-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
To find Scala companion mudule from Java, we should strip module suffix `$`. This ~provides workaround~ fixes #17255 as well as forward-port scala/scala#10644. ~, but it requires some refinment to fix it because not-fully-qualified type like the following example still fails to compile due to missing symbol.~ Related to scala/scala#10644
- Loading branch information
Showing
8 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,5 @@ t6138 | |
t6138-2 | ||
i12656.scala | ||
trait-static-forwarder | ||
i17255 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package example; | ||
|
||
|
||
public class Bar { | ||
private static final example.Foo$ MOD = example.Foo$.MODULE$; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package example; | ||
|
||
import example.Foo$; | ||
|
||
public class Baz { | ||
private static final Foo$ MOD = Foo$.MODULE$; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package example | ||
|
||
case class Foo(i: Int) | ||
|
||
object Foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package p; | ||
|
||
public class J { | ||
public static J j = new J(); | ||
public static p.J f() { | ||
return p.J.j; | ||
} | ||
public static Module$ module2() { | ||
return p.Module$.MODULE$; | ||
} | ||
public static p.Module$ module() { | ||
return p.Module$.MODULE$; | ||
} | ||
|
||
public String toString() { return "J"; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// scalajs: --skip | ||
|
||
package p { | ||
object Module { | ||
override def toString = "Module" | ||
} | ||
} | ||
|
||
object Test extends App { | ||
assert(p.J.f().toString == "J") | ||
assert(p.J.module().toString == "Module") | ||
assert(p.J.module2().toString == "Module") | ||
} |