Skip to content

Commit 6fdf256

Browse files
authored
Merge pull request #556 from scala/backport-lts-3.3-23675
Backport "Refine isEffectivelyFinal to avoid no-owner crash" to 3.3 LTS
2 parents 023e01d + cac9398 commit 6fdf256

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ object SymDenotations {
11851185
|| is(Inline, butNot = Deferred)
11861186
|| is(JavaDefinedVal, butNot = Method)
11871187
|| isConstructor
1188-
|| !owner.isExtensibleClass
1188+
|| exists && !owner.isExtensibleClass
11891189

11901190
/** A class is effectively sealed if has the `final` or `sealed` modifier, or it
11911191
* is defined in Scala 3 and is neither abstract nor open.

tests/neg/i23637.check

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- [E083] Type Error: tests/neg/i23637.scala:6:9 -----------------------------------------------------------------------
2+
6 | export foo.pin.* // error: (because we need reflection to get at foo.pin)
3+
| ^^^^^^^
4+
| (Test.foo.pin : Object) is not a valid export prefix, since it is not an immutable path
5+
|
6+
| longer explanation available when compiling with `-explain`

tests/neg/i23637.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
trait Foo extends reflect.Selectable
2+
object Test:
3+
val foo = new Foo:
4+
object pin:
5+
val x = 1
6+
export foo.pin.* // error: (because we need reflection to get at foo.pin)
7+
8+
object OK:
9+
object Foo:
10+
object pin:
11+
val x = 1
12+
export Foo.pin.*

0 commit comments

Comments
 (0)