Skip to content

Conversation

som-snytt
Copy link
Contributor

Follow-up to #22560
Fixes #22626

When creating a companion for a constructor proxy, the companion is protected if the class is. Now it also receives the privateWithin boundary of the class, for protected[p].

@som-snytt som-snytt force-pushed the issue/22626-protected-followup branch from 11fbe4e to eea481f Compare February 20, 2025 12:06
@som-snytt
Copy link
Contributor Author

Confirmed that hkd4s compiles again, and also that it compiles using

-protected[tschuchort] class ArrayProduct(val elems: Array[Any]) extends Product:
+private[tschuchort] class ArrayProduct(val elems: Array[Any]) extends Product:

What other semantics might be expected?

@som-snytt som-snytt marked this pull request as ready for review February 20, 2025 16:42
@Gedochao Gedochao requested a review from odersky February 21, 2025 07:18
@odersky odersky merged commit 28fa050 into scala:main Feb 21, 2025
29 checks passed
@som-snytt som-snytt deleted the issue/22626-protected-followup branch February 21, 2025 14:39
@WojciechMazur WojciechMazur added this to the 3.7.0 milestone Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot create package protected class instance using apply method

3 participants