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

Deprecation warnings because of Stream #626

Closed
froth opened this issue Feb 13, 2020 · 8 comments · Fixed by #627
Closed

Deprecation warnings because of Stream #626

froth opened this issue Feb 13, 2020 · 8 comments · Fixed by #627

Comments

@froth
Copy link
Contributor

froth commented Feb 13, 2020

I am currently porting code to scala 2.13 and am not able to get rid of deprecation warnings concerning Stream (replaced by LazyList) because of it's use in the interface of Shrink.

Is there a way to do so? A second apply method in Shrink would be handy:
def apply[T](s: T => LazyList[T]): Shrink[T] = ???

Or am I missing something?

@ashawley
Copy link
Contributor

This is more of a Scala question than a ScalaCheck question. However, we also ran in to it. We just disable fatal warnings in the 2.13 portion of the build:

https://github.com/typelevel/scalacheck/blob/d5967d2/build.sbt#L88

@ashawley
Copy link
Contributor

Concerning ScalaCheck still using Stream for shrinking: We have to support multiple versions of Scala, including Scala 2.11 and Scala 2.12, so we haven't moved to LazyList for shrinking, yet. It's on the list of things to do for ScalaCheck 2.0.

@froth
Copy link
Contributor Author

froth commented Feb 13, 2020

Would it be possible to support both types in your interface until then? (see above)
That would mean that ScalaCheck still has the deprecation warnings (which is sad) but would allow for users to write code that does not throw these warnings.

Maybe not via a second apply function as suggested above, because LazyList does not exist in older versions. But maybe one could do a scala 2.13 compatability package. But I am not sure if that would be worth it.

@ashawley
Copy link
Contributor

I believe there are a couple of issues with switching to LazyList for shrinking. It would be nice if it didn't require 2.0, but I recall it did. It was a while ago, and I didn't investigate it thoroughly, though. It was about the time we were working on 2.13 in #411.

@SethTisue SethTisue changed the title Depreaction Warnings because of Stream Deprecation warnings because of Stream Feb 13, 2020
@SethTisue
Copy link
Member

SethTisue commented Feb 13, 2020

But maybe one could do a scala 2.13 compatability package. But I am not sure if that would be worth it.

It wouldn't need to be a separate package, it could just be a small amount of Scala-version-specific sources. I think a pull request that did this would be accepted (at least, I don't see why not).

@froth
Copy link
Contributor Author

froth commented Feb 13, 2020

I'll have a look and see what I can do

@froth
Copy link
Contributor Author

froth commented Feb 13, 2020

Created a draft pull request. I am not sure about the name of the helper, so happy for suggestions on that point. (Or on anything else as I do not know the scalacheck codebase that well.)

I opted for creating a new class instead of creating a scala 2.13 variant of Shrink with an additional method to not make the codebase complexer.

@ashawley
Copy link
Contributor

Thanks for looking in to it. Maybe there will be a way. We'll just need to consider any impact on the eventual switch to LazyList for Shrink down the road and significant changes planned for Shrink.

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 a pull request may close this issue.

3 participants