Enable explicit-nulls and unsafeNulls by default#25461
Draft
HarrisL2 wants to merge 8 commits intoscala:mainfrom
Draft
Enable explicit-nulls and unsafeNulls by default#25461HarrisL2 wants to merge 8 commits intoscala:mainfrom
HarrisL2 wants to merge 8 commits intoscala:mainfrom
Conversation
a7fcb84 to
82f4571
Compare
34c011b to
ca8fe2e
Compare
be6217e to
6268fa4
Compare
6268fa4 to
b51acda
Compare
0f4bdab to
dc4c10f
Compare
olhotak
reviewed
Mar 27, 2026
| @deprecated(message = "This flag has no effect and will be removed in a future version.", since = "3.7.0") | ||
| val YnoKindPolymorphism: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-kind-polymorphism", "Disable kind polymorphism. (This flag has no effect)", deprecation = Deprecation.removed()) | ||
| val YexplicitNulls: Setting[Boolean] = BooleanSetting(ForkSetting, "Yexplicit-nulls", "Make reference types non-nullable. Nullable types can be expressed with unions: e.g. String|Null.") | ||
| val YexplicitNulls: Setting[Boolean] = BooleanSetting(ForkSetting, "Yexplicit-nulls", "Since explicit nulls is enabled by default, this flage now enables safe nulls for explicit-nulls") |
Contributor
There was a problem hiding this comment.
Suggested change
| val YexplicitNulls: Setting[Boolean] = BooleanSetting(ForkSetting, "Yexplicit-nulls", "Since explicit nulls is enabled by default, this flage now enables safe nulls for explicit-nulls") | |
| val YexplicitNulls: Setting[Boolean] = BooleanSetting(ForkSetting, "Yexplicit-nulls", "Since explicit nulls is enabled by default, this flag now enables safe nulls for explicit-nulls") |
Contributor
|
@WojciechMazur could you please run the Open Community Build on this PR? |
Contributor
Contributor
Author
|
karelcemus/play-redis and scalamock/scalamock are the same underlying issue in scalamock's implementation, and has been reported as an issue at scalamock/scalamock#734 |
Contributor
Author
|
neandertech/langoustine is apparently an existing bug and a fix has been proposed at #25940 |
Contributor
Author
|
All other remaining failures are not related to the changes on this branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As the next steps to enabling explicit-nulls by default, we try to enable unsafeNulls along with it. Additionally, we will add a safeNulls language option that allows safeNulls to be toggled on in desired contexts.
The reason for this seemingly redundant change is due to the nature of the explicit-nulls flag. Explicit nulls is a global change that changes the type system, making Null no longer a subtype of AnyRef. As such, it cannot be toggled on and off locally.
On the other hand, unsafeNulls is a local option that allows T | Null to be a subtype of T. Along with the safeNulls import, we will be able decide whether of not to enable safe null behavior on a file-by-file or even scope-by-scope basis.
If full-program safeNulls is desired, we would use -langauge:safeNulls to import it globally.