Skip to content

fix: Remove "One of these files" error #21975

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 1 commit 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
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2552,9 +2552,6 @@ object SymDenotations {
| $chosen
|and also in
| $f"""
if youngest.size > 1 then
throw TypeError(em"""${ambiguousFilesMsg(youngest.tail.head)}
|One of these files should be removed from the classpath.""")

// Warn if one of the older files comes from a different container.
// In that case picking the youngest file is not necessarily what we want,
Expand Down
6 changes: 6 additions & 0 deletions sbt-test/jar-dependencies/jar/a/A.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package example:
trait A:
def foo: String = ???

package object example extends A:
def foo(x: String): String = ???
3 changes: 3 additions & 0 deletions sbt-test/jar-dependencies/jar/b/B.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import example.*

@main def main = foo
8 changes: 8 additions & 0 deletions sbt-test/jar-dependencies/jar/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ThisBuild / organization := "com.example"

lazy val a = project

lazy val b = project
.settings(
Compile / unmanagedJars += (a / Compile / packageBin).map(Attributed.blank).value
)
12 changes: 12 additions & 0 deletions sbt-test/jar-dependencies/jar/project/DottyInjectedPlugin.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sbt._
import Keys._

object DottyInjectedPlugin extends AutoPlugin {
override def requires = plugins.JvmPlugin
override def trigger = allRequirements

override val projectSettings = Seq(
scalaVersion := sys.props("plugin.scalaVersion"),
scalacOptions ++= List("-Werror", "-Wunused:imports"),
)
}
3 changes: 3 additions & 0 deletions sbt-test/jar-dependencies/jar/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://github.com/scala/scala3/issues/17394

> b/compile
Loading