Skip to content

Deprecation warning generated via macro points to nonsense position #22795

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
jchyb opened this issue Mar 13, 2025 · 1 comment · Fixed by #23052
Closed

Deprecation warning generated via macro points to nonsense position #22795

jchyb opened this issue Mar 13, 2025 · 1 comment · Fixed by #23052
Labels

Comments

@jchyb
Copy link
Contributor

jchyb commented Mar 13, 2025

Compiler version

any

Minimized code

Run with -deprecation

import scala.quoted._

@deprecated object A
object Test {
  inline def test() = ${testImpl}
  def testImpl(using Quotes): Expr[Any] =
    import quotes.reflect._
    Ref(Symbol.classSymbol("A$").companionModule).asExpr
}
@main def main() =
  Test.test()

Output

-- Deprecation Warning: depr2.scala:4:46 ---------------------------------------
4 |
  |                                              ^^^^^^^^^^^
  |                                              object A is deprecated

Expectation

Point the warning to the callsite., message could also probably be improved

@jchyb jchyb added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 13, 2025
@jchyb jchyb changed the title Deprecation warning generated via macro pints to nonsense position Deprecation warning generated via macro points to nonsense position Mar 13, 2025
@Gedochao Gedochao added area:positions area:metaprogramming:quotes Issues related to quotes and splices and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 14, 2025
@som-snytt
Copy link
Contributor

The span from the inlined bit is used, which is wrong.

That is corrected in the PR, but improving the message and/or representation of inlined code is still research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants