Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Feb 11, 2024
1 parent 1e459d2 commit ed92a7f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions unroll/plugin/src-3/UnrollPhaseScala3.scala
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class UnrollPhaseScala3() extends PluginPhase {
).setDefTree
}

def transformBodyTree(tree: Tree)(using Context): Seq[Tree] = tree match{
def generateSyntheticDefs(tree: Tree)(using Context): Seq[Tree] = tree match{
case defdef: DefDef if defdef.paramss.nonEmpty =>
import dotty.tools.dotc.core.NameOps.isConstructorName

Expand All @@ -172,7 +172,7 @@ class UnrollPhaseScala3() extends PluginPhase {

val firstValueParamClauseIndex = annotated.paramSymss.indexWhere(!_.headOption.exists(_.isType))

if (firstValueParamClauseIndex == -1) Seq(defdef)
if (firstValueParamClauseIndex == -1) Nil
else {
val paramCount = annotated.paramSymss(firstValueParamClauseIndex).size
annotated
Expand Down Expand Up @@ -208,8 +208,8 @@ class UnrollPhaseScala3() extends PluginPhase {
tmpl.derived,
tmpl.self,
tmpl.body.filter(!this.isCaseFromProduct(_)) ++
tmpl.body.flatMap(transformBodyTree) ++
transformBodyTree(tmpl.constr)
tmpl.body.flatMap(generateSyntheticDefs) ++
generateSyntheticDefs(tmpl.constr)
)
)
}
Expand Down

0 comments on commit ed92a7f

Please sign in to comment.