Skip to content
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

Position of Some type generates warning #21672

Closed
MateuszKubuszok opened this issue Sep 30, 2024 · 1 comment · Fixed by #21677
Closed

Position of Some type generates warning #21672

MateuszKubuszok opened this issue Sep 30, 2024 · 1 comment · Fixed by #21677
Assignees
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug regression This worked in a previous version but doesn't anymore

Comments

@MateuszKubuszok
Copy link

MateuszKubuszok commented Sep 30, 2024

Compiler version

3.3.4

Minimized code

//> using scala 3.3.4
//> using option -Xcheck-macros
//> using test.dep org.scalameta::munit:1.0.2

object Repro {

  inline def apply(): Unit = ${ applyImpl }

  import scala.quoted.*
  def applyImpl(using q: Quotes): Expr[Unit] = {
   import q.*, q.reflect.*
   report.info(TypeRepr.of[Some[String]].typeSymbol.pos.toString)
   '{ () }
  }
}
class Test extends munit.FunSuite {

  test("sdfsdf") {
    Repro()
  }
}

Output

[warn] ./test.test.scala:4:5
[warn] Missing symbol position (defaulting to position 0): class Some
[warn] This is a compiler bug. Please report it.
[warn]     Repro()
[warn]     ^^^^^^^

Expectation

No warning.

This might be troublesome for macro libraries with -Xcheck-macros and -Xfatal-warnings.

The bug might be older than 3.3.4, since 3.3.4 just added the check, 3.3.3 might have the same issue but there was no check for it.

@MateuszKubuszok MateuszKubuszok added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 30, 2024
@jchyb
Copy link
Contributor

jchyb commented Sep 30, 2024

Anyone having this issue might want to use something like: -Wconf:msg=Missing.symbol.position:s to silence those until 3.3.5. For others that happened upon this issue, if your symbol/tree which ends up throwing this warning comes from the currently compiled codebase, please also consider submitting your minimization, as the fix for that might be different

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants