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

Scala 2.13.12 #492

Merged
merged 11 commits into from
Oct 18, 2023
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11]
scala: [2.13.12]
java: [temurin@11, temurin@17]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11]
scala: [2.13.12]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SharedExtensionsTest extends AnyFunSuite with Matchers {
}

test("sourceCode") {
// for some magical reason does not work on 'Int' type in Scala 2.13.11:
// for some magical reason does not work on 'Int' type in Scala 2.13.12:
// java.lang.NullPointerException: Cannot invoke "scala.reflect.internal.Symbols$Symbol.owner()" because the return value of "scala.reflect.internal.Trees$Tree.symbol()" is null
// scala.tools.nsc.typechecker.Typers$Typer.checkDubiousAdaptation$1(Typers.scala:5330)
// assert(123.sourceCode == "123")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,6 @@ object CodecTestData {
override def hashCode(): Int = args.hashCode()
}

trait Framework {
type Field

case class Stuff(field: Field)
}

trait BetterFramework extends Framework {
implicit def fieldCodec: GenCodec[Field]

implicit val stuffCodec: GenCodec[Stuff] = GenCodec.materialize
}

object SomeObject {
@generated def random: Int = 42
implicit val codec: GenCodec[SomeObject.type] = GenCodec.materialize[SomeObject.type]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {

Expand Down
4 changes: 2 additions & 2 deletions project/Commons.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -69,7 +69,7 @@ object Commons extends ProjectGroup("commons") {
Developer("ghik", "Roman Janusz", "[email protected]", url("https://github.com/ghik")),
),

scalaVersion := "2.13.11",
scalaVersion := "2.13.12",
compileOrder := CompileOrder.Mixed,

githubWorkflowTargetTags ++= Seq("v*"),
Expand Down
Loading