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

mutable vs. immutable Seq handling in 2.13 upgrade #3359

Closed
philvarner opened this issue Mar 11, 2021 · 1 comment
Closed

mutable vs. immutable Seq handling in 2.13 upgrade #3359

philvarner opened this issue Mar 11, 2021 · 1 comment

Comments

@philvarner
Copy link
Contributor

Is your feature request related to a problem? Please describe.

In Scala <= 2.12, a non-fqn Seq referenced the mutable structure scala.collection.Seq[+A]. As of 2.13, this changed so it now references the immutable scala.collection.immutable.Seq[A]. To compile against 2.13, some change needs to be made against the code. What should that change be?

Describe the solution you'd like

I see a few options for this:

  1. explicitly change unqualified uses of Seq as a type to be mutable.Seq to preserve mutable semantics. The primary drawback to this is that callers of the methods that have this return type that use unqualified Seq as a return type will also have to update their code to the same when migrating to 2.13.

  2. leave the unqualified uses of Seq as a type they are, and add explicit .toSeq on return values. This is a no-op for mutable structures (like ListBuffer) in 2.12, but will have the effect of creating a new container object of type Seq in 2.13.

  3. Change parameters to be Iterable (sometimes bad, since a caller could pass an infinite iterable). Leave return types as Seq and add .toSeq on return values as in (2)

Describe alternatives you've considered

n/a

Additional context

n/a

@pomadchin
Copy link
Member

I think eveyrhting was resolved in terms of #3294, the rest of warning would probably make sense to remove after dropping Scala 2.12.

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

No branches or pull requests

2 participants