Skip to content

Fix #9916: Round-trip through sourceModule in scalacLinkedClass #9976

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
community_build:
runs-on: [self-hosted, Linux]
container: lampepfl/dotty:2020-04-24

if: false
steps:
- name: Checkout cleanup script
uses: actions/checkout@v2
Expand Down Expand Up @@ -167,11 +167,6 @@ jobs:
test_sbt:
runs-on: [self-hosted, Linux]
container: lampepfl/dotty:2020-04-24
if: (
github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/')
) ||
github.event_name == 'schedule'

steps:
- name: Checkout cleanup script
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ object SymDenotations {

final def scalacLinkedClass(using Context): Symbol =
if (this.is(ModuleClass)) companionNamed(effectiveName.toTypeName)
else if (this.isClass) companionNamed(effectiveName.moduleClassName)
else if (this.isClass) companionNamed(effectiveName.moduleClassName).sourceModule.moduleClass
else NoSymbol

/** Find companion class symbol with given name, or NoSymbol if none exists.
Expand Down
4 changes: 4 additions & 0 deletions sbt-dotty/sbt-test/scala2-compat/finagle/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scalaVersion := sys.props("plugin.scalaVersion")

libraryDependencies +=
("com.twitter" %% "finagle-core" % "20.9.0").withDottyCompat(scalaVersion.value)
10 changes: 10 additions & 0 deletions sbt-dotty/sbt-test/scala2-compat/finagle/i9916.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import com.twitter.finagle.Stack
import com.twitter.finagle.liveness.FailureAccrualFactory

trait T {
def p: FailureAccrualFactory.Param
}

class A {
val t = Stack.Param[FailureAccrualFactory.Param](FailureAccrualFactory.Param(???))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
1 change: 1 addition & 0 deletions sbt-dotty/sbt-test/scala2-compat/finagle/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> compile
15 changes: 15 additions & 0 deletions sbt-dotty/sbt-test/scala2-compat/i9916a/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
val scala3Version = sys.props("plugin.scalaVersion")
val scala2Version = "2.13.3"

lazy val `i9916a-lib` = (project in file ("lib"))
.settings(scalaVersion := scala2Version)

lazy val `i9916a-test` = (project in file ("main"))
.dependsOn(`i9916a-lib`)
.settings(
scalaVersion := scala3Version,
// https://github.com/sbt/sbt/issues/5369
projectDependencies := {
projectDependencies.value.map(_.withDottyCompat(scalaVersion.value))
}
)
7 changes: 7 additions & 0 deletions sbt-dotty/sbt-test/scala2-compat/i9916a/lib/i9916a-lib.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package i9916a

object Lib {
trait P
object P
def P(x: Int): P = ???
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import i9916a.Lib

trait Test {
def foo: Lib.P
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
1 change: 1 addition & 0 deletions sbt-dotty/sbt-test/scala2-compat/i9916a/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> i9916a-test/compile
15 changes: 15 additions & 0 deletions sbt-dotty/sbt-test/scala2-compat/i9916b/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
val scala3Version = sys.props("plugin.scalaVersion")
val scala2Version = "2.13.3"

lazy val `i9916b-lib` = (project in file ("lib"))
.settings(scalaVersion := scala2Version)

lazy val `i9916b-test` = (project in file ("main"))
.dependsOn(`i9916b-lib`)
.settings(
scalaVersion := scala3Version,
// https://github.com/sbt/sbt/issues/5369
projectDependencies := {
projectDependencies.value.map(_.withDottyCompat(scalaVersion.value))
}
)
7 changes: 7 additions & 0 deletions sbt-dotty/sbt-test/scala2-compat/i9916b/lib/i9916b-lib.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package i9916b

trait T {
class A
object A
def A(x: Int): Unit = ???
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import i9916b.T

trait Test {
def foo: T
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
1 change: 1 addition & 0 deletions sbt-dotty/sbt-test/scala2-compat/i9916b/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> i9916b-test/compile