Skip to content

Commit 8527a9b

Browse files
EnzeXingEnzeXing
and
EnzeXing
authored
Adds special treatment to Predef.classOf (#21523)
This is an updated PR of #20945, making the global initialization checker skips the analysis of `Predef.classOf` in scala2-library, since it is a stub method in tasty and is replaced by actual class representations in the backend. This prevents related warnings when running test_scala2_library_tasty. --------- Co-authored-by: EnzeXing <[email protected]>
1 parent 5e83606 commit 8527a9b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,9 @@ class Objects(using Context @constructorOnly):
702702
val arr = OfArray(State.currentObject, summon[Regions.Data])
703703
Heap.writeJoin(arr.addr, args.map(_.value).join)
704704
arr
705+
else if target.equals(defn.Predef_classOf) then
706+
// Predef.classOf is a stub method in tasty and is replaced in backend
707+
Bottom
705708
else if target.hasSource then
706709
val cls = target.owner.enclosingClass.asClass
707710
val ddef = target.defTree.asInstanceOf[DefDef]

0 commit comments

Comments
 (0)