Skip to content

Commit f3b1d3e

Browse files
authored
Merge pull request #152 from scala-exercises/enrique-2-12-10-update
Exercises Update and Removed Deprecation Warnings
2 parents e197c33 + 8618792 commit f3b1d3e

File tree

79 files changed

+251
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+251
-288
lines changed

build.sbt

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ lazy val stdlib = (project in file("."))
1010
libraryDependencies ++= Seq(
1111
dep("exercise-compiler"),
1212
dep("definitions"),
13-
%%("shapeless"),
14-
%%("scalatest"),
15-
%%("scalacheck"),
16-
%%("scheckShapeless")
13+
%%("shapeless", V.shapeless),
14+
%%("scalatest", V.scalatest),
15+
%%("scalacheck", V.scalacheck),
16+
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless
1717
)
1818
)
1919

project/ProjectPlugin.scala

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ object ProjectPlugin extends AutoPlugin {
1616
object autoImport {
1717

1818
lazy val V = new {
19-
val scala212: String = "2.12.10"
19+
val scala212: String = "2.12.10"
20+
val shapeless: String = "2.3.3"
21+
val scalatest: String = "3.0.8"
22+
val scalacheck: String = "1.14.2"
23+
val scalacheckShapeless: String = "1.2.3"
2024
}
2125
}
2226

@@ -44,7 +48,7 @@ object ProjectPlugin extends AutoPlugin {
4448
),
4549
scalacOptions := sbtorgpolicies.model.scalacCommonOptions,
4650
headerLicense := Some(Custom(s"""| scala-exercises - ${name.value}
47-
| Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
51+
| Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4852
|
4953
|""".stripMargin))
5054
)

src/main/scala/stdlib/Asserts.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/ByNameParameter.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/CaseClasses.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Classes.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/EmptyValues.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Enumerations.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Extractors.scala

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

@@ -71,7 +71,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
7171
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)
7272

7373
object ChopShop {
74-
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
74+
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
7575
}
7676

7777
val ChopShop(a, b, c, d) = new Car("Chevy", "Camaro", 1978, 120)
@@ -88,7 +88,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
8888
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)
8989

9090
object ChopShop {
91-
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
91+
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
9292
}
9393

9494
val x = new Car("Chevy", "Camaro", 1978, 120) match {
@@ -106,7 +106,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
106106
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short)
107107

108108
object ChopShop {
109-
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
109+
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
110110
}
111111

112112
val x = new Car("Chevy", "Camaro", 1978, 120) match {
@@ -125,9 +125,9 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
125125
class Employee(val firstName: String, val middleName: Option[String], val lastName: String)
126126

127127
object Tokenizer {
128-
def unapply(x: Car) = Some(x.make, x.model, x.year, x.topSpeed)
128+
def unapply(x: Car) = Some((x.make, x.model, x.year, x.topSpeed))
129129

130-
def unapply(x: Employee) = Some(x.firstName, x.lastName)
130+
def unapply(x: Employee) = Some((x.firstName, x.lastName))
131131
}
132132

133133
val result = new Employee("Kurt", None, "Vonnegut") match {
@@ -142,7 +142,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
142142
*/
143143
def anyObjectExtractors(res0: String) {
144144
class Car(val make: String, val model: String, val year: Short, val topSpeed: Short) {
145-
def unapply(x: Car) = Some(x.make, x.model)
145+
def unapply(x: Car) = Some((x.make, x.model))
146146
}
147147

148148
val camaro = new Car("Chevy", "Camaro", 1978, 122)
@@ -168,7 +168,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
168168
//factory methods, extractors, apply
169169
//Extractor: Create tokens that represent your object
170170
def unapply(x: Employee) =
171-
Some(x.lastName, x.middleName, x.firstName)
171+
Some((x.lastName, x.middleName, x.firstName))
172172
}
173173

174174
val singri = new Employee("Singri", None, "Keerthi")
@@ -193,7 +193,7 @@ object Extractors extends FlatSpec with Matchers with org.scalaexercises.definit
193193
//factory methods, extractors, apply
194194
//Extractor: Create tokens that represent your object
195195
def unapply(x: Employee) =
196-
Some(x.lastName, x.middleName, x.firstName)
196+
Some((x.lastName, x.middleName, x.firstName))
197197
}
198198

199199
val singri = new Employee("Singri", None, "Keerthi")

src/main/scala/stdlib/ForExpressions.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Formatting.scala

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

@@ -33,18 +33,16 @@ object Formatting extends FlatSpec with Matchers with org.scalaexercises.definit
3333
"%c".format(b) should be(res1)
3434
}
3535

36-
/** Character Literals can be an escape sequence, including octal or hexidecimal:
36+
/** Character Literals can be an escape sequence, including hexidecimal:
3737
*/
38-
def escapeSequenceFormatting(res0: String, res1: String, res2: String, res3: String) {
38+
def escapeSequenceFormatting(res0: String, res1: String, res2: String) {
3939
val c = '\u0061' //unicode for a
40-
val d = '\141' //octal for a
4140
val e = '\"'
4241
val f = '\\'
4342

4443
"%c".format(c) should be(res0)
45-
"%c".format(d) should be(res1)
46-
"%c".format(e) should be(res2)
47-
"%c".format(f) should be(res3)
44+
"%c".format(e) should be(res1)
45+
"%c".format(f) should be(res2)
4846
}
4947

5048
/** Formatting can also include numbers:

src/main/scala/stdlib/HigherOrderFunctions.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Implicits.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/InfixPrefixandPostfixOperators.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/InfixTypes.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Iterables.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Lists.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/LiteralBooleans.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/LiteralNumbers.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/LiteralStrings.scala

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

@@ -31,13 +31,6 @@ object LiteralStrings extends FlatSpec with Matchers with org.scalaexercises.def
3131
c.toString should be(res0)
3232
}
3333

34-
/** Character literals can use octal as well:
35-
*/
36-
def characterLiteralsOctalLiteralStrings(res0: String) {
37-
val d = '\141' //octal for a
38-
d.toString should be(res0)
39-
}
40-
4134
/** Character literals can use escape sequences:
4235
*/
4336
def escapeSequenceLiteralStrings(res0: String, res1: String) {

src/main/scala/stdlib/Maps.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/NamedandDefaultArguments.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/NamedandDefaultArgumentsHelper.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Objects.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Options.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/OptionsHelper.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/ParentClasses.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/PartialFunctions.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/PartiallyAppliedFunctions.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/PatternMatching.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/Ranges.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/RepeatedParameters.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/RepeatedParametersHelper.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

src/main/scala/stdlib/SequencesandArrays.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* scala-exercises - exercises-stdlib
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
44
*
55
*/
66

0 commit comments

Comments
 (0)