scalac - Compiler for the Scala 2 language
Questions tagged [scalac]
168 questions
51
votes
3 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]…
![](../../users/profiles/1845790.webp)
Ende Neu
- 14,921
- 5
- 50
- 67
36
votes
2 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…
![](../../users/profiles/316563.webp)
Jeriho
- 6,779
- 9
- 39
- 56
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…
![](../../users/profiles/9204.webp)
Alexey Romanov
- 154,018
- 31
- 276
- 433
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…
![](../../users/profiles/244526.webp)
dsg
- 12,504
- 19
- 64
- 109
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…
![](../../users/profiles/399685.webp)
Brian Pugh
- 277
- 3
- 6
24
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…
![](../../users/profiles/1509695.webp)
matanster
- 13,785
- 14
- 75
- 135
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…
![](../../users/profiles/540173.webp)
Madoc
- 5,641
- 4
- 22
- 38
14
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…
![](../../users/profiles/2813589.webp)
アレックス
- 24,309
- 37
- 129
- 229
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…
![](../../users/profiles/108915.webp)
ziggystar
- 26,526
- 9
- 63
- 117
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…
![](../../users/profiles/39110.webp)
eyberg
- 2,960
- 5
- 24
- 41
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…
![](../../users/profiles/1012046.webp)
Michael D. Moffitt
- 751
- 5
- 14
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):…
![](../../users/profiles/3626865.webp)
VoidBzY
- 197
- 2
- 9
10
votes
0 answers
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…
![](../../users/profiles/635473.webp)
Mohsen Kashi
- 4,102
- 3
- 38
- 61
10
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…
![](../../users/profiles/613973.webp)
adelbertc
- 6,965
- 10
- 42
- 65
10
votes
2 answers
How do I compile Scala Hello World application
I'm new to Scala, and I've never written or compiled a program in it before. I'm trying to simply run the following Hello World example, which I have saved in a file name scalaApp.scala
object scalaApp extends App {
def main(args: Array[String])…
![](../../users/profiles/1180763.webp)
Steven Edmunds
- 193
- 2
- 13