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

Cannot use '_1' as a thrift identifier. #162

Open
janghwan opened this issue Dec 8, 2014 · 0 comments
Open

Cannot use '_1' as a thrift identifier. #162

janghwan opened this issue Dec 8, 2014 · 0 comments

Comments

@janghwan
Copy link

janghwan commented Dec 8, 2014

The native thrift allows underscore in variable name, but scrooge scala generator does not seem to handle it properly.

This thrift definition

struct StringTuple {
  1: string _1,
  2: string _2
}

generates

trait StringTuple
  extends ThriftStruct
  with scala.Product2[String, String]
  with java.io.Serializable
{
  import StringTuple._

  def _1: String
  def _2: String

  def _passthroughFields: immutable$Map[Short, TFieldBlob] = immutable$Map.empty

  def _1 = _1
  def _2 = _2
//...

, which is wrong obviously.
The identifiers need to be escaped as long as it uses scala.Product.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants