Skip to content
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

Constructor companion gets privateWithin #22627

Merged
merged 1 commit into from
Feb 21, 2025

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
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
2 participants