-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
-Wunused:imports
causes an error on methods that come from an external library
#17394
Comments
FYI I used |
Here is a simplified version of this issue without any inline, or extension method: In lib.scala: //> using scala 3.3.4
//> using publish.organization "org.example"
//> using publish.name "lib"
//> using publish.version "0.1.0-SNAPSHOT"
package example:
trait A:
def foo: String = ???
package object example extends A:
def foo(x: String): String = ??? In app.scala: //> using scala "3.3.4"
//> using dep "org.example::lib:0.1.0-SNAPSHOT"
import example.*
@main def main = foo
This was inspired by sbt/sbt#7726 in sbt 2 |
-Wunused:all
causes a compiler crash in interaction with inline accessors and extension methods that come from an external library-Wunused:all
causes a compiler crash in interaction with extension methods that come from an external library
-Wunused:all
causes a compiler crash in interaction with extension methods that come from an external library-Wunused:imports
causes an error in interaction with extension methods that come from an external library
-Wunused:imports
causes an error in interaction with extension methods that come from an external library-Wunused:imports
causes an error on methods that come from an external library
With 3.5.1 and sbt, the minimal example gives me:
without any warnings turned on. If an interaction with CheckUnused is suspected, I'll try it against my PR, if I can reproduce the issue (that is, compile cleanly without the flags). I confirmed same behavior with bin/scalacQ. |
You are right and I have the same behavior on However if you take this other example, it crashes with the //> using scala "3.5.1"
//> using option "-Wunused:imports"
//> using dep "org.example::lib:0.1.0-SNAPSHOT"
import example.{given, *}
object C
It seems the same error is triggered by 3 different things, in the 3 different reproduction cases of this PR. |
Thanks, for |
Here's a PR to remove the error - #21975 |
Should be fixed by #22190 |
Compiler version
3.3.0-RC5
Minimized code
Project 1 - the library
Project 2 - usage site, depends on 'Project 1'
To reproduce 'Project 1' needs to be published first:
then we can just run the second project with:
scala-cli compile .
Output
Expectation
Compilation succeeds just like it does without
-Wunused:all
Context
This issue was first reported here: arainko/ducktape#54 - a workaround for it was moving the contents of fallibleSyntax.scala to syntax.scala, that way another inline accessor for
Transformations
(with the nameinline$Transformations$i1
) is not generated, a newinline$Transformations$i3
accessor is generated instead, because these are now in the scope of the same class (syntax$package
).For the sake of completeness, here's a definition of
Transformations
, this file houses proxies to macros, it's also package private.The text was updated successfully, but these errors were encountered: