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

-Rational.one triggers deprecation warning about auto-application in 2.13.3 #921

Closed
swsnr opened this issue Jul 23, 2020 · 4 comments
Closed

Comments

@swsnr
Copy link

swsnr commented Jul 23, 2020

Scala 2.13.3 deprecates auto-application of methods with empty parameter lists, see scala/scala#8833. Spire defines the unary - of Rational with an empty parameter list. Consequently negating a rational (i.e. -Rational.one) triggers the new deprecation warning, e.g. (with import spire.math.{Rational => R}):

Error:(49, 25) Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method unary_-,
or remove the empty argument list from its definition (Java-defined methods are exempt).
In Scala 3, an unapplied method like this will be eta-expanded into a function.
      SnapToGrid(R.one, -R.one, Closed(R.zero))

I'm not sure whether this can be considered a bug in Scala 2.13.3, but it looks as if just removing the empty parameter list from spire.match.Rational.unary_- (i.e. defining it without any argument list) would fix this issue on the Spire side. Other numeric types in Spire (e.g. UByte) already define the unary - without parameter lists.

@larsrh
Copy link
Contributor

larsrh commented Aug 6, 2020

Yeah, good point. This will be an error in Dotty. Would you mind sending a PR?

@swsnr
Copy link
Author

swsnr commented Aug 7, 2020

To remove these parenthesis? Can do next week, please ping me on eg Thursday should I forget 🙂

@larsrh
Copy link
Contributor

larsrh commented Aug 7, 2020

I mean, there's many other occurrences of unary_-(), so help would be appreciated 😉

@larsrh
Copy link
Contributor

larsrh commented Sep 16, 2020

Should be fixed now.

@larsrh larsrh closed this as completed Sep 17, 2020
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