Skip to content

Commit 4edadb2

Browse files
committed
Fix class for evaluating local methods
1 parent 13f2634 commit 4edadb2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/transform/init/Semantic.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,13 @@ class Semantic {
307307
resolve(addr.klass, meth)
308308
if target.isOneOf(Flags.Method | Flags.Lazy) then
309309
if target.hasSource then
310+
val cls = target.owner.enclosingClass.asClass
310311
if target.isPrimaryConstructor then
311-
val cls = target.owner.asClass
312312
val tpl = cls.defTree.asInstanceOf[TypeDef].rhs.asInstanceOf[Template]
313313
eval(tpl, addr, cls, cacheResult = true)(using heap, ctx, trace.add(tpl), promoted)
314314
else
315315
val rhs = target.defTree.asInstanceOf[ValOrDefDef].rhs
316-
eval(rhs, addr, target.owner.asClass, cacheResult = true)
316+
eval(rhs, addr, cls, cacheResult = true)
317317
else if addr.canIgnoreMethodCall(target) then
318318
Result(Hot, Nil)
319319
else

0 commit comments

Comments
 (0)