Compiler plugin to restrict ==
/!=
to compare same types and forbid comparison of arrays.
// build.sbt
libraryDependencies += compilerPlugin("io.github.zero-deps" %% "eq" % "latest.integration")
resolvers += Resolver.githubPackages("zero-deps")
// project/plugins.sbt
addSbtPlugin("com.codecommit" % "sbt-github-packages" % "latest.integration")
// specification and showcase
sbt 'project demo' run
You do not need plugin because Scala 3 already contains such functionality:
scalacOptions += "-language:strictEquality"
And then you can add comparators for concrete types.
But do not add generic comparator which will cover Array
case.