Skip to content

Commit

Permalink
fix: Remove "One of these files" error
Browse files Browse the repository at this point in the history
**Problem**
See gh-21973. Currently the ambiguous symbol detection raises
false positives when used together with `-Wunused:imports`.

**Solution**
Remove the faulty ambiguous symbol detection for now.
  • Loading branch information
eed3si9n committed Nov 19, 2024
1 parent cc4a324 commit 1730d8a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 3 deletions.
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

0 comments on commit 1730d8a

Please sign in to comment.