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

Compilation errors with Scala 1.12.0-M4 #230

Closed
rickynils opened this issue Apr 7, 2016 · 8 comments
Closed

Compilation errors with Scala 1.12.0-M4 #230

rickynils opened this issue Apr 7, 2016 · 8 comments

Comments

@rickynils
Copy link
Contributor

Compiling ScalaCheck 1.13.0 with Scala 1.12.0-M4 results in a lot of errors like these:

[error] src/main/scala/org/scalacheck/Cogen.scala:25: missing parameter type
[error]     Cogen((seed, s) => perturb(seed, f(s)))
[error]            ^
[error] src/main/scala/org/scalacheck/Cogen.scala:25: missing parameter type
[error]     Cogen((seed, s) => perturb(seed, f(s)))

These errors are introduced by M4, compilation with M3 works fine. Additionally, M4 works fine with ScalaCheck 1.11 and 1.12.

@dwijnand
Copy link
Contributor

dwijnand commented Apr 7, 2016

Ouch. The 2.12.x community build has scalacheck pinned at 1.11.6: https://github.com/scala/community-builds/blame/2.12.x/common.conf#L66

@xuwei-k
Copy link
Contributor

xuwei-k commented Apr 7, 2016

Cogen is SAM (single abstract method) type, and there are some overload methods.

def apply[T](implicit ev: Cogen[T]): Cogen[T] = ev

def apply[T](f: (Seed, T) => Seed): Cogen[T] = 

https://github.com/rickynils/scalacheck/blob/1.13.0/src/main/scala/org/scalacheck/Cogen.scala

@xuwei-k
Copy link
Contributor

xuwei-k commented Apr 7, 2016

similar discussion? scala/scala#4971 (comment)

@SethTisue
Copy link
Member

attn @adriaanm, here's another example of overloading trouble involving SAM support

@adriaanm
Copy link
Contributor

adriaanm commented Apr 7, 2016

That's a fun one! The smallest source-compatible hack I can think of is def apply[T](implicit ev1: Cogen[T], ev2: Cogen[T]): Cogen[T] = ev1... Don't tell anyone I recommended that, though 😎

Sadly, I don't see how we can improve overload resolution to fix this without pushing it over the complexity brink that it's teetering.

@rickynils
Copy link
Contributor Author

@adriaanm So ScalaCheck follows its tradition of torturing scalac... The workaround works, but I guess I must either bump the ScalaCheck version or create a separate branch for M4.

@sjrd
Copy link
Contributor

sjrd commented Apr 14, 2016

You can make it both source-compatible and binary compatible like this:

// binary compatible
protected[enclosingpackage] def apply[T](ev: Cogen[T]): Cogen[T] = ev
// source compatible
def apply[T](implicit ev: Cogen[T], dummy: DummyImplicit): Cogen[T] = ev

@rickynils
Copy link
Contributor Author

I've implemented the workaround so master now builds with Scala 2.12.0-M4. I've also released a new version of ScalaCheck (1.13.1, both JVM and JS versions), built with Scala 2.10, 2.11 and 2.12-M4.

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

6 participants