Skip to content

Update to Scala 2.12.10 #80

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

Merged
merged 1 commit into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: scala
scala:
- 2.11.11
- 2.12.10
jdk:
- openjdk8
script:
Expand Down
11 changes: 7 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
val scalaExercisesV = "0.4.0-SNAPSHOT"
import ProjectPlugin.autoImport._

val scalaExercisesV = "0.5.0-SNAPSHOT"

def dep(artifactId: String) = "org.scala-exercises" %% artifactId % scalaExercisesV

Expand All @@ -9,9 +11,10 @@ lazy val `scala-tutorial` = (project in file("."))
libraryDependencies ++= Seq(
dep("exercise-compiler"),
dep("definitions"),
%%("scalatest"),
%%("scalacheck"),
%%("scheckShapeless")
%%("shapeless", V.shapeless),
%%("scalatest", V.scalatest),
%%("scalacheck", V.scalacheck),
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless
)
)

Expand Down
31 changes: 19 additions & 12 deletions project/ProjectPlugin.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import de.heikoseeberger.sbtheader.HeaderPattern
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
import de.heikoseeberger.sbtheader.License._
import sbt.Keys._
import sbt._
import sbtorgpolicies._
Expand All @@ -12,6 +12,19 @@ object ProjectPlugin extends AutoPlugin {

override def requires: Plugins = plugins.JvmPlugin && OrgPoliciesPlugin

object autoImport {

lazy val V = new {
val scala212: String = "2.12.10"
val shapeless: String = "2.3.3"
val scalatest: String = "3.0.8"
val scalacheck: String = "1.14.2"
val scalacheckShapeless: String = "1.2.3"
}
}

import autoImport._

override def projectSettings: Seq[Def.Setting[_]] =
Seq(
description := "Scala Exercises: The path to enlightenment",
Expand All @@ -25,23 +38,17 @@ object ProjectPlugin extends AutoPlugin {
organizationEmail = "hello@47deg.com"
),
orgLicenseSetting := ApacheLicense,
scalaVersion := "2.11.11",
scalaVersion := V.scala212,
scalaOrganization := "org.scala-lang",
crossScalaVersions := Seq("2.11.11"),
resolvers ++= Seq(
Resolver.mavenLocal,
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases")
),
scalacOptions := sbtorgpolicies.model.scalacCommonOptions,
headers := Map(
"scala" -> (HeaderPattern.cStyleBlockComment,
s"""|/*
| * scala-exercises - ${name.value}
| * Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
| */
|
|""".stripMargin)
)
headerLicense := Some(Custom(s"""| scala-exercises - ${name.value}
| Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
|
|""".stripMargin))
)
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.13
sbt.version=1.2.8
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots")
)

addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.4.0-SNAPSHOT", "0.13", "2.10")
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.5.13")
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.5.0-SNAPSHOT")
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.12.0-M3")
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/ScalaTutorial.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/sections/FunctionalLoops.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down Expand Up @@ -158,10 +159,9 @@ object HigherOrderFunctions extends ScalaTutorialSection {
*/
def tailRecSum(res0: Int, res1: Int): Unit = {
def sum(f: Int => Int, a: Int, b: Int): Int = {
def loop(x: Int, acc: Int): Int = {
def loop(x: Int, acc: Int): Int =
if (x > b) acc
else loop(x + res0, acc + f(x))
}
loop(a, res1)
}
sum(x => x, 1, 10) shouldBe 55
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/sections/LazyEvaluation.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/sections/LexicalScopes.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections

import scalatutorial.utils.{Empty, IntSet, NonEmpty}
import scalatutorial.utils.{Empty, NonEmpty}

/** @param name object_oriented_programming */
object ObjectOrientedProgramming extends ScalaTutorialSection {
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/sections/PolymorphicTypes.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/sections/StandardLibrary.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down Expand Up @@ -49,7 +50,7 @@ object SyntacticConveniences extends ScalaTutorialSection {
def tuples(res0: (Int, String)): Unit = {
def pair(i: Int, s: String): (Int, String) = (i, s)

pair(42, "foo") shouldBe (42, "foo")
pair(42, "foo") shouldBe ((42, "foo"))
pair(0, "bar") shouldBe res0
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/sections/TailRecursion.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/sections/TermsAndTypes.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/sections/TypeClasses.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/utils/BankAccount.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.utils
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/utils/IntSet.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.utils
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/utils/Note.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.utils
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/utils/Rational.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.utils
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/utils/animals.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.utils
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scalatutorial/utils/sorting.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.utils
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
/*
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-scalatutorial
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package scalatutorial.sections

import org.scalacheck.Shapeless._
import org.scalacheck.ScalacheckShapeless._
import org.scalaexercises.Test
import org.scalatest.Spec
import org.scalatest.prop.Checkers
import org.scalatest.refspec.RefSpec
import org.scalatestplus.scalacheck.Checkers
import shapeless.HNil

class ClassesVsCaseClassesSpec extends Spec with Checkers {
class ClassesVsCaseClassesSpec extends RefSpec with Checkers {

def `check creation and manipulation`: Unit =
def `check creation and manipulation`(): Unit =
check(Test.testSuccess(ClassesVsCaseClasses.creationAndManipulation _, "C" :: HNil))

def `check equality`: Unit =
def `check equality`(): Unit =
check(Test.testSuccess(ClassesVsCaseClasses.equality _, false :: true :: HNil))

def `check encoding`: Unit =
def `check encoding`(): Unit =
check(
Test.testSuccess(
ClassesVsCaseClasses.encoding _,
Expand Down
Loading