Skip to content

Commit 98002e7

Browse files
committed
Fix extractor for closureDef
The method name is not an invariant: dotc -d out -Ycheck-init tests/pos/i4350.scala
1 parent 923173a commit 98002e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
630630
/** An extractor for def of a closure contained the block of the closure. */
631631
object closureDef {
632632
def unapply(tree: Tree)(implicit ctx: Context): Option[DefDef] = tree match {
633-
case Block((meth @ DefDef(nme.ANON_FUN, _, _, _, _)) :: Nil, closure: Closure) =>
633+
case Block((meth : DefDef) :: Nil, closure: Closure) if meth.symbol == closure.meth.symbol =>
634634
Some(meth)
635635
case Block(Nil, expr) =>
636636
unapply(expr)

0 commit comments

Comments
 (0)