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

Do not warn about expected missing positions in quotes.reflect.Symbol #21677

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 2 additions & 1 deletion compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2688,9 +2688,10 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
if self.exists then
val symPos = self.sourcePos
if symPos.exists then Some(symPos)
else
else if self.source.exists then
if xCheckMacro then report.warning(s"Missing symbol position (defaulting to position 0): $self\nThis is a compiler bug. Please report it.")
Some(self.source.atSpan(dotc.util.Spans.Span(0)))
else None
else None

def docstring: Option[String] =
Expand Down
10 changes: 10 additions & 0 deletions tests/pos-macros/i21672/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
object Repro {
inline def apply(): Unit = ${ applyImpl }

import scala.quoted.*
def applyImpl(using q: Quotes): Expr[Unit] = {
import q.reflect.*
report.info(TypeRepr.of[Some[String]].typeSymbol.pos.toString)
'{ () }
}
}
3 changes: 3 additions & 0 deletions tests/pos-macros/i21672/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//> using options -Xfatal-warnings
object Test:
Repro()
Loading