diff --git a/gradle-plugin/gradle.properties b/gradle-plugin/gradle.properties
index c0359b60..d782d221 100644
--- a/gradle-plugin/gradle.properties
+++ b/gradle-plugin/gradle.properties
@@ -1,2 +1,2 @@
-courierVersion=2.0.9
+courierVersion=2.0.10
scalaMajorVersion=2.11
diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml
index 9d8ade2d..a39107d1 100644
--- a/maven-plugin/pom.xml
+++ b/maven-plugin/pom.xml
@@ -35,7 +35,7 @@
UTF-8
2.11
2.11.5
- 2.0.9
+ 2.0.10
1.7
http://github.com/coursera/courier
diff --git a/scala/generator-test/src/test/scala/org/coursera/courier/generator/UnionGeneratorTest.scala b/scala/generator-test/src/test/scala/org/coursera/courier/generator/UnionGeneratorTest.scala
index 9b8f1650..74f8b94e 100644
--- a/scala/generator-test/src/test/scala/org/coursera/courier/generator/UnionGeneratorTest.scala
+++ b/scala/generator-test/src/test/scala/org/coursera/courier/generator/UnionGeneratorTest.scala
@@ -155,4 +155,17 @@ class UnionGeneratorTest extends GeneratorTest with SchemaFixtures {
def testUnionTyperefSchema(): Unit = {
assert(TypedDefinition.TYPEREF_SCHEMA.getDereferencedDataSchema === TypedDefinition.SCHEMA)
}
+
+ @Test
+ def testMemberUnapplyReturnsSomeType(): Unit = {
+ // If the member unapply methods return Option[X] instead of Some[X], then the scala compiler
+ // turns off match exhaustivity checking for match statements that use the member unapply
+ // methods. This test asserts that member unapply methods return Some[X], so that we get better
+ // exhaustivity checking for match statements involving courier unions.
+ assertCompiles("""
+ val recordMember = WithComplexTypesUnion.Union.EmptyMember(Empty())
+ WithComplexTypesUnion.Union.EmptyMember.unapply(recordMember): Some[Empty]
+ """)
+ }
+
}
diff --git a/scala/generator/src/main/twirl/org/coursera/courier/templates/UnionClass.scala.txt b/scala/generator/src/main/twirl/org/coursera/courier/templates/UnionClass.scala.txt
index 74f2908c..f4f273e2 100644
--- a/scala/generator/src/main/twirl/org/coursera/courier/templates/UnionClass.scala.txt
+++ b/scala/generator/src/main/twirl/org/coursera/courier/templates/UnionClass.scala.txt
@@ -148,7 +148,7 @@ object @(union.scalaType) extends UnionCompanion[@(union.scalaType)] @(if(union.
new @(member.classDefinition.memberName)(dataMap)
}
- def unapply(member: @(member.classDefinition.memberName)): Option[@(member.classDefinition.scalaTypeFullname)] = {
+ def unapply(member: @(member.classDefinition.memberName)): Some[@(member.classDefinition.scalaTypeFullname)] = {
Some(member.value)
}
diff --git a/version.sbt b/version.sbt
index 1305cd8a..9b2c2b84 100644
--- a/version.sbt
+++ b/version.sbt
@@ -1 +1 @@
-version in ThisBuild := "2.0.9"
+version in ThisBuild := "2.0.10"
\ No newline at end of file