Skip to content

Commit 8d63015

Browse files
Merge pull request #8812 from dotty-staging/fix-#8801
Fix #8801: Update registeredCompanion when mapping symbols
2 parents c04b865 + 97bb1c1 commit 8d63015

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

compiler/src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import util.Spans._
1717
import DenotTransformers._
1818
import StdNames._
1919
import NameOps._
20+
import transform.SymUtils._
2021
import NameKinds.LazyImplicitName
2122
import ast.tpd
2223
import tpd.{Tree, TreeProvider, TreeOps}
@@ -351,6 +352,8 @@ trait Symbols { thisCtx: Context =>
351352
info = completer,
352353
privateWithin = ttmap1.mapOwner(odenot.privateWithin), // since this refers to outer symbols, need not include copies (from->to) in ownermap here.
353354
annotations = odenot.annotations)
355+
copy.registeredCompanion =
356+
copy.registeredCompanion.subst(originals, copies)
354357
}
355358

356359
copies.foreach(_.ensureCompleted()) // avoid memory leak

tests/pos/i8801.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
object Foo:
2+
locally {
3+
case class Baz()
4+
}
5+
6+
class Foo2 {
7+
def foo(x: Any = 3, y: Any = 9): Any = x
8+
val a = foo(y = { case class Bar(x: Int) }, x = ())
9+
}

0 commit comments

Comments
 (0)