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

Give some love to the project #1175

Merged
merged 12 commits into from Aug 10, 2023
Merged

Give some love to the project #1175

merged 12 commits into from Aug 10, 2023

Conversation

guizmaii
Copy link
Member

@guizmaii guizmaii commented Aug 10, 2023

Remove Scala 2.11 support as ZIO doesn't support it anymore

sideeffffect
sideeffffect previously approved these changes Aug 10, 2023
Copy link
Member

@sideeffffect sideeffffect left a comment

Choose a reason for hiding this comment

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

Looks good, thanks

case '{ Assertion.Regex.anyRegexOf(${Expr(first)}, ${Expr(second)}, ${Varargs(rest)}: _*) } => Some(Assertion.Regex.anyRegexOf(first, second, Varargs(rest).valueOrError*))
case '{ Assertion.Regex.notAnyCharOf(${Expr(first)}, ${Expr(second)}, ${Varargs(rest)}: _*) } => Some(Assertion.Regex.notAnyCharOf(first, second, Varargs(rest).valueOrError*))
case '{ Assertion.Regex.notAnyRegexOf(${Expr(first)}, ${Expr(second)}, ${Varargs(rest)}: _*) } => Some(Assertion.Regex.notAnyRegexOf(first, second, Varargs(rest).valueOrError*))
case '{ Assertion.Regex.anyCharOf(${Expr(first)}, ${Expr(second)}, ${Varargs(rest)}: _*) } => Some(Assertion.Regex.anyCharOf(first, second, Varargs(rest).valueOrAbort*))
Copy link
Member Author

@guizmaii guizmaii Aug 10, 2023

Choose a reason for hiding this comment

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

Was generating the following scalac warning:

[warn] -- Deprecation Warning: /Users/jules/conduktor/workspace/zio-prelude/core/shared/src/main/scala-3/zio/prelude/Liftables.scala:40:152 
[warn] 40 |        case '{ Assertion.Regex.anyCharOf(${Expr(first)}, ${Expr(second)}, ${Varargs(rest)}: _*) }     => Some(Assertion.Regex.anyCharOf(first, second, Varargs(rest).valueOrError*))
[warn]    |                                                                                                                                                        ^
[warn]    |method valueOrError in trait Quotes is deprecated since 3.1.0: Use valueOrAbort

See https://github.com/lampepfl/dotty/blob/main/library/src/scala/quoted/Quotes.scala

@@ -130,7 +130,7 @@ trait Liftables {
case _: Short => summon[Numeric[Short]].asInstanceOf[Numeric[Any]]
case _: Byte => summon[Numeric[Byte]].asInstanceOf[Numeric[Any]]
case _: Char => summon[Numeric[Char]].asInstanceOf[Numeric[Any]]
case other => report.throwError(s"NO NUMERIC FOR $other")
case other => report.errorAndAbort(s"NO NUMERIC FOR $other")
Copy link
Member Author

@guizmaii guizmaii Aug 10, 2023

Choose a reason for hiding this comment

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

Was generating the following scalac warning:

[warn] -- Deprecation Warning: /Users/jules/conduktor/workspace/zio-prelude/core/shared/src/main/scala-3/zio/prelude/Liftables.scala:133:31 
[warn] 133 |      case other     => report.throwError(s"NO NUMERIC FOR $other")
[warn]     |                        ^^^^^^^^^^^^^^^^^
[warn]     |method throwError in trait reportModule is deprecated since 3.1.0: Use errorAndAbort

See https://github.com/lampepfl/dotty/blob/main/library/src/scala/quoted/Quotes.scala

case Some((2, 12)) =>
List("2.11+", "2.12+", "2.11-2.12", "2.12-2.13")
List("2.12", "2.12+", "2.12-2.13")
Copy link
Member Author

@guizmaii guizmaii Aug 10, 2023

Choose a reason for hiding this comment

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

2.12 is still used for https://github.com/zio/zio-prelude/pull/1175/files#diff-be30bee277855f18960ddd438b1594a798cbaf405b6e0ab9d4d7eccf3d965638

This class was in 2.11-2.12. I transferred it to this 2.12 directory.
It may not be the best decision.
I decided to do this so I'm sure not to change the behaviour.

@guizmaii guizmaii marked this pull request as ready for review August 10, 2023 12:10
@guizmaii guizmaii requested a review from a team as a code owner August 10, 2023 12:10
@guizmaii
Copy link
Member Author

@sideeffffect

Looks good, thanks

You might want to have a second look as I made some changes and added some comments to explain some of my changes 🙂

@guizmaii guizmaii marked this pull request as draft August 10, 2023 12:43
ThisBuild / scalaVersion := Scala213,
scalacOptions ++= stdOptions ++ extraOptions(scalaVersion.value, optimize = !isSnapshot.value),
libraryDependencies ++= {
if (scalaVersion.value == Scala3)
Seq(
"com.github.ghik" % s"silencer-lib_$Scala213" % SilencerVersion % Provided
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed Silencer because, from its doc:

NOTE: Scala 2.13.2 and 2.12.13 introduced scala/scala#8373. This means that unless you're still cross compiling for Scala 2.11, this plugin is obsolete, and you should use @nowarn.

See https://github.com/ghik/silencer

@@ -863,7 +863,7 @@ object Equal extends EqualVersionSpecific {
* Since there is only one `Unit` value all equality comparisons will always be true.
*/
implicit val UnitHashOrd: Hash[Unit] with Ord[Unit] =
HashOrd.make(_.hashCode, (_, _) => Ordering.Equals, (_, _) => true)
HashOrd.make(_ => 0, (_, _) => Ordering.Equals, (_, _) => true)
Copy link
Member

Choose a reason for hiding this comment

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

We definitely wan to behave like hashCode.

@sideeffffect
Copy link
Member

Still needs formatting

},
semanticdbEnabled := scalaVersion.value != Scala3, // enable SemanticDB
semanticdbOptions += "-P:semanticdb:synthetics:on",
semanticdbVersion := scalafixSemanticdb.revision, // use Scalafix compatible version
ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value),
ThisBuild / scalafixDependencies ++= List(
"com.github.liancheng" %% "organize-imports" % "0.6.0",
Copy link
Member Author

@guizmaii guizmaii Aug 10, 2023

Choose a reason for hiding this comment

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

organize-imports has been incorporated in scalafix 0.11.0

@guizmaii
Copy link
Member Author

guizmaii commented Aug 10, 2023

@sideeffffect

We definitely wan to behave like hashCode.

You were too fast 🙂
I was putting the _.hashCode back.
Scalafix is slow...

Based on the discussion I had here: https://discord.com/channels/632150470000902164/632150470000902166/1139171420312719400, in the end, I just added a nowarn on top of the code

@guizmaii guizmaii marked this pull request as ready for review August 10, 2023 13:58
@adamgfraser adamgfraser merged commit c0eb89f into zio:series/2.x Aug 10, 2023
20 checks passed
@guizmaii guizmaii deleted the love branch August 10, 2023 14:22
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.

None yet

3 participants