CINXE.COM
Scalactic
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>Scalactic</title> <link rel="Stylesheet" href="/assets/stylesheets/main.css" type="text/css" media="screen"/> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-19BZD1XMRV"></script> <script defer src='/assets/javascripts/gtag.js'></script> </head> <body> <div class="Container"> <!-- Top of scalactic.org 660 x 60 [async] --> <script id="adsArtimaScript" type="text/javascript" src="https://www.artima.com/assets/javascripts/4ca150665e51d0b1c3890ca1b891c507-ads.js?product=Scalactic"></script> <div id="Header"> <div id="Nav"> <a href="/">Home</a> | <a href="/quick_start">Quick Start</a> | <a href="/install">Install</a> | <a href="/user_guide">User Guide</a> | <a href="/scaladoc">Scaladoc</a> | <span><em>SuperSafe</em></span> | <a href="/about">About</a> </div> <!-- Nav --> </div> <!-- Header --> <div id="body"> <div class="message"> <a class="scalatestLogo" href="./"> <img src="/assets/images/scalacticLogo.gif" width="400" height="60" alt="ScalaTest"/> </a> </div> <div style="text-align: left"> <h1>Scalactic support in SuperSafe Community Edition</h1> <p> <a href="http://www.artima.com/supersafe_user_guide.html">Artima SuperSafe</a> is a commercial Scala compiler plugin with a free Community Edition that checks Scalactic <a href='/scaladoc/3.2.19/org/scalactic/TripleEquals.html'><code>TripleEquals</code></a> (<code>===</code> and <code>!==</code>) 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 <a href="#installation">installation section</a> below for instructions on installing SuperSafe Community Edition.) </p> <p> Here are some examples: </p> <pre class="scala"> scala> <span class="reserved">import</span> org.scalactic._ <span class="lineComment">import org.scalactic._</span> scala> <span class="reserved">import</span> TripleEquals._ <span class="lineComment">import TripleEquals._</span> scala> <span class="reserved">val</span> x = <span class="type">Some</span>(<span class="literal">1</span>) <span class="lineComment">x: Some[Int] = Some(1)</span> scala> x === <span class="literal">1</span> <span class="lineComment"><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 ^</span> scala> x !== <span class="literal">1</span> <span class="lineComment"><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 ^</span> scala> x === <span class="type">Some</span>(<span class="literal">1L</span>) <span class="lineComment">res4: Boolean = true</span> scala> <span class="type">List</span>(<span class="literal">1</span>, <span class="literal">2</span>, <span class="literal">3</span>) === <span class="type">Vector</span>(<span class="literal">1</span>, <span class="literal">2</span>, <span class="literal">3</span>) <span class="lineComment">res5: Boolean = true</span> scala> <span class="type">List</span>(<span class="type">1</span>, <span class="type">2</span>, <span class="type">3</span>) === <span class="type">Set</span>(<span class="literal">1</span>, <span class="literal">2</span>, <span class="literal">3</span>) <span class="lineComment"><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) ^</span> </pre> <a name="installation"></a> <h2>Installation of SuperSafe Community Edition</h2> <p> 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: </p> <pre class="stGrayback"> addSbtPlugin("com.artima.supersafe" % "sbtplugin" % "1.1.12") </pre> <p> If you are using Maven as your build tool, you can install the community edition of SuperSafe by adding the compiler plugin to your <code>pom.xml</code>, like this: </p> <pre class="stGrayback"> <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <configuration> <compilerPlugins> <b><compilerPlugin> <groupId>com.artima.supersafe</groupId> <artifactId>supersafe_2.13.14</artifactId> <version>1.1.12</version> </compilerPlugin></b> </compilerPlugins> </configuration> <executions> ... </executions> </plugin> </pre> <p> 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. </p> </div> </div> <!-- body --> <div style="font-size: 66%; margin-top: 60px"> <p> Scalactic is brought to you by Bill Venners, with contributions from several other folks. It is sponsored by Artima, Inc.<br /> ScalaTest is free, open-source software released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache 2.0 license</a>. </p> <p> Copyright © 2009-2025 Artima, Inc. All Rights Reserved. </p> <p> <a href="http://www.artima.com" class="no_link_hover"> <img src="/assets/images/artima100Black.png" style="margin-top: 2px" width="100" height="38" alt="artima"/> </a> </p> </div> <!-- style="..." --> </div> <!-- Container --> </body> </html>