Skip to content

Commit 4d2a084

Browse files
committed
Ignore false warnings for Java & Scala 2
1 parent 025e007 commit 4d2a084

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,15 +664,15 @@ object Objects:
664664
else
665665
errorReadOtherStaticObject(State.currentObject, addr.owner)
666666
Bottom
667-
else if ref.isObjectRef then
667+
else if ref.isObjectRef && ref.klass.hasSource then
668668
report.warning("Access uninitialized field " + field.show + ". Call trace: " + Trace.show, Trace.position)
669669
Bottom
670670
else
671671
// initialization error, reported by the initialization checker
672672
Bottom
673673
else if ref.hasVal(target) then
674674
ref.valValue(target)
675-
else if ref.isObjectRef then
675+
else if ref.isObjectRef && ref.klass.hasSource then
676676
report.warning("Access uninitialized field " + field.show + ". Call trace: " + Trace.show, Trace.position)
677677
Bottom
678678
else

0 commit comments

Comments
 (0)