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
Add test for 2.11 and 2.13 version of ExplicitResultType #1167
Conversation
@@ -0,0 +1,56 @@ | |||
package tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this one doesn't work on scala 2.11?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot this. I will check
...fix-tests/output/src/main/scala-2.11/test/explicitResultTypes/ExplicitResultTypesInfix.scala
Show resolved
Hide resolved
scalafix-tests/input/src/main/scala/test/explicitResultTypes/Rename.scala
Show resolved
Hide resolved
scalafix-tests/input/src/main/scala/tests/ExplicitResultTypesRefinement.scala
Show resolved
Hide resolved
if (productRootClass | ||
.intersect(parents.map(_.typeSymbol).toSet) | ||
.nonEmpty && parents | ||
.map(_.typeSymbol) | ||
.contains(serializableClass)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you extract val parentsClass = parents.map(_.typeSymbol).toSet
to make the condition more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
The code was not matching both Serializable trait in 2.13 and 2.12, which was leading to cases where got types that are not symplified enought. in 2.13, only one serializable remains, which was leading to unwanted simplification (ex: Serializable, AnyRef => AnyRef)
scalafix-tests/output/src/main/scala/test/explicitResultTypes/Rename.scala
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! LGTM (although this is all new to me, so I am not sure my review is worth much!)
scalafix-rules/src/main/scala/scalafix/internal/rule/CompilerTypePrinter.scala
Show resolved
Hide resolved
scalafix-rules/src/main/scala/scalafix/internal/rule/CompilerTypePrinter.scala
Outdated
Show resolved
Hide resolved
…ypePrinter.scala Co-authored-by: Brice Jaglin <bjaglin@gmail.com>
…Rename.scala Co-authored-by: Brice Jaglin <bjaglin@gmail.com>
closes #998