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
7 changes: 5 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/PostTyper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,11 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
case _ =>
processMemberDef(super.transform(scala2LibPatch(tree)))
case tree: Bind =>
if tree.symbol.isType && !tree.symbol.name.is(WildcardParamName) then
Checking.checkGoodBounds(tree.symbol)
val sym = tree.symbol
if sym.isType && !sym.name.is(WildcardParamName) then
Checking.checkGoodBounds(sym)
// Cleanup retains from the info of the Bind symbol
sym.copySymDenotation(info = transformAnnotsIn(CleanupRetains()(sym.info))).installAfter(thisPhase)
super.transform(tree)
case tree: New if isCheckable(tree) =>
Checking.checkInstantiable(tree.tpe, tree.tpe, tree.srcPos)
Expand Down
14 changes: 14 additions & 0 deletions tests/pos-custom-args/captures/i24456.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Similar to i24207

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

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
14 changes: 14 additions & 0 deletions tests/pos/i24456.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Similar to i24207

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

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