diff --git a/core/src/main/scala/com/avsystem/commons/meta/metaAnnotations.scala b/core/src/main/scala/com/avsystem/commons/meta/metaAnnotations.scala index 7eaba11a1..fdc882ab2 100644 --- a/core/src/main/scala/com/avsystem/commons/meta/metaAnnotations.scala +++ b/core/src/main/scala/com/avsystem/commons/meta/metaAnnotations.scala @@ -278,13 +278,6 @@ final class isAnnotated[T <: StaticAnnotation] extends DirectMetadataParamStrate */ final class reifyName(val useRawName: Boolean = false) extends DirectMetadataParamStrategy -/** - * Metadata parameter annotated with this annotation must be of type `SymbolSource` - - * class that holds symbol source information - start & end offsets of symbol definition as well as actual - * source text. - */ -final class reifySource extends DirectMetadataParamStrategy - /** * Metadata parameter annotated with this annotation must be of type `ParamPosition` or `MethodPosition` - * a class that holds parameter/method index information - see scaladoc for `ParamPosition` & `MethodPosition` diff --git a/core/src/test/scala/com/avsystem/commons/rpc/SymbolSourceTest.scala b/core/src/test/scala/com/avsystem/commons/rpc/SymbolSourceTest.scala deleted file mode 100644 index a6555af46..000000000 --- a/core/src/test/scala/com/avsystem/commons/rpc/SymbolSourceTest.scala +++ /dev/null @@ -1,38 +0,0 @@ -package com.avsystem.commons.rpc - -import com.avsystem.commons.meta.{SymbolSource, TypedMetadata, multi, reifySource} -import org.scalatest.funsuite.AnyFunSuite - -class Dummy { - def thing(param: Int): String = "fuuu" -} - -case class ClassSourceMetadata[T]( - @reifySource source: SymbolSource, - @encoded @multi @rpcMethodMetadata methods: List[MethodSourceMetadata[_]] -) extends TypedMetadata[T] -object ClassSourceMetadata extends ApiMetadataCompanion[ClassSourceMetadata] - -case class MethodSourceMetadata[T]( - @reifySource source: SymbolSource, - @encoded @multi @rpcParamMetadata params: List[ParamSourceMetadata[_]] -) extends TypedMetadata[T] - -case class ParamSourceMetadata[T]( - @reifySource source: SymbolSource -) extends TypedMetadata[T] - -class SymbolSourceTest extends AnyFunSuite { - test("symbol source metadata") { - val srcMeta = ClassSourceMetadata.materialize[Dummy] - - assert(srcMeta.source.text == - """class Dummy { - | def thing(param: Int): String = "fuuu" - |}""".stripMargin) - - assert(srcMeta.methods.map(_.source.text) == List("""def thing(param: Int): String = "fuuu"""")) - - assert(srcMeta.methods.map(_.params.map(_.source.text)) == List(List("param: Int"))) - } -} diff --git a/macros/src/main/scala/com/avsystem/commons/macros/meta/MacroMetadatas.scala b/macros/src/main/scala/com/avsystem/commons/macros/meta/MacroMetadatas.scala index 2b6f796ba..2e70ca205 100644 --- a/macros/src/main/scala/com/avsystem/commons/macros/meta/MacroMetadatas.scala +++ b/macros/src/main/scala/com/avsystem/commons/macros/meta/MacroMetadatas.scala @@ -17,7 +17,6 @@ private[commons] trait MacroMetadatas extends MacroSymbols { final lazy val ReifyAnnotAT: Type = staticType(tq"$MetaPackage.reifyAnnot") final lazy val IsAnnotatedAT: Type = staticType(tq"$MetaPackage.isAnnotated[_]") final lazy val ReifyNameAT: Type = staticType(tq"$MetaPackage.reifyName") - final lazy val ReifySourceAT: Type = staticType(tq"$MetaPackage.reifySource") final lazy val ReifyPositionAT: Type = staticType(tq"$MetaPackage.reifyPosition") final lazy val ReifyParamListCountAT: Type = staticType(tq"$MetaPackage.reifyParamListCount") final lazy val ReifyFlagsAT: Type = staticType(tq"$MetaPackage.reifyFlags") @@ -157,15 +156,15 @@ private[commons] trait MacroMetadatas extends MacroSymbols { case t if t <:< InferAT => val clue = annot.findArg[String](InferAT.member(TermName("clue")), "") new ImplicitParam(ownerConstr, paramSym, clue) - case t if t <:< ReifyAnnotAT => new ReifiedAnnotParam(ownerConstr, paramSym) + case t if t <:< ReifyAnnotAT => + new ReifiedAnnotParam(ownerConstr, paramSym) case t if t <:< ReifyNameAT => val useRawName = annot.findArg[Boolean](ReifyNameAT.member(TermName("useRawName")), false) new ReifiedNameParam(ownerConstr, paramSym, useRawName) - case t if t <:< ReifySourceAT => - new ReifiedSourceParam(ownerConstr, paramSym) case t if t <:< IsAnnotatedAT => new IsAnnotatedParam(ownerConstr, paramSym, t.typeArgs.head) - case t => reportProblem(s"metadata param strategy $t is not allowed here") + case t => + reportProblem(s"metadata param strategy $t is not allowed here") } def compositeConstructor(param: CompositeParam): MetadataConstructor @@ -344,36 +343,6 @@ private[commons] trait MacroMetadatas extends MacroSymbols { Ok(q"${if (useRawName) matchedSymbol.rawName else matchedSymbol.real.nameStr}") } - class ReifiedSourceParam(owner: MetadataConstructor, symbol: Symbol) - extends DirectMetadataParam(owner, symbol) { - - if (!(actualType =:= SymbolSourceTpe)) { - reportProblem(s"its type is not SymbolSource") - } - - def tryMaterializeFor(matchedSymbol: MatchedSymbol): Res[Tree] = { - val sym = matchedSymbol.real.symbol - sym.pos match { - case NoPosition => - FailMsg(s"source information not available for ${matchedSymbol.real.description}") - case pos => Ok { - val source = pos.source - val startPos = pos.withPoint(pos.start) - val endPos = pos.withPoint(pos.end) - q""" - $MetaPackage.SymbolSource( - ${source.path}, - ${source.file.name}, - $MetaPackage.SourceOffset(${startPos.point}, ${startPos.line}, ${startPos.column}), - $MetaPackage.SourceOffset(${endPos.point}, ${endPos.line}, ${endPos.column}), - ${new String(source.content, pos.start, pos.end - pos.start)} - ) - """ - } - } - } - } - class ParamPositionParam(owner: MetadataConstructor, symbol: Symbol) extends DirectMetadataParam(owner, symbol) { diff --git a/project/Commons.scala b/project/Commons.scala index 8f290a366..38abf7700 100644 --- a/project/Commons.scala +++ b/project/Commons.scala @@ -40,7 +40,7 @@ object Commons extends ProjectGroup("commons") { val circeVersion = "0.14.5" // benchmark only val upickleVersion = "3.1.2" // benchmark only val scalajsBenchmarkVersion = "0.10.0" - val slf4jVersion = "2.0.9" + val slf4jVersion = "2.0.9" // test only // for binary compatibility checking val previousCompatibleVersions: Set[String] = Set("2.2.4")