Quantcast

Been hitting a weird scala bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Been hitting a weird scala bug

Rodrigo Cano
Hi,

When using scopt for commnad line arguments parsing, I'm getting this scalac error:

not found: value x                                                                          
     arg[String]("kuduNode").action((x, c) => c.copy(kuduNode = x)).
                                                                ^

kuduNode is a simple String. It also doesn't matter what I try to put there, it always says not found, even if I try to put c (which makes no sense as its a different type), it still says that the value doesn't exists.

It does get weirder though, because it doesn't happen all the time, until it starts happening, and then I can't make it stop, even undoing the changes that triggered it or cleaning the target directory. When one of those options starts doing that (they all do in cascade if I fix that one). I also start getting

not found: type $anon                                                                       
   val cliArgs = new scopt.OptionParser[CliArgs]("kudu-csv-uploader") {
                                  ^
Where anon is obviously compiler generated. This is happening in 2.12.1 as well as 2.11.8 and 2.10.6.

No idea how to debug this and the only solution is not using the handy copy method.

Has anyone encountered something similar?

Cheers.

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Been hitting a weird scala bug

Rodrigo Cano
Update,

For whatever reason, the compilation error is triggered by a valid usage of a field in the returned case class. Like

case class CliArgs(...)

val cliArgs = new scopt.OptionParser[CliArgs](...) {
  //declare options here for the fields in CliArgs
 ...
}.parse(args, CliArgs()).getOrElse(sys.exit(1))

cliArgs.oneField //← this usage causes the scalac error at one of the opt definitions.

This is the whole snippet that I'm is causing it: http://pastebin.com/LzZtvad4

On Mon, Jan 9, 2017 at 1:09 PM, Rodrigo Cano <[hidden email]> wrote:
Hi,

When using scopt for commnad line arguments parsing, I'm getting this scalac error:

not found: value x                                                                          
     arg[String]("kuduNode").action((x, c) => c.copy(kuduNode = x)).
                                                                ^

kuduNode is a simple String. It also doesn't matter what I try to put there, it always says not found, even if I try to put c (which makes no sense as its a different type), it still says that the value doesn't exists.

It does get weirder though, because it doesn't happen all the time, until it starts happening, and then I can't make it stop, even undoing the changes that triggered it or cleaning the target directory. When one of those options starts doing that (they all do in cascade if I fix that one). I also start getting

not found: type $anon                                                                       
   val cliArgs = new scopt.OptionParser[CliArgs]("kudu-csv-uploader") {
                                  ^
Where anon is obviously compiler generated. This is happening in 2.12.1 as well as 2.11.8 and 2.10.6.

No idea how to debug this and the only solution is not using the handy copy method.

Has anyone encountered something similar?

Cheers.

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Been hitting a weird scala bug

Rodrigo Cano
The bug seems to be triggered by having OptionParser be an anonymous class, replacing that inline usage with an object that extends the parser and then doing myParser.parse(...).getOrElse(...) works.

On Mon, Jan 9, 2017 at 1:21 PM, Rodrigo Cano <[hidden email]> wrote:
Update,

For whatever reason, the compilation error is triggered by a valid usage of a field in the returned case class. Like

case class CliArgs(...)

val cliArgs = new scopt.OptionParser[CliArgs](...) {
  //declare options here for the fields in CliArgs
 ...
}.parse(args, CliArgs()).getOrElse(sys.exit(1))

cliArgs.oneField //← this usage causes the scalac error at one of the opt definitions.

This is the whole snippet that I'm is causing it: http://pastebin.com/LzZtvad4

On Mon, Jan 9, 2017 at 1:09 PM, Rodrigo Cano <[hidden email]> wrote:
Hi,

When using scopt for commnad line arguments parsing, I'm getting this scalac error:

not found: value x                                                                          
     arg[String]("kuduNode").action((x, c) => c.copy(kuduNode = x)).
                                                                ^

kuduNode is a simple String. It also doesn't matter what I try to put there, it always says not found, even if I try to put c (which makes no sense as its a different type), it still says that the value doesn't exists.

It does get weirder though, because it doesn't happen all the time, until it starts happening, and then I can't make it stop, even undoing the changes that triggered it or cleaning the target directory. When one of those options starts doing that (they all do in cascade if I fix that one). I also start getting

not found: type $anon                                                                       
   val cliArgs = new scopt.OptionParser[CliArgs]("kudu-csv-uploader") {
                                  ^
Where anon is obviously compiler generated. This is happening in 2.12.1 as well as 2.11.8 and 2.10.6.

No idea how to debug this and the only solution is not using the handy copy method.

Has anyone encountered something similar?

Cheers.


--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Been hitting a weird scala bug

som-snytt

It is this bug: https://issues.scala-lang.org/browse/SI-9171

On Monday, January 9, 2017 at 8:30:42 AM UTC-8, Rodrigo Cano wrote:
The bug seems to be triggered by having OptionParser be an anonymous class, replacing that inline usage with an object that extends the parser and then doing myParser.parse(...).getOrElse(...) works.

On Mon, Jan 9, 2017 at 1:21 PM, Rodrigo Cano <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="KdYSx7ytDwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ioni...@...> wrote:
Update,

For whatever reason, the compilation error is triggered by a valid usage of a field in the returned case class. Like

case class CliArgs(...)

val cliArgs = new scopt.OptionParser[CliArgs](...) {
  //declare options here for the fields in CliArgs
 ...
}.parse(args, CliArgs()).getOrElse(sys.exit(1))

cliArgs.oneField //← this usage causes the scalac error at one of the opt definitions.

This is the whole snippet that I'm is causing it: <a href="http://pastebin.com/LzZtvad4" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fpastebin.com%2FLzZtvad4\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFhRjKmKH1JlDmAVH-Ec_HUkSZIvg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fpastebin.com%2FLzZtvad4\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFhRjKmKH1JlDmAVH-Ec_HUkSZIvg&#39;;return true;">http://pastebin.com/LzZtvad4

On Mon, Jan 9, 2017 at 1:09 PM, Rodrigo Cano <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="KdYSx7ytDwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ioni...@...> wrote:
Hi,

When using scopt for commnad line arguments parsing, I'm getting this scalac error:

not found: value x                                                                          
     arg[String]("kuduNode").action((x, c) => c.copy(kuduNode = x)).
                                                                ^

kuduNode is a simple String. It also doesn't matter what I try to put there, it always says not found, even if I try to put c (which makes no sense as its a different type), it still says that the value doesn't exists.

It does get weirder though, because it doesn't happen all the time, until it starts happening, and then I can't make it stop, even undoing the changes that triggered it or cleaning the target directory. When one of those options starts doing that (they all do in cascade if I fix that one). I also start getting

not found: type $anon                                                                       
   val cliArgs = new scopt.OptionParser[CliArgs]("kudu-csv-uploader") {
                                  ^
Where anon is obviously compiler generated. This is happening in 2.12.1 as well as 2.11.8 and 2.10.6.

No idea how to debug this and the only solution is not using the handy copy method.

Has anyone encountered something similar?

Cheers.


--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Been hitting a weird scala bug

Rodrigo Cano
Thanks, good to know it is reported.

On Sat, Jan 21, 2017 at 12:01 AM, som-snytt <[hidden email]> wrote:

It is this bug: https://issues.scala-lang.org/browse/SI-9171

On Monday, January 9, 2017 at 8:30:42 AM UTC-8, Rodrigo Cano wrote:
The bug seems to be triggered by having OptionParser be an anonymous class, replacing that inline usage with an object that extends the parser and then doing myParser.parse(...).getOrElse(...) works.

On Mon, Jan 9, 2017 at 1:21 PM, Rodrigo Cano <[hidden email]> wrote:
Update,

For whatever reason, the compilation error is triggered by a valid usage of a field in the returned case class. Like

case class CliArgs(...)

val cliArgs = new scopt.OptionParser[CliArgs](...) {
  //declare options here for the fields in CliArgs
 ...
}.parse(args, CliArgs()).getOrElse(sys.exit(1))

cliArgs.oneField //← this usage causes the scalac error at one of the opt definitions.

This is the whole snippet that I'm is causing it: http://pastebin.com/LzZtvad4

On Mon, Jan 9, 2017 at 1:09 PM, Rodrigo Cano <[hidden email]> wrote:
Hi,

When using scopt for commnad line arguments parsing, I'm getting this scalac error:

not found: value x                                                                          
     arg[String]("kuduNode").action((x, c) => c.copy(kuduNode = x)).
                                                                ^

kuduNode is a simple String. It also doesn't matter what I try to put there, it always says not found, even if I try to put c (which makes no sense as its a different type), it still says that the value doesn't exists.

It does get weirder though, because it doesn't happen all the time, until it starts happening, and then I can't make it stop, even undoing the changes that triggered it or cleaning the target directory. When one of those options starts doing that (they all do in cascade if I fix that one). I also start getting

not found: type $anon                                                                       
   val cliArgs = new scopt.OptionParser[CliArgs]("kudu-csv-uploader") {
                                  ^
Where anon is obviously compiler generated. This is happening in 2.12.1 as well as 2.11.8 and 2.10.6.

No idea how to debug this and the only solution is not using the handy copy method.

Has anyone encountered something similar?

Cheers.


--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...