Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4bbd5b3

Browse files
fix: avoid cyclic initialisation *warning* between Predef, Manifest and ManifestFactory (#23903)
With the new stdlib fully compiled with Scala 3, 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 ] ``` Since `Predef.classOf` is magic, we can safely ignore these fields in the init checker.
2 parents c4c48e3 + 005332d commit 4bbd5b3

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)

AltStyle によって変換されたページ (->オリジナル) /