Skip to content

Conversation

@ashawley
Copy link
Contributor

@ashawley ashawley commented Apr 5, 2018

In preparation for the vaunted 2.13 collections library changes, I've cherry-picked a few of Julien Richard-Foy's changes in his 2.13.0-M4 porting work in #391. In the interest of better understanding the impending 2.13 release changes, it would be good to at least make piecewise progress.

Julien was looking at using the scala-collections-compat library and preserving the internal uses of mutable.Seq. I investigated just switching to using immutable.Seq and making the switch from Traversable to Iterable.

These changes don't seem very onerous and they seem to work across multiple Scala versions and targets (including js and native).

@ashawley
Copy link
Contributor Author

ashawley commented Apr 5, 2018

There was a strange issue where Array and mutable.ArrayBuffer wouldn't implicitly convert toimmutable.Seq. It normally should.

def f[T](a: collection.mutable.ArrayBuffer[T]):collection.mutable.Seq[T] = {
  if (a.isEmpty) collection.mutable.Seq.empty[T]
  else a.to[collection.mutable.Seq]
}
f: [T](a: collection.mutable.ArrayBuffer[T])collection.mutable.Seq[T]

Seemingly, this was because org.scalacheck.util.SerializableCanBuildFroms had implicits that interfered.

import Prop.Arg

import scala.collection.immutable.Seq

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because Test.checkProperties return type is defined as Seq[(String,Result)].

@ashawley ashawley force-pushed the immutable-seq branch 4 times, most recently from 13d9510 to 6a8015b Compare April 22, 2018 20:03
@ashawley
Copy link
Contributor Author

I didn't realize MiMa was disabled until #399 put it back.

Turns out there are a lot of compatibility changes if immutable.Seq is used:

sbt> jvm/mimaReportBinaryIssues
[info] scalacheck: found 7 potential binary incompatibilities while checking
[info] against org.scalacheck:scalacheck_2.12:1.14.0 

julienrf and others added 3 commits May 3, 2018 08:50
Preparation for the new collections library.

Cherry-picked from work on trying to:
Add support for Scala 2.13-M4
Fix by removing parens.
The collections library doesn't do this automatically.  Seemingly,
this is because org.scalacheck.util.SerializableCanBuildFroms has
implicits that interfere.
@ashawley ashawley force-pushed the immutable-seq branch 2 times, most recently from a8d9b13 to 88c291d Compare May 3, 2018 13:22
ashawley added 2 commits May 3, 2018 11:41
- method oneOf(Seq)Gen in object Gen's type is different in current
  version, where it is (immutable.Seq)Gen instead of (Seq)Gen
- method sequence(Traversable,util.Buildable)Gen in object Gen's type
  is different in current version, where it is
  (Iterable,util.Buildable)Gen instead of
  (Traversable,util.Buildable)Gen
- method properties()Seq in class Properties has a different result
  type in current version, where it is immutable.Seq rather than Seq
- method checkProperties(Test#Parameters,Properties)Seq in object Test
  has a different result type in current version, where it is
  immutable.Seq rather than Seq
- method
  canCreateNewSut(java.lang.Object,Traversable,Traversable)Boolean in
  interface commands.Commands's type is different in current version,
  where it is (java.lang.Object,Iterable,Iterable)Boolean instead of
  (java.lang.Object,Traversable,Traversable)Boolean
- abstract method
  canCreateNewSut(java.lang.Object,Iterable,Iterable)Boolean in
  interface commands.Commands is present only in current version
- method fromIterable(Traversable)java.lang.Object in interface
  util.Buildable's type is different in current version, where it is
  (Iterable)java.lang.Object instead of (Traversable)java.lang.Object
- method fromIterable(Traversable)java.lang.Object in trait
  util.Buildable does not have a correspondent in current version
- method fromIterable(Iterable)java.lang.Object in trait
  util.Buildable is present only in current version
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.

2 participants