Skip to content

Commit 2cf07b3

Browse files
committed
Compare owner instead of owner name
1 parent 1ab7ddb commit 2cf07b3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,14 +707,14 @@ object Objects:
707707
given Env.Data = Env.of(ddef, args.map(_.value), env)
708708
extendTrace(code) { eval(ddef.rhs, thisV, klass, cacheResult = true) }
709709
else
710-
meth.owner.asType.name match
711710
// The methods defined in `Any` and `AnyRef` are trivial and don't affect initialization.
712-
case tpnme.Any | tpnme.AnyRef =>
711+
if meth.owner == defn.AnyClass || meth.owner == defn.ObjectClass then
713712
value
714-
case _ =>
713+
else
715714
// In future, we will have Tasty for stdlib classes and can abstractly interpret that Tasty.
716715
// For now, return `Cold` to ensure soundness and trigger a warning.
717716
Cold
717+
end if
718718
end if
719719

720720
case _ =>

0 commit comments

Comments
 (0)