Skip to content

Make runtimeChecked a standard feature #23262

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 25, 2025

The runtimeChecked implementation was accepted in the SIP meeting of May 23, 2025. Since the feature has been around for long, and is quite uncontroversial, I think we can just merge it for 3.8. No preview phase should be needed.

We should merge this PR for 3.8 RC1.

@odersky odersky added this to the 3.8.0 milestone May 25, 2025
@odersky odersky requested a review from bishabosha May 25, 2025 09:08
@bishabosha
Copy link
Member

bishabosha commented May 25, 2025

Follow up should be to recommend this instead of @unchecked in the pattern match errors

@odersky
Copy link
Contributor Author

odersky commented May 25, 2025

@bishabosha The last commit changes the one occurrence of @unchecked in an error message that I could find. Do you know of others?

@@ -922,7 +922,7 @@ class UncheckedTypePattern(argType: Type, whyNot: String)(using Context)
i"""|Type arguments and type refinements are erased during compile time, thus it's
|impossible to check them at run-time.
|
|You can either replace the type arguments by ${hl("_")} or use `@unchecked`.
|You can either replace the type arguments by ${hl("_")} or use `.runtimeChecked`.
Copy link
Member

@bishabosha bishabosha May 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this error message is the one legitimate use for unchecked, case _: List[Int @unchecked] =>the other error message is elsewhere - but as I type this I'm not at my computer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, well spotted. I'll revert the commit.

The runtimeChecked implementation was accepted in the SIP meeting of May 23, 2025. Since the the feature has been around for long,
and is quite uncontroversial, I think we can just merge it for 3.8. No preview phase should be needed.
@odersky odersky force-pushed the enable-runtimechecked branch from 0cce292 to 057ea91 Compare May 25, 2025 10:28
@odersky odersky self-assigned this May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants