Skip to content

Refine isEffectivelyFinal to avoid no-owner crash #23675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ object SymDenotations {
|| is(Inline, butNot = Deferred)
|| is(JavaDefinedVal, butNot = Method)
|| isConstructor
|| !owner.isExtensibleClass && !is(Deferred)
|| exists && !owner.isExtensibleClass && !is(Deferred)
// Deferred symbols can arise through parent refinements under x.modularity.
// For them, the overriding relationship reverses anyway, so
// being in a final class does not mean the symbol cannot be
Expand Down
6 changes: 6 additions & 0 deletions tests/neg/i23637.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- [E083] Type Error: tests/neg/i23637.scala:6:9 -----------------------------------------------------------------------
6 | export foo.pin.* // error: (because we need reflection to get at foo.pin)
| ^^^^^^^
| (Test.foo.pin : Object) is not a valid export prefix, since it is not an immutable path
|
| longer explanation available when compiling with `-explain`
12 changes: 12 additions & 0 deletions tests/neg/i23637.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
trait Foo extends reflect.Selectable
object Test:
val foo = new Foo:
object pin:
val x = 1
export foo.pin.* // error: (because we need reflection to get at foo.pin)

object OK:
object Foo:
object pin:
val x = 1
export Foo.pin.*
Loading