Skip to content

Commit 6f7c997

Browse files
committed
some more infrastructure for macro profiling
1 parent cfdfb8b commit 6f7c997

File tree

18 files changed

+169
-130
lines changed

18 files changed

+169
-130
lines changed

build.sbt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,16 +364,17 @@ lazy val `commons-comprof` = project
364364
s"-P:scalac-profiling:sourceroot:${baseDirectory.value}",
365365
"-P:scalac-profiling:generate-macro-flamegraph",
366366
"-P:scalac-profiling:no-profiledb",
367-
"-Ystatistics",
367+
"-Xmacro-settings:statsEnabled",
368+
"-Ystatistics:typer",
368369
),
369370
sourceGenerators in Compile += Def.task {
370-
val originalSrc = (sourceDirectory in `commons-core`).value /
371-
"main/scala/com/avsystem/commons/rest/openapi/OpenApi.scala"
371+
val originalSrc = (sourceDirectory in `commons-core`).value /
372+
"test/scala/com/avsystem/commons/rest/RestTestApi.scala"
372373
val originalContent = IO.read(originalSrc)
373-
(0 until 10).map { i =>
374+
(0 until 100).map { i =>
374375
val pkg = f"oa$i%02d"
375-
val newContent = originalContent.replaceAllLiterally("package rest.openapi", s"package rest.$pkg")
376-
val newFile = (sourceManaged in Compile).value / pkg / "OpenApi.scala"
376+
val newContent = originalContent.replaceAllLiterally("package rest", s"package rest\npackage $pkg")
377+
val newFile = (sourceManaged in Compile).value / pkg / "RestTestApi.scala"
377378
IO.write(newFile, newContent)
378379
newFile
379380
}

commons-core/src/test/scala/com/avsystem/commons/rest/RestTestApi.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ object FlatBaseEntity extends RestDataCompanion[FlatBaseEntity]
1717
@description("REST entity")
1818
case class RestEntity(
1919
@description("entity id") id: String,
20-
@whenAbsent("anonymous") name: String = whenAbsent.debugMacro.value,
20+
@whenAbsent("anonymous") name: String = whenAbsent.value,
2121
@description("recursive optional subentity") subentity: OptArg[RestEntity] = OptArg.Empty
2222
) extends FlatBaseEntity
2323
object RestEntity extends RestDataCompanion[RestEntity]

commons-macros/src/main/scala/com/avsystem/commons/macros/MacroCommons.scala

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ trait MacroCommons { bundle =>
4848
final lazy val MapSym = typeOf[scala.collection.immutable.Map[_, _]].typeSymbol
4949
final lazy val FutureSym = typeOf[scala.concurrent.Future[_]].typeSymbol
5050
final lazy val OptionClass = definitions.OptionClass
51-
final lazy val AnnotationAggregateType = getType(tq"$CommonsPkg.annotation.AnnotationAggregate")
52-
final lazy val DefaultsToNameAT = getType(tq"$CommonsPkg.annotation.defaultsToName")
53-
final lazy val InferAT: Type = getType(tq"$CommonsPkg.meta.infer")
54-
final lazy val NotInheritedFromSealedTypes = getType(tq"$CommonsPkg.annotation.NotInheritedFromSealedTypes")
51+
final lazy val AnnotationAggregateType = staticType(tq"$CommonsPkg.annotation.AnnotationAggregate")
52+
final lazy val DefaultsToNameAT = staticType(tq"$CommonsPkg.annotation.defaultsToName")
53+
final lazy val InferAT: Type = staticType(tq"$CommonsPkg.meta.infer")
54+
final lazy val NotInheritedFromSealedTypes = staticType(tq"$CommonsPkg.annotation.NotInheritedFromSealedTypes")
5555
final lazy val SeqCompanionSym = typeOf[scala.collection.Seq.type].termSymbol
56-
final lazy val PositionedAT = getType(tq"$CommonsPkg.annotation.positioned")
57-
final lazy val ImplicitNotFoundAT = getType(tq"$ScalaPkg.annotation.implicitNotFound")
58-
final lazy val ImplicitNotFoundSym = getType(tq"$MiscPkg.ImplicitNotFound[_]").typeSymbol
56+
final lazy val PositionedAT = staticType(tq"$CommonsPkg.annotation.positioned")
57+
final lazy val ImplicitNotFoundAT = staticType(tq"$ScalaPkg.annotation.implicitNotFound")
58+
final lazy val ImplicitNotFoundSym = staticType(tq"$MiscPkg.ImplicitNotFound[_]").typeSymbol
5959

6060
final lazy val NothingTpe: Type = typeOf[Nothing]
6161
final lazy val StringPFTpe: Type = typeOf[PartialFunction[String, Any]]
@@ -72,12 +72,12 @@ trait MacroCommons { bundle =>
7272
definitions.ScalaPackageClass.toType.member(TermName("scalajs")) != NoSymbol
7373

7474
final lazy val ownerChain = {
75-
val sym = c.typecheck(q"val ${c.freshName(TermName(""))} = null").symbol
75+
val sym = typecheck(q"val ${c.freshName(TermName(""))} = null").symbol
7676
Iterator.iterate(sym)(_.owner).takeWhile(_ != NoSymbol).drop(1).toList
7777
}
7878

7979
final lazy val enclosingClasses = {
80-
val enclosingSym = c.typecheck(q"this", silent = true) match {
80+
val enclosingSym = typecheck(q"this", silent = true) match {
8181
case EmptyTree => Iterator.iterate(c.internal.enclosingOwner)(_.owner).find(_.isModuleClass).get
8282
case tree => tree.tpe.typeSymbol
8383
}
@@ -89,16 +89,51 @@ trait MacroCommons { bundle =>
8989
case _ => false
9090
}
9191

92+
final val statsEnabled: Boolean =
93+
c.settings.contains("statsEnabled")
94+
9295
def debug(msg: => String): Unit =
9396
if (debugEnabled) {
9497
error(msg)
9598
}
9699

97-
def showOnDebug(tree: Tree): Tree = {
98-
debug(show(tree))
99-
tree
100+
def instrument(tree: => Tree): Tree = measure(c.macroApplication.symbol.fullName) {
101+
val result = tree
102+
debug(show(result))
103+
result
100104
}
101105

106+
private[this] var measureStack = List.empty[String]
107+
108+
def measure[T](what: String)(expr: => T): T =
109+
if (!statsEnabled || measureStack.contains(what)) expr else {
110+
measureStack ::= what
111+
val start = System.nanoTime()
112+
try expr finally {
113+
echo(s"$what ${(System.nanoTime() - start) / 1000}")
114+
measureStack = measureStack.tail
115+
}
116+
}
117+
118+
def inferImplicitValue(
119+
pt: Type,
120+
silent: Boolean = true,
121+
withMacrosDisabled: Boolean = false,
122+
pos: Position = c.enclosingPosition
123+
): Tree = {
124+
debug(s"macro implicit search for $pt")
125+
measure("implicit")(c.inferImplicitValue(pt, silent, withMacrosDisabled, pos))
126+
}
127+
128+
def typecheck(
129+
tree: Tree,
130+
mode: c.TypecheckMode = c.TERMmode,
131+
pt: Type = WildcardType,
132+
silent: Boolean = false,
133+
withImplicitViewsDisabled: Boolean = false,
134+
withMacrosDisabled: Boolean = false
135+
): Tree = measure("typecheck")(c.typecheck(tree, mode, pt, silent, withImplicitViewsDisabled, withMacrosDisabled))
136+
102137
def containsInaccessibleThises(tree: Tree): Boolean = tree.exists {
103138
case t@This(_) if !t.symbol.isPackageClass && !enclosingClasses.contains(t.symbol) => true
104139
case _ => false
@@ -232,7 +267,8 @@ trait MacroCommons { bundle =>
232267
if (withSupers) withSuperSymbols(s) else Iterator(s)
233268

234269
def allAnnotations(s: Symbol, tpeFilter: Type,
235-
seenFrom: Type = NoType, withInherited: Boolean = true, fallback: List[Tree] = Nil): List[Annot] = {
270+
seenFrom: Type = NoType, withInherited: Boolean = true, fallback: List[Tree] = Nil
271+
): List[Annot] = measure("annotations") {
236272

237273
val initSym = orConstructorParam(s)
238274
def inherited(annot: Annotation, superSym: Symbol): Boolean =
@@ -247,8 +283,8 @@ trait MacroCommons { bundle =>
247283
}
248284

249285
def findAnnotation(s: Symbol, tpe: Type,
250-
seenFrom: Type = NoType, withInherited: Boolean = true, fallback: List[Tree] = Nil): Option[Annot] = {
251-
286+
seenFrom: Type = NoType, withInherited: Boolean = true, fallback: List[Tree] = Nil
287+
): Option[Annot] = measure("annotations") {
252288
val initSym = orConstructorParam(s)
253289
def find(annots: List[Annot]): Option[Annot] = annots match {
254290
case head :: tail =>
@@ -283,7 +319,7 @@ trait MacroCommons { bundle =>
283319
ownerChain.filter(_.isConstructor).map(_.owner.asClass.module).find(_ != NoSymbol).getOrElse(NoSymbol)
284320

285321
lazy val companionReplacement: Symbol =
286-
c.typecheck(q"$companionReplacementName", silent = true) match {
322+
typecheck(q"$companionReplacementName", silent = true) match {
287323
case EmptyTree => NoSymbol
288324
case _ => enclosingConstructorCompanion
289325
}
@@ -371,7 +407,7 @@ trait MacroCommons { bundle =>
371407

372408
def tryInferCachedImplicit(tpe: Type): Option[TermName] = {
373409
def compute: Option[TermName] =
374-
Option(c.inferImplicitValue(tpe)).filter(_ != EmptyTree).map { found =>
410+
Option(inferImplicitValue(tpe)).filter(_ != EmptyTree).map { found =>
375411
def newCachedImplicit(): TermName = {
376412
val name = c.freshName(TermName("cachedImplicit"))
377413
inferredImplicitTypes(name) = found.tpe
@@ -456,7 +492,7 @@ trait MacroCommons { bundle =>
456492
}
457493

458494
def implicitNotFoundMsg(tpe: Type): String =
459-
implicitNotFoundMsg(Nil, tpe, c.inferImplicitValue(getType(tq"$ImplicitNotFoundCls[$tpe]")))
495+
implicitNotFoundMsg(Nil, tpe, inferImplicitValue(getType(tq"$ImplicitNotFoundCls[$tpe]")))
460496

461497
class treeOps[T <: Tree](t: T) {
462498
def debug: T = {
@@ -512,7 +548,7 @@ trait MacroCommons { bundle =>
512548
def warning(msg: String): Unit =
513549
c.warning(c.enclosingPosition, msg)
514550

515-
def ensure(condition: Boolean, msg: String): Unit =
551+
def ensure(condition: Boolean, msg: => String): Unit =
516552
if (!condition) {
517553
abort(msg)
518554
}
@@ -583,8 +619,11 @@ trait MacroCommons { bundle =>
583619
}
584620
}
585621

622+
def staticType(tpeTree: Tree): Type =
623+
getType(tpeTree)
624+
586625
def getType(typeTree: Tree): Type =
587-
c.typecheck(typeTree, c.TYPEmode).tpe
626+
measure("typecheck.getType")(typecheck(typeTree, c.TYPEmode).tpe)
588627

589628
def pathTo(sym: Symbol): Tree =
590629
if (enclosingClasses.contains(sym)) This(sym)
@@ -937,7 +976,7 @@ trait MacroCommons { bundle =>
937976
def applyUnapplyFor(tpe: Type): Option[ApplyUnapply] =
938977
typedCompanionOf(tpe).flatMap(comp => applyUnapplyFor(tpe, comp))
939978

940-
def applyUnapplyFor(tpe: Type, typedCompanion: Tree): Option[ApplyUnapply] = {
979+
def applyUnapplyFor(tpe: Type, typedCompanion: Tree): Option[ApplyUnapply] = measure("applyUnapplyFor") {
941980
val dtpe = tpe.dealias
942981
val ts = dtpe.typeSymbol.asType
943982
val caseClass = ts.isClass && ts.asClass.isCaseClass
@@ -990,7 +1029,7 @@ trait MacroCommons { bundle =>
9901029
}
9911030
}
9921031

993-
def singleValueFor(tpe: Type): Option[Tree] = tpe match {
1032+
def singleValueFor(tpe: Type): Option[Tree] = measure("singleValueFor")(tpe match {
9941033
case ThisType(sym) if enclosingClasses.contains(sym) =>
9951034
Some(This(sym))
9961035
case ThisType(sym) if sym.isModuleClass =>
@@ -1007,15 +1046,15 @@ trait MacroCommons { bundle =>
10071046
singleValueFor(pre).map(prefix => Select(prefix, sym.asClass.module))
10081047
case _ =>
10091048
None
1010-
}
1049+
})
10111050

10121051
def typedCompanionOf(tpe: Type): Option[Tree] = {
10131052
val result = tpe match {
10141053
case TypeRef(pre, sym, _) if sym.companion != NoSymbol =>
10151054
singleValueFor(pre).map(Select(_, sym.companion)) orElse singleValueFor(tpe.companion)
10161055
case _ => singleValueFor(tpe.companion)
10171056
}
1018-
result.map(c.typecheck(_))
1057+
result.map(typecheck(_))
10191058
}
10201059

10211060
def typeOfTypeSymbol(sym: TypeSymbol): Type = sym.toType match {
@@ -1056,7 +1095,7 @@ trait MacroCommons { bundle =>
10561095
s"it resides in separate file than macro invocation and has no @positioned annotation")
10571096
})
10581097

1059-
def knownSubtypes(tpe: Type, ordered: Boolean = false): Option[List[Type]] = {
1098+
def knownSubtypes(tpe: Type, ordered: Boolean = false): Option[List[Type]] = measure("knownSubtypes") {
10601099
val dtpe = tpe.dealias
10611100
val (tpeSym, refined) = dtpe match {
10621101
case RefinedType(List(single), scope) =>
@@ -1093,7 +1132,7 @@ trait MacroCommons { bundle =>
10931132
val methodName = c.freshName(TermName("m"))
10941133
val typeDefs = typeParams.map(typeSymbolToTypeDef(_, forMethod = true))
10951134

1096-
val tree = c.typecheck(
1135+
val tree = typecheck(
10971136
q"""
10981137
def $methodName[..$typeDefs](f: ${treeForType(undetTpe)} => $UnitCls): $UnitCls = ()
10991138
$methodName((_: $detTpe) => ())

commons-macros/src/main/scala/com/avsystem/commons/macros/TestMacros.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class TestMacros(val c: blackbox.Context) extends TypeClassDerivation {
5656
q"$PredefObj.???"
5757
}
5858

59-
def testKnownSubtypes[T: WeakTypeTag, R: WeakTypeTag]: Tree = showOnDebug {
59+
def testKnownSubtypes[T: WeakTypeTag, R: WeakTypeTag]: Tree = instrument {
6060
val expectedResultTpe = knownSubtypes(weakTypeOf[T])
6161
.map(types => getType(tq"(..$types)"))
6262
.getOrElse(typeOf[Nothing])
@@ -67,7 +67,7 @@ class TestMacros(val c: blackbox.Context) extends TypeClassDerivation {
6767

6868
val ApplierUnapplierCls = tq"$CommonsPkg.macros.ApplierUnapplier"
6969

70-
def applierUnapplier[T: WeakTypeTag, F: WeakTypeTag]: Tree = showOnDebug {
70+
def applierUnapplier[T: WeakTypeTag, F: WeakTypeTag]: Tree = instrument {
7171
val ttpe = weakTypeOf[T]
7272
val ftpe = weakTypeOf[F]
7373

commons-macros/src/main/scala/com/avsystem/commons/macros/TypeClassDerivation.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,15 @@ trait TypeClassDerivation extends MacroCommons {
197197
}
198198
}
199199

200-
def materialize[T: WeakTypeTag]: Tree = showOnDebug {
200+
def materialize[T: WeakTypeTag]: Tree = instrument {
201201
val tpe = weakTypeOf[T]
202202
withRecursiveImplicitGuard(tpe, materializeFor(tpe))
203203
}
204204

205205
def materializeImplicitly[T: WeakTypeTag](allow: Tree): Tree =
206-
showOnDebug(materialize[T])
206+
instrument(materialize[T])
207207

208-
def materializeMacroGenerated[T: WeakTypeTag]: Tree = showOnDebug {
208+
def materializeMacroGenerated[T: WeakTypeTag]: Tree = instrument {
209209
val tpe = weakTypeOf[T].dealias
210210
val companionTpe = c.macroApplication.tpe.dealias.typeArgs.head
211211
val tcTpe = typeClassInstance(tpe)

commons-macros/src/main/scala/com/avsystem/commons/macros/meta/AdtMetadataMacros.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ class AdtMetadataMacros(ctx: blackbox.Context) extends AbstractMacroCommons(ctx)
1111

1212
import c.universe._
1313

14-
final lazy val AdtParamMetadataAT: Type = getType(tq"$MetaPackage.adtParamMetadata")
15-
final lazy val AdtCaseMetadataAT: Type = getType(tq"$MetaPackage.adtCaseMetadata")
16-
final lazy val ReifyDefaultValueAT: Type = getType(tq"$MetaPackage.reifyDefaultValue")
14+
final lazy val AdtParamMetadataAT: Type = staticType(tq"$MetaPackage.adtParamMetadata")
15+
final lazy val AdtCaseMetadataAT: Type = staticType(tq"$MetaPackage.adtCaseMetadata")
16+
final lazy val ReifyDefaultValueAT: Type = staticType(tq"$MetaPackage.reifyDefaultValue")
1717

1818
sealed trait AdtSymbol extends MacroSymbol with SelfMatchedSymbol {
1919
def tpe: Type
@@ -287,7 +287,7 @@ class AdtMetadataMacros(ctx: blackbox.Context) extends AbstractMacroCommons(ctx)
287287
}
288288
}
289289

290-
def materialize[Real: WeakTypeTag]: Tree = showOnDebug {
290+
def materialize[Real: WeakTypeTag]: Tree = instrument {
291291
val adtTpe = weakTypeOf[Real].dealias
292292
val metadataTpe = c.macroApplication.tpe.dealias
293293
materializeMetadata(adtTpe, metadataTpe)
@@ -308,7 +308,7 @@ class AdtMetadataMacros(ctx: blackbox.Context) extends AbstractMacroCommons(ctx)
308308
}
309309
}
310310

311-
def materializeMacroGenerated[Real: WeakTypeTag]: Tree = showOnDebug {
311+
def materializeMacroGenerated[Real: WeakTypeTag]: Tree = instrument {
312312
val adtTpe = weakTypeOf[Real].dealias
313313
val List(companionTpe, metadataTpe) = c.macroApplication.tpe.dealias.typeArgs
314314
mkMacroGenerated(companionTpe, metadataTpe, q"${c.prefix}.materialize[$adtTpe]")

commons-macros/src/main/scala/com/avsystem/commons/macros/meta/MacroMetadatas.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ trait MacroMetadatas extends MacroSymbols {
1010
import c.universe._
1111

1212
val ParamPositionObj: Tree = q"$MetaPackage.ParamPosition"
13-
val TypedMetadataType: Type = getType(tq"$MetaPackage.TypedMetadata[_]")
14-
val MetadataParamStrategyType: Type = getType(tq"$MetaPackage.MetadataParamStrategy")
15-
val ReifyAnnotAT: Type = getType(tq"$MetaPackage.reifyAnnot")
16-
val IsAnnotatedAT: Type = getType(tq"$MetaPackage.isAnnotated[_]")
17-
val ReifyNameAT: Type = getType(tq"$MetaPackage.reifyName")
18-
val ReifyPositionAT: Type = getType(tq"$MetaPackage.reifyPosition")
19-
val ReifyFlagsAT: Type = getType(tq"$MetaPackage.reifyFlags")
20-
val CheckedAT: Type = getType(tq"$MetaPackage.checked")
21-
val ParamPositionTpe: Type = getType(tq"$MetaPackage.ParamPosition")
22-
val ParamFlagsTpe: Type = getType(tq"$MetaPackage.ParamFlags")
23-
val TypeFlagsTpe: Type = getType(tq"$MetaPackage.TypeFlags")
13+
val TypedMetadataType: Type = staticType(tq"$MetaPackage.TypedMetadata[_]")
14+
val MetadataParamStrategyType: Type = staticType(tq"$MetaPackage.MetadataParamStrategy")
15+
val ReifyAnnotAT: Type = staticType(tq"$MetaPackage.reifyAnnot")
16+
val IsAnnotatedAT: Type = staticType(tq"$MetaPackage.isAnnotated[_]")
17+
val ReifyNameAT: Type = staticType(tq"$MetaPackage.reifyName")
18+
val ReifyPositionAT: Type = staticType(tq"$MetaPackage.reifyPosition")
19+
val ReifyFlagsAT: Type = staticType(tq"$MetaPackage.reifyFlags")
20+
val CheckedAT: Type = staticType(tq"$MetaPackage.checked")
21+
val ParamPositionTpe: Type = staticType(tq"$MetaPackage.ParamPosition")
22+
val ParamFlagsTpe: Type = staticType(tq"$MetaPackage.ParamFlags")
23+
val TypeFlagsTpe: Type = staticType(tq"$MetaPackage.TypeFlags")
2424

2525
def actualMetadataType(baseMetadataType: Type, realType: Type, realTypeDesc: String, verbatim: Boolean): Res[Type] = {
2626
val (wildcards, underlying) = baseMetadataType match {

commons-macros/src/main/scala/com/avsystem/commons/macros/meta/MacroSymbols.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ trait MacroSymbols extends MacroCommons {
1515
val RpcUtils = q"$RpcPackage.RpcUtils"
1616
val OptionLikeCls = tq"$MetaPackage.OptionLike"
1717
val CanBuildFromCls = tq"$CollectionPkg.generic.CanBuildFrom"
18-
val RpcArityAT: Type = getType(tq"$MetaPackage.SymbolArity")
19-
val SingleArityAT: Type = getType(tq"$MetaPackage.single")
20-
val OptionalArityAT: Type = getType(tq"$MetaPackage.optional")
21-
val MultiArityAT: Type = getType(tq"$MetaPackage.multi")
22-
val CompositeAT: Type = getType(tq"$MetaPackage.composite")
23-
val AuxiliaryAT: Type = getType(tq"$MetaPackage.auxiliary")
24-
val AnnotatedAT: Type = getType(tq"$MetaPackage.annotated[_]")
25-
val TaggedAT: Type = getType(tq"$RpcPackage.tagged[_]")
18+
val RpcArityAT: Type = staticType(tq"$MetaPackage.SymbolArity")
19+
val SingleArityAT: Type = staticType(tq"$MetaPackage.single")
20+
val OptionalArityAT: Type = staticType(tq"$MetaPackage.optional")
21+
val MultiArityAT: Type = staticType(tq"$MetaPackage.multi")
22+
val CompositeAT: Type = staticType(tq"$MetaPackage.composite")
23+
val AuxiliaryAT: Type = staticType(tq"$MetaPackage.auxiliary")
24+
val AnnotatedAT: Type = staticType(tq"$MetaPackage.annotated[_]")
25+
val TaggedAT: Type = staticType(tq"$RpcPackage.tagged[_]")
2626
val WhenUntaggedArg: Symbol = TaggedAT.member(TermName("whenUntagged"))
2727

2828
def primaryConstructor(ownerType: Type, ownerParam: Option[MacroSymbol]): Symbol =

commons-macros/src/main/scala/com/avsystem/commons/macros/misc/BidirectionalMacro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class BidirectionalMacro(ctx: blackbox.Context) extends AbstractMacroCommons(ctx
121121
CaseDef(c.untypecheck(exprToPattern(body, boundNamesSet)), guard, c.untypecheck(patternToExpr(pattern)))
122122
}
123123

124-
val reversed = c.typecheck(Match(EmptyTree, cases.init.map(reverseCaseDef)), pt = weakTypeOf[PartialFunction[B, A]])
124+
val reversed = typecheck(Match(EmptyTree, cases.init.map(reverseCaseDef)), pt = weakTypeOf[PartialFunction[B, A]])
125125
q"($pf, $reversed)"
126126
}
127127

commons-macros/src/main/scala/com/avsystem/commons/macros/misc/DelegationMacros.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class DelegationMacros(ctx: blackbox.Context) extends AbstractMacroCommons(ctx)
1111

1212
final def DelegationCls: Tree = tq"$MiscPkg.Delegation"
1313

14-
def delegate[A: WeakTypeTag, B: WeakTypeTag](source: Tree): Tree = showOnDebug {
14+
def delegate[A: WeakTypeTag, B: WeakTypeTag](source: Tree): Tree = instrument {
1515
val targetTpe = weakTypeOf[B]
1616

1717
val targetSymbol = targetTpe.dealias.typeSymbol
@@ -54,7 +54,7 @@ class DelegationMacros(ctx: blackbox.Context) extends AbstractMacroCommons(ctx)
5454
"""
5555
}
5656

57-
def materializeDelegation[A: WeakTypeTag, B: WeakTypeTag]: Tree = showOnDebug {
57+
def materializeDelegation[A: WeakTypeTag, B: WeakTypeTag]: Tree = instrument {
5858
val targetTpe = weakTypeOf[B]
5959
val sourceTpe = weakTypeOf[A]
6060

0 commit comments

Comments
 (0)