Skip to content

Commit

Permalink
Migrated to Scala 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
michel-steuwer committed Sep 23, 2020
1 parent 1477a5d commit 1aad7dd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 27 deletions.
24 changes: 6 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
ThisBuild / scalaVersion := "2.12.10"
ThisBuild / scalaVersion := "2.13.3"
ThisBuild / organization := "org.elevate-lang"

lazy val commonSettings = Seq(
javaOptions ++= Seq("-Xss16m"),

scalacOptions ++= Seq(
"-Wunused:nowarn",
"-Xfatal-warnings",
"-Xlint:-unused",
"-Xmax-classfile-name", "100",
"-Ymacro-annotations",
"-unchecked",
"-deprecation",
"-feature",
"-language:reflectiveCalls"
),

fork := true,

resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
fork := true
)

lazy val elevate = (project in file("."))
Expand All @@ -35,24 +30,17 @@ lazy val elevate = (project in file("."))
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
libraryDependencies += "org.scala-lang" % "scala-library" % scalaVersion.value,
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.2.0",

// JUnit
libraryDependencies += "junit" % "junit" % "4.11",

// Scalatest
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0" % "test",

// Silencer: Scala compiler plugin for warning suppression
libraryDependencies ++= Seq(
compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.4.3" cross CrossVersion.full),
"com.github.ghik" %% "silencer-lib" % "1.4.3" % Provided cross CrossVersion.full
)
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0" % "test"
)

lazy val elevateMacros = (project in file("macros"))
.settings(
name := "macros",
name := "elevateMacros",
version := "1.0",
commonSettings,
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/FSmooth/Differentiation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ object Differentiation {
}

visit(expr, Set())
free
free.toSeq
}

def A0(v: Variable, x: Variable): Expr = {
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/FSmooth/TypeInference.scala
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ object TypeInference {
}

def compose(other: Substitution): Substitution = {
val substitutedThis = solutions.mapValues(s => other.apply(s))
Substitution(substitutedThis ++ other.solutions)
val substitutedThis = solutions.view.mapValues(s => other.apply(s))
Substitution((substitutedThis ++ other.solutions).toMap)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class HeuristicPanelImplementation[P](val runner:Runner[P], val strategies:Set[S
solution.strategies.foreach(elem =>{
println("strategy: " + elem)
})
println
println()
call += 1
val neighbours = scala.collection.mutable.Set[Solution[P]]()

Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/elevate/heuristic_search/Metaheuristic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ class Metaheuristic[P](val name:String,
best
}

def writeValues(path: String, result: (P, Option[Double], Path[P]), name:String) {
def writeValues(path: String, result: (P, Option[Double], Path[P]), name:String): Unit = {
// open file for appendix
val file = new PrintWriter(new FileOutputStream(new File(path), true))

// create string to write to file
var string = counter + ", " + name + ", " + System.currentTimeMillis().toString + ", " + Integer.toHexString(result._1.hashCode()) + ", "
var string = s"$counter, $name, ${System.currentTimeMillis()}, ${Integer.toHexString(result._1.hashCode())}, "
result._2 match{
case Some(value) => string += value.toString + "\n"
case _ => string += "-1 \n"
Expand All @@ -86,7 +86,7 @@ class Metaheuristic[P](val name:String,
file.close()
}

def writeHeader(path:String) {
def writeHeader(path:String): Unit = {
// open file for appendix
val file = new PrintWriter(new FileOutputStream(new File(path), true))

Expand Down
2 changes: 0 additions & 2 deletions src/test/scala/elevate/test_util/package.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package elevate

import com.github.ghik.silencer.silent
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers

package object test_util {
@silent("define classes/objects inside of package objects")
abstract class Tests extends AnyFunSuite with Matchers
}

0 comments on commit 1aad7dd

Please sign in to comment.