diff --git a/compiler/src/dotty/tools/dotc/transform/init/Util.scala b/compiler/src/dotty/tools/dotc/transform/init/Util.scala index 9a1c38bcac36..144abefe4116 100644 --- a/compiler/src/dotty/tools/dotc/transform/init/Util.scala +++ b/compiler/src/dotty/tools/dotc/transform/init/Util.scala @@ -59,7 +59,11 @@ object Util: case TypeApply(fn, targs) => unapply(fn) + case ref: RefTree if ref.symbol.is(Flags.Method) => + Some((ref, Nil)) + case ref: RefTree if ref.tpe.widenSingleton.isInstanceOf[MethodicType] => + // for polymorphic method with no `apply` symbol; see tests/init/pos/interleaving-overload.scala Some((ref, Nil)) case _ => None diff --git a/tests/init-global/pos-tasty/test-safe-value.scala b/tests/init-global/pos-tasty/test-safe-value.scala new file mode 100644 index 000000000000..803c0f2e24d9 --- /dev/null +++ b/tests/init-global/pos-tasty/test-safe-value.scala @@ -0,0 +1,7 @@ +package scala.collection.immutable + +object A { // These are a safe values, so no warning should be emitted + Node.HashCodeLength + Node.BitPartitionSize + Node.MaxDepth +} \ No newline at end of file