Scalactic support in SuperSafe Community Edition

Artima SuperSafe is a commercial Scala compiler plugin with a free Community Edition that checks Scalactic TripleEquals (=== and !==) expressions for correctness. Using SuperSafe Community Edition together with Scalactic can save you time and ensure certain errors do not exist in your code. (See the installation section below for instructions on installing SuperSafe Community Edition.)

Here are some examples:

scala> import org.scalactic._
import org.scalactic._

scala> import TripleEquals._
import TripleEquals._

scala> val x = Some(1)
x: Some[Int] = Some(1)

scala> x === 1
<console>:18: error: [Artima SuperSafe] Values of type Some[Int] and Int may
not be compared with the === operator. If you really want to compare them for
equality, configure Artima SuperSafe to allow those types to be compared for
equality.  For more information on this kind of error, see:
http://www.artima.com/supersafe_user_guide.html#safer-equality
       x === 1
         ^

scala> x !== 1
<console>:18: error: [Artima SuperSafe] Values of type Some[Int] and Int may
not be compared with the !== operator. If you really want to compare them for
inequality, configure Artima SuperSafe to allow those types to be compared for
inequality (which will also enable them to be compared for equality).  For
more information on this kind of error, see:
http://www.artima.com/supersafe_user_guide.html#safer-equality
       x !== 1
         ^

scala> x === Some(1L)
res4: Boolean = true

scala> List(1, 2, 3) === Vector(1, 2, 3)
res5: Boolean = true

scala> List(1, 2, 3) === Set(1, 2, 3)
<console>:17: error: [Artima SuperSafe] Values of type List[Int] and
scala.collection.immutable.Set[Int] may not be compared with the === operator.
If you really want to compare them for equality, configure Artima SuperSafe to
allow those types to be compared for equality.  For more information on this
kind of error, see:
http://www.artima.com/supersafe_user_guide.html#safer-equality
       List(1, 2, 3) === Set(1, 2, 3)
                     ^

Installation of SuperSafe Community Edition

If you are using sbt as your build tool, you can install the SuperSafe Community Edition by adding the following line to your project/plugins.sbt:

addSbtPlugin("com.artima.supersafe" % "sbtplugin" % "1.1.12")

If you are using Maven as your build tool, you can install the community edition of SuperSafe by adding the compiler plugin to your pom.xml, like this:

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <configuration>
        <compilerPlugins>
            <compilerPlugin>
                <groupId>com.artima.supersafe</groupId>
                <artifactId>supersafe_2.13.12</artifactId>
                <version>1.1.12</version>
            </compilerPlugin>
        </compilerPlugins>
    </configuration>
    <executions>
        ...
    </executions>
</plugin>

Note: You need to use the exact Scala version in the artifactId, because compiler plugin depends on compiler API that's not binary compatible between Scala minor releases.

Scalactic is brought to you by Bill Venners, with contributions from several other folks. It is sponsored by Artima, Inc.
ScalaTest is free, open-source software released under the Apache 2.0 license.

Copyright © 2009-2024 Artima, Inc. All Rights Reserved.

artima