scalac - Compiler for the Scala 2 language
Questions tagged [scalac]
176 questions
53
votes
5 answers
-Ywarn-unused-import triggering on play routes file
I want to be able to use -Xfatal-warnings and -Ywarn-unused-import, the problem is that the compiler is triggering an error on the file which contains the play routes for my application:
[error] /path/to/app/conf/routes: Unused import
[error]…

Ende Neu
- 15,581
- 5
- 57
- 68
37
votes
3 answers
How can I find a description of scala compiler flags/options?
How can I find all of the flags for the latest scalac version? After googling for hours I have found only outdated docs. (for example, they don't even mention "-feature" flag).
Is there any way to obtain the list of compiler flags with descriptions…

Jeriho
- 7,129
- 9
- 41
- 57
32
votes
1 answer
Log implicits only for "diverging implicit expansion"s
Other answers suggest using "-Xlog-implicits" option for debugging "diverging implicit expansion" errors. However, it also logs a lot of implicits in places unrelated to these errors. Is there some way to limit it to only explain places which…

Alexey Romanov
- 167,066
- 35
- 309
- 487
25
votes
3 answers
Extracting the complete call graph of a scala project (tough one)
I would like to extract from a given Scala project, the call graph of all methods which are part of the project's own source.
As I understand, the presentation compiler doesn't enable that, and it requires going down all the way down to the actual…

matanster
- 15,072
- 19
- 88
- 167
24
votes
4 answers
What is the order of the scala compiler phases?
I want to sharpen my picture of the phases of scala compilation. I know that certain things have to happen in the compiler, but don't really know the order in which they happen and how the order should affect my programming.
Am I right in saying…

dsg
- 12,924
- 21
- 67
- 111
24
votes
5 answers
How do I disambiguate in Scala between methods with vararg and without
I'm trying to use the java jcommander library from Scala. The java JCommander class has multiple constructors:
public JCommander(Object object)
public JCommander(Object object, ResourceBundle bundle, String... args)
public…

Brian Pugh
- 277
- 3
- 6
15
votes
2 answers
sbt 0.12.4 - there were x feature warning(s); re-run with -feature for details
I get an error there were 15 feature warning(s); re-run with -feature for details :
$ /usr/local/sbt/bin/sbt
[info] Loading project definition from /home/alex/Documents/projects/my_app123/project
[info] Set current project to sbt-android (in…

Incerteza
- 32,326
- 47
- 154
- 261
14
votes
2 answers
How do I turn off the Scala Fast Compilation server's (FSC) timeout?
I am using a Scala compilation server. This is probably not related to my IDE IntelliJ IDEA, but I will just inform you that I start the Scala compilation server through a special run configuration in that IDE.
After some time that goes by without…

Madoc
- 5,841
- 4
- 25
- 38
13
votes
1 answer
What is the performance impact of using the type class pattern in Scala
I'm currently making extensive use of the type class pattern in to be performance-relevant portions of my code. I made out at least two potential sources of inefficiency.
The implicit parameters get passed along message calls. I don't know whether…

ziggystar
- 28,410
- 9
- 72
- 124
13
votes
1 answer
Add Scala 3.0 SDK to IntelliJ
Currently, the dotty compiler released its first Release Candidate and will be released in the next few months.
I updated the IntelliJ scala plugin to EarlyAccess to make it working with Scala 3.0, its problem with syntax highlighting resolved, but…

Nik Kashi
- 4,447
- 3
- 40
- 63
13
votes
1 answer
How do I alias the scala setter method 'myvar_$eq(myval)' to something more pleasing when in java?
I've been converting some code from java to scala lately trying to teach myself the language.
Suppose we have this scala class:
class Person() {
var name:String = "joebob"
}
Now I want to access it from java so I can't use dot-notation like I…

eyberg
- 3,160
- 5
- 27
- 43
13
votes
1 answer
Scala nondeterministic / caches classes?
I have a very simple goal: to compile a Scala class, and then load it from within another Scala script. The problem is that Scala seems to cache (not sure where) the classes that I create, and doesn't respect subsequent changes.
The following lines…

Michael D. Moffitt
- 781
- 5
- 15
12
votes
2 answers
Implicit conversion from Int to Double in scala doesn't work
I have written some implicit code as shown below, and I am wondering why the i2d function implicit conversation isn't invoked.
object Test {
implicit def i2d(x: Int): Double = {
println("foo")
x.toDouble
}
implicit def d2i(x: Double):…

VoidBzY
- 307
- 3
- 9
11
votes
4 answers
object scala in compiler mirror not found - running Scala compiler programmatically
Running w/ a simple SBT project w/ Java 7 (details below) and invoking sbt run at the command line (no IntelliJ or anything)
source
import scala.tools.nsc.{ Global, Settings }
object Playground extends App {
val compiler = new Global(new…

adelbertc
- 7,270
- 11
- 47
- 70
10
votes
1 answer
re-run with -feature for details, How to see scala feature warnings when building with gradle?
The gradle scala plugin adds the compileScala task to the project. But sometimes the scala compiler might report something like the following:
$ gradle compileScala
:compileJava UP-TO-DATE
:compileScala
[ant:scalac] warning: there were 3 feature…

axiopisty
- 4,972
- 8
- 44
- 73