Skip to content

Commit 005332d

Browse files
committed
fix: avoid cyclic initialisation between Predef, Manifest and ManifestFactory
We get the following warning in the test suite before this change ```scala at 109: Cyclic initialization: object Predef -> object Manifest -> object ManifestFactory -> object Predef. Calling trace: ├── object Manifest { [ Manifest.scala:76 ] │ ^ ├── val Byte: ManifestFactory.ByteManifest = ManifestFactory.Byte [ Manifest.scala:86 ] │ ^^^^^^^^^^^^^^^ ├── object Predef extends LowPriorityImplicits { [ Predef.scala:109 ] │ ^ ├── val Manifest = scala.reflect.Manifest [ Predef.scala:210 ] │ ^^^^^^^^^^^^^^^^^^^^^^ ├── object ManifestFactory { [ Manifest.scala:171 ] │ ^ └── private[this] val ObjectTYPE = classOf[java.lang.Object] [ Manifest.scala:323 ] ```
1 parent fbbae09 commit 005332d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ class Objects(using Context @constructorOnly):
7676
val HashMap_EmptyMap: Symbol = immutableHashMap.requiredValue("EmptyMap")
7777
val immutableLazyList: Symbol = requiredModule("scala.collection.immutable.LazyList")
7878
val LazyList_empty: Symbol = immutableLazyList.requiredValue("_empty")
79+
val ManifestFactory_ObjectTYPE = defn.ManifestFactoryModule.requiredValue("ObjectTYPE")
80+
val ManifestFactory_NothingTYPE = defn.ManifestFactoryModule.requiredValue("NothingTYPE")
81+
val ManifestFactory_NullTYPE = defn.ManifestFactoryModule.requiredValue("NullTYPE")
7982

80-
val allowList: Set[Symbol] = Set(SetNode_EmptySetNode, HashSet_EmptySet, Vector_EmptyIterator, MapNode_EmptyMapNode, HashMap_EmptyMap, LazyList_empty)
83+
val allowList: Set[Symbol] = Set(SetNode_EmptySetNode, HashSet_EmptySet, Vector_EmptyIterator, MapNode_EmptyMapNode, HashMap_EmptyMap, LazyList_empty,
84+
ManifestFactory_ObjectTYPE, ManifestFactory_NothingTYPE, ManifestFactory_NullTYPE)
8185

8286
// ----------------------------- abstract domain -----------------------------
8387

0 commit comments

Comments
 (0)