From 76ae6092d405e774fa82f7618f0eac76d8a066bd Mon Sep 17 00:00:00 2001 From: EnzeXing Date: Thu, 29 Aug 2024 15:32:37 -0400 Subject: [PATCH 1/2] analyze object when selecting from package --- .../src/dotty/tools/dotc/transform/init/Objects.scala | 2 +- tests/init-global/warn/cyclic-object.scala | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/init-global/warn/cyclic-object.scala diff --git a/compiler/src/dotty/tools/dotc/transform/init/Objects.scala b/compiler/src/dotty/tools/dotc/transform/init/Objects.scala index 1050fbe85ef2..12a1ba3a0642 100644 --- a/compiler/src/dotty/tools/dotc/transform/init/Objects.scala +++ b/compiler/src/dotty/tools/dotc/transform/init/Objects.scala @@ -864,7 +864,7 @@ class Objects(using Context @constructorOnly): Bottom case Bottom => - if field.isStaticObject then ObjectRef(field.moduleClass.asClass) + if field.isStaticObject then accessObject(field.moduleClass.asClass) else Bottom case ValueSet(values) => diff --git a/tests/init-global/warn/cyclic-object.scala b/tests/init-global/warn/cyclic-object.scala new file mode 100644 index 000000000000..e997d3259877 --- /dev/null +++ b/tests/init-global/warn/cyclic-object.scala @@ -0,0 +1,9 @@ +package cyclicObject + +object O1 { // warn + val o = cyclicObject.O2 +} + +object O2 { + val o = cyclicObject.O1 +} From 3416509a0bc6fa42f5fed33f795c6bcd622ce3e6 Mon Sep 17 00:00:00 2001 From: EnzeXing Date: Sat, 31 Aug 2024 16:16:04 -0400 Subject: [PATCH 2/2] Update init-global-scala2-library-tasty blacklist --- .../neg-init-global-scala2-library-tasty.blacklist | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/compiler/test/dotc/neg-init-global-scala2-library-tasty.blacklist b/compiler/test/dotc/neg-init-global-scala2-library-tasty.blacklist index 93e6cd5b4ebc..48fe29ebc6bc 100644 --- a/compiler/test/dotc/neg-init-global-scala2-library-tasty.blacklist +++ b/compiler/test/dotc/neg-init-global-scala2-library-tasty.blacklist @@ -5,3 +5,16 @@ unapplySeq-implicit-arg.scala unapplySeq-implicit-arg2.scala unapplySeq-implicit-arg3.scala ScalaCheck.scala +mutable-read8.scala +TypeCast.scala +global-cycle8.scala +global-cycle6.scala +i12544b.scala +t9360.scala +mutable-array.scala +patmat-unapplySeq2.scala +line-spacing.scala +global-list.scala +t5366.scala +mutable-read7.scala +t9115.scala