Questions tagged [scala-compiler]
135 questions
2
votes
0 answers
Slow Compilation when using Scala 2.12.1
We recently upgraded from Scala version 2.11.7 to 2.12.1. After the upgrade we noticed an increase in compilation time of around 10 mins. Reverting back to the old version reduces the compile time for the same code.
Has there been any performance…

Sashi
- 135
- 2
- 11
2
votes
0 answers
Scala compiler generates wrong method signature for Tuple[Int, _]
Scala compiler behaves weirdly with boxing/unboxing in tuples as parameters.
Consider the code:
scala> class Test { def test(p: (Int, String)) = println(p) }
defined class Test
scala> classOf[Test].getMethods()(0)
res2: java.lang.reflect.Method =…

tuxSlayer
- 2,804
- 2
- 20
- 24
2
votes
0 answers
Evaluation of source without returning a value
Twitter util library provides a nice utility for how to evaluate Scala code at runtime, for example:
val eval = new com.twitter.util.Eval()
val example = eval.apply("""
case class E() {
def one(): Int = 1
}
(new…

Dmitry F
- 1,650
- 1
- 15
- 20
2
votes
0 answers
Scala Compiler Plugin: How to access the specific type information of an override method in subclass?
I'm developing a Scala Compiler Plugin, trying to transform every function call like
myfuncall(1)
into
val newvalue = myfuncall(1)
newvalue
However, I get into trouble due when the function call is the return value of another function. Here's…

Yu Shi
- 65
- 1
- 5
2
votes
1 answer
In Scala, how to circumvent 'inferred type arguments do not conform' error?
I have a reflective function with implicit TypeTag parameter:
def fromOptionFn[R: TypeTag](self: Int => Option[R]): Wrapper[R] = {
println(TypeTag[R])
...
}
Which for unknown reason doesn't work (see How to make Scala type inference powerful enough…

tribbloid
- 4,026
- 14
- 64
- 103
2
votes
0 answers
Extract all symbols defined in a scala source file using Scala Compiler API
I'm trying to extract all (but I'm mostly interested in classes/objects) symbols defined in a scala source file from a Java app using Scala Compiler API.
I'm able to compile a source file using scala.tools.nsc.Global.Run.compileSources, but how to…

Filipp
- 859
- 1
- 6
- 20
2
votes
2 answers
Is there a Scala compiler flag to warn when tail recursion is applied without annotation?
I would like the compiler to warn me when it applies tail recursion to one of my functions when I haven't told it to with the annotation. Is this possible?
Motivation: I very rarely write infinite loops as a matter of logic error, but I have done…

samthebest
- 30,803
- 25
- 102
- 142
2
votes
1 answer
Scalac hanging on phase typer of RegexParser
I have a scala program which among other things has a parser-combinator. This is done by extending scala.util.parsing.combinator.RegexParsers. I had developed it using Scala 2.10 and all was working fine.
Yesterday I upgraded my system to Scala…

jbx
- 21,365
- 18
- 90
- 144
2
votes
1 answer
How to compile scala 2.11.2 with bigger tupes?
I tried to build scala 2.11.2 with bigger tuples (arity over 22) by following this guide:
http://blog.rogach.org/2013/02/scala-tuplicity-comes-to-210.html
I have no previous experience with building the scala library & compiler and the ant build…

dante4d
- 53
- 1
- 5
2
votes
1 answer
presentation compiler: type completion in method call with more than one argument
I load source into compiler with askReload, and then i try to call askTypeCompletion after . (dot).
Completion in first case (method with 2 arguments) is not working, but completion in method call with one arg works as expected.
val list =…

wedens
- 1,782
- 14
- 18
2
votes
0 answers
What is the difference between IMain and Global.Run in Scala?
I would like to interpret Scala code from within Scala. I found two approaches on the web:
IMain e.g. here
Global.Run e.g. here
Is there a difference in performance? Also, I would like to get the results of the evaluation.

Karsten
- 882
- 6
- 18
2
votes
1 answer
What are the compiler generated implicit values in Scala 2.10?
In the Scala reflection guide is written the following:
As with Manifests, one can in effect request that the compiler
generate a TypeTag. This is done by simply specifying an implicit
evidence parameter of type TypeTag[T]. If the compiler…

jhegedus
- 20,244
- 16
- 99
- 167
2
votes
1 answer
Scala compiler never ending compilation
I noticed my Scala IDE consuming all the available CPU... I tried to compile the project via SBT from the command line and I got the same situation.
How can I get to know what's going wrong? Is there a way to find out what file or class/object/trait…

Max
- 2,508
- 3
- 26
- 44
2
votes
1 answer
Scala runtime plugin system
I'm working on simple application server and i want to make extending plugin system. For building plugins i'm planning create special wizard that will generate scala source files. I'm want automatic compilation and loading this files for include…
user443426
2
votes
3 answers
How are final val defined inside a trait treated by Scala Compiler?
I use very often the selfless trait pattern and I need to use "expensive" constants inside the trait:
I would like to have a single instance of these values, which might require several steps to be computed, in all my application.
However, the…

Edmondo
- 19,559
- 13
- 62
- 115