Skip to content
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

Using irrefutable extractors for Scala structs #340

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ object AnotherException extends ValidatingThriftStructCodec3[AnotherException] w
errorCode
)

def unapply(_item: AnotherException): _root_.scala.Option[Int] = _root_.scala.Some(_item.errorCode)
def unapply(_item: AnotherException): _root_.scala.Some[Int] = _root_.scala.Some(_item.errorCode)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ object CollectionId extends ValidatingThriftStructCodec3[CollectionId] with Stru
collectionLongId
)

def unapply(_item: CollectionId): _root_.scala.Option[Long] = _root_.scala.Some(_item.collectionLongId)
def unapply(_item: CollectionId): _root_.scala.Some[Long] = _root_.scala.Some(_item.collectionLongId)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ object GoldService extends _root_.com.twitter.finagle.thrift.GeneratedThriftServ
request
)

def unapply(_item: Args): _root_.scala.Option[com.twitter.scrooge.test.gold.thriftscala.Request] = _root_.scala.Some(_item.request)
def unapply(_item: Args): _root_.scala.Some[com.twitter.scrooge.test.gold.thriftscala.Request] = _root_.scala.Some(_item.request)



Expand Down Expand Up @@ -685,7 +685,7 @@ object GoldService extends _root_.com.twitter.finagle.thrift.GeneratedThriftServ
ex
)

def unapply(_item: Result): _root_.scala.Option[_root_.scala.Tuple2[Option[com.twitter.scrooge.test.gold.thriftscala.Response], Option[com.twitter.scrooge.test.gold.thriftscala.OverCapacityException]]] = _root_.scala.Some(_item.toTuple)
def unapply(_item: Result): _root_.scala.Some[_root_.scala.Tuple2[Option[com.twitter.scrooge.test.gold.thriftscala.Response], Option[com.twitter.scrooge.test.gold.thriftscala.OverCapacityException]]] = _root_.scala.Some(_item.toTuple)



Expand Down Expand Up @@ -966,7 +966,7 @@ object GoldService extends _root_.com.twitter.finagle.thrift.GeneratedThriftServ
request
)

def unapply(_item: Args): _root_.scala.Option[com.twitter.scrooge.test.gold.thriftscala.Request] = _root_.scala.Some(_item.request)
def unapply(_item: Args): _root_.scala.Some[com.twitter.scrooge.test.gold.thriftscala.Request] = _root_.scala.Some(_item.request)



Expand Down Expand Up @@ -1193,7 +1193,7 @@ object GoldService extends _root_.com.twitter.finagle.thrift.GeneratedThriftServ
success
)

def unapply(_item: Result): _root_.scala.Option[_root_.scala.Option[com.twitter.scrooge.test.gold.thriftscala.Response]] = _root_.scala.Some(_item.success)
def unapply(_item: Result): _root_.scala.Some[_root_.scala.Option[com.twitter.scrooge.test.gold.thriftscala.Response]] = _root_.scala.Some(_item.success)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ object OverCapacityException extends ValidatingThriftStructCodec3[OverCapacityEx
chillTimeSeconds
)

def unapply(_item: OverCapacityException): _root_.scala.Option[Int] = _root_.scala.Some(_item.chillTimeSeconds)
def unapply(_item: OverCapacityException): _root_.scala.Some[Int] = _root_.scala.Some(_item.chillTimeSeconds)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ object PlatinumService extends _root_.com.twitter.finagle.thrift.GeneratedThrift
request
)

def unapply(_item: Args): _root_.scala.Option[com.twitter.scrooge.test.gold.thriftscala.Request] = _root_.scala.Some(_item.request)
def unapply(_item: Args): _root_.scala.Some[com.twitter.scrooge.test.gold.thriftscala.Request] = _root_.scala.Some(_item.request)



Expand Down Expand Up @@ -750,7 +750,7 @@ object PlatinumService extends _root_.com.twitter.finagle.thrift.GeneratedThrift
oce
)

def unapply(_item: Result): _root_.scala.Option[_root_.scala.Tuple3[Option[Int], Option[com.twitter.scrooge.test.gold.thriftscala.AnotherException], Option[com.twitter.scrooge.test.gold.thriftscala.OverCapacityException]]] = _root_.scala.Some(_item.toTuple)
def unapply(_item: Result): _root_.scala.Some[_root_.scala.Tuple3[Option[Int], Option[com.twitter.scrooge.test.gold.thriftscala.AnotherException], Option[com.twitter.scrooge.test.gold.thriftscala.OverCapacityException]]] = _root_.scala.Some(_item.toTuple)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ object Recursive extends ValidatingThriftStructCodec3[Recursive] with StructBuil
recRequest
)

def unapply(_item: Recursive): _root_.scala.Option[_root_.scala.Tuple2[Long, Option[com.twitter.scrooge.test.gold.thriftscala.Request]]] = _root_.scala.Some(_item.toTuple)
def unapply(_item: Recursive): _root_.scala.Some[_root_.scala.Tuple2[Long, Option[com.twitter.scrooge.test.gold.thriftscala.Request]]] = _root_.scala.Some(_item.toTuple)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ object Request extends ValidatingThriftStructCodec3[Request] with StructBuilderF
anInt8
)

def unapply(_item: Request): _root_.scala.Option[_root_.scala.Tuple15[_root_.scala.collection.Seq[String], _root_.scala.collection.Set[Int], _root_.scala.collection.Map[Long, Long], Option[com.twitter.scrooge.test.gold.thriftscala.Request], _root_.scala.collection.Seq[com.twitter.scrooge.test.gold.thriftscala.Request], String, Option[Long], Option[Long], Option[Long], Option[Long], Option[Long], Option[com.twitter.scrooge.test.gold.thriftscala.Recursive], String, Option[Long], Option[Byte]]] = _root_.scala.Some(_item.toTuple)
def unapply(_item: Request): _root_.scala.Some[_root_.scala.Tuple15[_root_.scala.collection.Seq[String], _root_.scala.collection.Set[Int], _root_.scala.collection.Map[Long, Long], Option[com.twitter.scrooge.test.gold.thriftscala.Request], _root_.scala.collection.Seq[com.twitter.scrooge.test.gold.thriftscala.Request], String, Option[Long], Option[Long], Option[Long], Option[Long], Option[Long], Option[com.twitter.scrooge.test.gold.thriftscala.Recursive], String, Option[Long], Option[Byte]]] = _root_.scala.Some(_item.toTuple)


private[thriftscala] def readAListValue(_iprot: TProtocol): _root_.scala.collection.Seq[String] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ object Response extends ValidatingThriftStructCodec3[Response] with StructBuilde
responseUnion
)

def unapply(_item: Response): _root_.scala.Option[_root_.scala.Tuple2[Int, com.twitter.scrooge.test.gold.thriftscala.ResponseUnion]] = _root_.scala.Some(_item.toTuple)
def unapply(_item: Response): _root_.scala.Some[_root_.scala.Tuple2[Int, com.twitter.scrooge.test.gold.thriftscala.ResponseUnion]] = _root_.scala.Some(_item.toTuple)



Expand Down
4 changes: 2 additions & 2 deletions scrooge-generator/src/main/resources/scalagen/struct.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ object {{StructName}} extends ValidatingThriftStructCodec3[{{StructName}}] with
def unapply(_item: {{StructName}}): Boolean = true
{{/arity0}}
{{#arity1}}
def unapply(_item: {{StructName}}): _root_.scala.Option[{{>optionalType}}] = _root_.scala.Some(_item.{{fieldName}})
def unapply(_item: {{StructName}}): _root_.scala.Some[{{>optionalType}}] = _root_.scala.Some(_item.{{fieldName}})
{{/arity1}}
{{#arityN}}
def unapply(_item: {{StructName}}): _root_.scala.Option[{{tuple}}] = _root_.scala.Some(_item.toTuple)
def unapply(_item: {{StructName}}): _root_.scala.Some[{{tuple}}] = _root_.scala.Some(_item.toTuple)
{{/arityN}}


Expand Down