From 8dc7b6e9e09d6065ae842fbba63ab80606d7cbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Zyba=C5=82a?= Date: Tue, 17 May 2022 09:32:03 +0200 Subject: [PATCH] Temporary reintroduce position check in Scaladoc --- .../scaladoc/tasty/SyntheticSupport.scala | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/SyntheticSupport.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/SyntheticSupport.scala index 8b98e40fd6b0..dabc6468d4c9 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/SyntheticSupport.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/SyntheticSupport.scala @@ -22,17 +22,28 @@ object SyntheticsSupport: end extension + private def hackExists(using Quotes)(rpos: reflect.Position) = { + import reflect._ + import dotty.tools.dotc + import dotty.tools.dotc.util.Spans._ + given dotc.core.Contexts.Context = quotes.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx + val pos = rpos.asInstanceOf[dotc.util.SourcePosition] + pos.exists + } + def isSyntheticField(using Quotes)(c: reflect.Symbol) = import reflect._ c.flags.is(Flags.CaseAccessor) || (c.flags.is(Flags.Module) && !c.flags.is(Flags.Given)) def constructorWithoutParamLists(using Quotes)(c: reflect.ClassDef): Boolean = - c.constructor.pos.start == c.constructor.pos.end || { - val end = c.constructor.pos.end - val typesEnd = c.constructor.leadingTypeParams.lastOption.fold(end - 1)(_.pos.end) - val classDefTree = c.constructor.show - c.constructor.leadingTypeParams.nonEmpty && end <= typesEnd + 1 - } + if hackExists(c.constructor.pos) then { + c.constructor.pos.start == c.constructor.pos.end || { + val end = c.constructor.pos.end + val typesEnd = c.constructor.leadingTypeParams.lastOption.fold(end - 1)(_.pos.end) + val classDefTree = c.constructor.show + c.constructor.leadingTypeParams.nonEmpty && end <= typesEnd + 1 + } + } else false def getSupertypes(using Quotes)(c: reflect.ClassDef) = c.symbol.typeRef.baseClasses.map(b => b -> c.symbol.typeRef.baseType(b)).tail