Skip to content

Expand the type signatures exercise with instanceof checks for a class and a trait #89

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
Jun 19, 2017
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
6 changes: 4 additions & 2 deletions src/main/scala/stdlib/TypeSignatures.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ object TypeSignatures extends FlatSpec with Matchers with org.scalaexercises.def

/** `isInstanceOf[className]` is used to determine the if an object reference is an instance of given class:
*/
def isInstanceOfFunctionTypeSignatures(res0: Boolean) {
def isInstanceOfFunctionTypeSignatures(res0: Boolean, res1: Boolean, res2: Boolean) {
trait Randomizer[A] {
def draw(): A
}
Expand All @@ -75,7 +75,9 @@ object TypeSignatures extends FlatSpec with Matchers with org.scalaexercises.def
}

val intRand = new IntRandomizer
intRand.draw.isInstanceOf[Int] should be(res0)
intRand.isInstanceOf[IntRandomizer] should be(res0)
intRand.isInstanceOf[Randomizer[Int]] should be(res1)
intRand.draw.isInstanceOf[Int] should be(res2)
}

}
2 changes: 1 addition & 1 deletion src/test/scala/stdlib/TypeSignaturesSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TypeSignaturesSpec extends Spec with Checkers {
check(
Test.testSuccess(
TypeSignatures.isInstanceOfFunctionTypeSignatures _,
true :: HNil
true :: true :: true :: HNil
)
)
}
Expand Down