Skip to content

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Sep 27, 2025

Since SIP 71 is now accepted, we can ship it as -preview in 3.8 and standard in 3.9.

Note to tooling implementers

There are two relevant pieces that need to be implemented in IDEs:

  • into is a new soft modifier for classes, traits, and enums. Types with into are legal conversion target types. See isConversionTargetType in Types.scala.
  • The Conversion.into type is a regular opaque type, so should not need any support by itself. However, there's a rule that no-flip covariant occurrences of into[T] in method parameters are mapped toT @$into, where $into is an annotation in annotation.internal. The annotation is "silent" which means it should not be shown in inferred types. The purpose of that mapping is that into[...] does not have to be explicitly stripped in method bodies. See suppressInto and revealInto in TypeOps.

/cc @unkarjedy @tgodzik

@odersky odersky requested a review from a team as a code owner September 27, 2025 10:32
* `T`. Hence, we don't need to use `.underlying` to go from an into type to its
* underlying type in the types of local parameters.
*/
@experimental
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it now use @scala.annotation.internal.preview annotation instead of making it stable?

Copy link
Member

Choose a reason for hiding this comment

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

This is not really needed. It is an internal annotation that people will not use manually.

Copy link
Member

Choose a reason for hiding this comment

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

Well, even then. In theory it's part of a preview feature, and could be altered. (Very very unlikely in this case, but let's follow the procedure, so that the next person who comes to this PR in search for a reference of how a feature becomes preview doesn't get misled.)

Copy link
Member

Choose a reason for hiding this comment

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

I agree, if we were to be pedantic, we should put it. I just claimed that from an implementation point of view, it is not really needed.

* @see [[https://dotty.epfl.ch/docs/reference/experimental/into-modifier]]
*/
@compileTimeOnly("`into` can only be used at compile time in import statements")
@deprecated("The into language import is no longer needed since the feature is now standard", since = "3.9")
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this one, and how it should be handled. From the perspective of user it would be better to now get hint about preview, and standard when it's actually standardised in 3.9 or later

Suggested change
@deprecated("The into language import is no longer needed since the feature is now standard", since = "3.9")
@deprecated("The into language import is no longer needed since the feature is now in preview", since = "3.9")

Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps hint about preview since 3.8...
and standard whenever we stabilise

Copy link
Member

Choose a reason for hiding this comment

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

We should not say since 3.9.0 in 3.8.0. It makes no sense. I think we should say (preview, 3.8.0) and change it to (stable, 3.9.0) later or say directly (stable, 3.8.0).

@tgodzik tgodzik added the needs-minor-release This PR cannot be merged until the next minor release label Sep 29, 2025
* `T`. Hence, we don't need to use `.underlying` to go from an into type to its
* underlying type in the types of local parameters.
*/
@experimental
Copy link
Member

Choose a reason for hiding this comment

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

This is not really needed. It is an internal annotation that people will not use manually.

* @see [[https://dotty.epfl.ch/docs/reference/experimental/into-modifier]]
*/
@compileTimeOnly("`into` can only be used at compile time in import statements")
@deprecated("The into language import is no longer needed since the feature is now standard", since = "3.9")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@deprecated("The into language import is no longer needed since the feature is now standard", since = "3.9")
@deprecated("The into language import is no longer needed since the feature is now standard", since = "3.8.0")

* @see [[https://dotty.epfl.ch/docs/reference/experimental/into-modifier]]
*/
@compileTimeOnly("`into` can only be used at compile time in import statements")
@deprecated("The into language import is no longer needed since the feature is now standard", since = "3.9")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@deprecated("The into language import is no longer needed since the feature is now standard", since = "3.9")
@deprecated("The into language import is no longer needed since the feature is now standard", since = "3.8.0")

Comment on lines 231 to 232
TRACKED
INTO -- a tracked class parameter / a dependent class
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
TRACKED
INTO -- a tracked class parameter / a dependent class
TRACKED -- a tracked class parameter / a dependent class
INTO

* conversions are tried from the type of `t` to `T`. `into[T]` types are erased to `T`
* in all covariant positions of the types of parameter symbols.
*/
@experimental
Copy link
Member

Choose a reason for hiding this comment

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

This one is important, if we don't mark this alias with @preview, we will not be able to enforce it.


/** Unwrap an `into` */
extension [T](x: into[T])
@experimental def underlying: T = x
Copy link
Member

Choose a reason for hiding this comment

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

This one should also be marked as @preview, otherwise we will be compiling the library with -preview

 - Make all aspects of into a -preview feature
 - Drop experimental import in tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-minor-release This PR cannot be merged until the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants