Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/transform/PostTyper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,10 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
case UnApply(fun, implicits, patterns) =>
// Reverse transform order for the same reason as in `app1` above.
val patterns1 = transform(patterns)
cpy.UnApply(tree)(transform(fun), transform(implicits), patterns1)
val tree1 = cpy.UnApply(tree)(transform(fun), transform(implicits), patterns1)
// The pickling of UnApply trees uses the tpe of the tree,
// so we need to clean retains from it here
tree1.withType(transformAnnotsIn(CleanupRetains()(tree1.tpe)))
case tree: TypeApply =>
if tree.symbol == defn.QuotedTypeModule_of then
ctx.compilationUnit.needsStaging = true
Expand Down
14 changes: 14 additions & 0 deletions tests/pos-custom-args/captures/i24207.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import language.experimental.captureChecking

class Generator:
private def generateTable(table: Table) =
val (ownRelations, _) = calculateOwnRelations(table)
ownRelations

private def calculateOwnRelations(table: Table) =
val ownRelations = table.relations.filter(_.association.isDefined)
(ownRelations, Nil)

case class Table(relations: Seq[TableRelation])
case class TableRelation(association: Option[Association])
trait Association
12 changes: 12 additions & 0 deletions tests/pos/i24207.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Generator:
private def generateTable(table: Table) =
val (ownRelations, _) = calculateOwnRelations(table)
ownRelations

private def calculateOwnRelations(table: Table) =
val ownRelations = table.relations.filter(_.association.isDefined)
(ownRelations, Nil)

case class Table(relations: Seq[TableRelation])
case class TableRelation(association: Option[Association])
trait Association
Loading