Skip to content

Commit be1e473

Browse files
committed
Update reflect.Symbol position API
1 parent 7a0b8ef commit be1e473

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,8 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
22912291

22922292
def name: String = self.denot.name.toString
22932293
def fullName: String = self.denot.fullName.toString
2294-
def pos: Position = self.sourcePos
2294+
def pos: Option[Position] =
2295+
if self.exists then Some(self.sourcePos) else None
22952296

22962297
def documentation: Option[Documentation] =
22972298
import dotc.core.Comments.CommentsContext

library/src/scala/quoted/Quotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3067,7 +3067,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
30673067
def fullName: String
30683068

30693069
/** The position of this symbol */
3070-
def pos: Position
3070+
def pos: Option[Position]
30713071

30723072
/** The documentation for this symbol, if any */
30733073
def documentation: Option[Documentation]

scala3doc/src/dotty/dokka/tasty/BasicSupport.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ trait BasicSupport:
4141
Map.empty
4242

4343
def source =
44-
val path = Some(sym.pos.sourceFile.jpath).filter(_ != null).map(_.toAbsolutePath).map(_.toString)
45-
path.map(TastyDocumentableSource(_, sym.pos.startLine))
44+
val path = Some(sym.pos.get.sourceFile.jpath).filter(_ != null).map(_.toAbsolutePath).map(_.toString)
45+
path.map(TastyDocumentableSource(_, sym.pos.get.startLine))
4646

4747
def getAnnotations(): List[Annotation] =
4848
sym.annots.filterNot(_.symbol.packageName.startsWith("scala.annotation.internal")).map(parseAnnotation).reverse

scala3doc/src/dotty/dokka/tasty/ClassLikeSupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ trait ClassLikeSupport:
114114
extSym.symbol.normalizedName,
115115
extSym.tpt.dokkaType.asSignature,
116116
extSym.tpt.symbol.dri,
117-
extSym.symbol.pos.start
117+
extSym.symbol.pos.get.start
118118
)
119119
parseMethod(dd.symbol, kind = Kind.Extension(target))
120120
}

0 commit comments

Comments
 (0)