Questions tagged [scalac]

scalac - Compiler for the Scala 2 language

176 questions
1
vote
2 answers

Specification of Scala compiler's intermediate code

Is there any formal specification or detailed description of the intermediate code generated by the Scala compiler (i.e. passing the -Xprint-icode option to scalac)? Thanks.
ale64bit
  • 6,232
  • 3
  • 24
  • 44
1
vote
3 answers

how do I build with scalac using Leon's library?

I am trying to compile my Leon code using scalac directly. Unfortunately, I was not able to properly build the Leon library on which the code depends. For instance, I have run scalac $(find ~/my-path/leon/library/ -name "*.scala" | xargs)…
mdemarne
  • 31
  • 4
1
vote
1 answer

Scala: Can object Reference pass through nested functions?

In Scala, one passes pointers to objects, not the objects themselves. Is it correct to say then, that there is no problem with passing an object pointer through nested functions as below, i.e. there wont be layers of objects allocated? case class…
Azeli
  • 698
  • 7
  • 16
1
vote
1 answer

Finding type signatures of all non-synthetic methods/functions in Scala

I'm trying to find a way to get at the symbol table (?) of the Scala compiler and dump all the type information on the methods/functions in say, a particular SBT project. The current direction I'm going is a compiler plugin, hooking into it right…
adelbertc
  • 7,270
  • 11
  • 47
  • 70
1
vote
2 answers

Scala unexpected type inference troubleshooting

I'm struggling a long time with incorrect type inference of the O output type. Why does scalac see Int instead of (Int,String) ? : trait Request[I,+O,C[_]] case class Get[I, O, C[_]](storeName: String, arg: C[I]) extends Request[I,(I,O),C] object…
lisak
  • 21,611
  • 40
  • 152
  • 243
1
vote
1 answer

Scala: What's the easiest way to #include a file

What's the easiest way to include a file in a Scala source file? Scala lacks first class imports and deports. I like to structure my package / project dependencies in a form of quasi multiple inheritance. For me this really helps in producing clean…
Rich Oliver
  • 6,001
  • 4
  • 34
  • 57
1
vote
0 answers

How do I interpret this Scala explaintypes message?

IntelliJ with the "explain types" compiler option enabled emits the following error message: Warning: scala <:<[Array[Z],Array[Z]] <: Array[Z] => scala.collection.GenTraversableOnce[?]? Warning: Warning: scala: false I suspected that IntelliJ was…
Dan Barowy
  • 2,270
  • 24
  • 35
1
vote
0 answers

Test for non-compilability - scala

I added a typesafety improvement in my code. Now I want to test, that some code won't compile. Is it somehow possible to run the scala compiler inside the test, feed it some code and match for non-compilability?
ryskajakub
  • 6,351
  • 8
  • 45
  • 75
1
vote
1 answer

How can I generate my own ScalaSig?

I've dynamically defined a Scala class, but in order to use it "properly" it needs to have a ScalaSig. So, how might I generate a ScalaSig outside of normal compilation? Perhaps from a tree? Maybe like: val tb =…
Julian Peeters
  • 853
  • 1
  • 6
  • 19
1
vote
1 answer

Fixing sbt OutOfMemoryError on Travis CI

I have an sbt project that builds fine locally (because I have the SBT_OPTS="-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:PermSize=256M -XX:MaxPermSize=512M" in my ~/.sbtconfig) but the scala compiler runs out of memory on Travis CI. Is…
pathikrit
  • 32,469
  • 37
  • 142
  • 221
1
vote
1 answer

Scala no-op that is guaranteed not to be optimised away?

You can set a breakpoint on the closing } of a Scala method, but it's pointless to do so because it won't be hit, apparently. I would still like to set it there. So I thought, "how about I put in a no-op before that line, and set a breakpoint on…
Robin Green
  • 32,079
  • 16
  • 104
  • 187
1
vote
0 answers

How do I install a Scala compiler plugin so that it automatically works with Ant?

I'm writing a Scala compiler plugin that I want to be used whenever scalac is invoked, so I put it in the Scala distribution's plugins directory (misc/scala-devel/plugins) - this works perfectly when I write something simple like scalac…
Stuart Golodetz
  • 20,238
  • 4
  • 51
  • 80
0
votes
3 answers

Compiling Scala scripts. How works a Scala script?

Groovy Groovy comes with a compiler called groovyc. For each script, groovyc generates a class that extends groovy.lang.Script, which contains a main method so that Java can execute it. The name of the compiled class matches the name of the script…
Arturo Herrero
  • 12,772
  • 11
  • 42
  • 73
0
votes
0 answers

How to patch scala compiler classes in an sbt project?

I am stumped. It should be a non-issue. I took a patch from Scala 2 repository for a bug which crashes the compiler, compiled those classes separately against "scala-lang" % "scala-compiler" % "2.13.10" and packed into a jar. Then I tried to put…
Turin
  • 2,208
  • 15
  • 23
0
votes
1 answer

Scala case class method: `public scala.collection.Iterator productElementNames()`

if we have a look into the bytecode produced by this case class compilation case class Person(name: String, age: Int) we get besides others this method: public scala.collection.Iterator productElementNames(); So, the question…
apnmrv
  • 21
  • 3