Questions tagged [scalac]

scalac - Compiler for the Scala 2 language

176 questions
3
votes
1 answer

Omit package names in Scala compilation errors

Our package names are quite long, and when you include the fact that there can be multiple type parameters in types mentioned in a type mismatch error, some of the compilation errors I get from scalac can be quite long, and it is annoying having to…
Robin Green
  • 32,079
  • 16
  • 104
  • 187
3
votes
0 answers

How to decode Scala compiler generated names

Our code is killing the Scala compiler with this message: [error] how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name: scala/Tuple2$mcJD$sp To figure it out I'm trying to understand…
Daniel Darabos
  • 26,991
  • 10
  • 102
  • 114
3
votes
1 answer

How to use fsc with sbt?

Related question: Does SBT use the Fast Scala Compiler (fsc)? Can fsc be used with sbt; would it be practical; and if so, how to integrate fsc into sbt?
Dominykas Mostauskis
  • 7,797
  • 3
  • 48
  • 67
3
votes
1 answer

class SomeClass in package x cannot be accessed in com.a.y.x

I'm attempting to un-Spring IoC several Java classes and load them directly in some Scala code. Naturally I'm finding that there are name space conflicts between a package like com.a.x.SomeClass and com.a.y.x.SomeClass I've tried using the import…
n0741337
  • 2,474
  • 2
  • 15
  • 15
3
votes
1 answer

Why does scalac not optimize away the overhead in simple `for` constructs?

Here's an example of a snippet of code that, at first impression, looks like something that scalac could easily optimize away: val t0 = System.nanoTime() for (i <- 0 to 1000000000) {} val t1 = System.nanoTime() var i = 0 while (i < 1000000000) i +=…
Erik Kaplun
  • 37,128
  • 15
  • 99
  • 111
3
votes
1 answer

Scala Compiler crash: What's wrong here?

I was starting to write a unit test for an X500PrincipalBuilder class in Scala. Here's my test code: import org.junit.runner.RunWith import org.scalatest.WordSpec import org.scalatest.junit.JUnitRunner import…
Christian Schlichtherle
  • 3,125
  • 1
  • 23
  • 47
3
votes
2 answers

Why does Scalac type mismatch expect Int?

I was working on a project last night, and had some code like this: /* fixes warnings in 2.10 */ import scala.language.implicitConversions /* had some kind of case class with some members */ case class Wrapper[A](x: A) /* for convenience's sake…
jroesch
  • 1,170
  • 7
  • 16
3
votes
1 answer

-Xdisable-assertions and -Xelide-below not turning off asserts

I'm currently working on a Scala project, that is using SBT, and I'm trying to produce production build settings in which one of the conditions are all asserts are turned off. I simply added the line, to my build.sbt: scalacOptions ++= Seq(...,…
jroesch
  • 1,170
  • 7
  • 16
3
votes
2 answers

How does Scala handle Java style package statements

This sounds embarrassing. My purpose is to understand how Scala treats package statements, written in the Java style. To this end, I wrote up a little example class (that I named DinnerTimeP.scala as below: package dinnertime class Dinner { val…
ilango
  • 1,277
  • 3
  • 13
  • 19
3
votes
1 answer

Why does Scala's Compiler show Scala specific features with "-print" Option?

The help menu of the Scala compiler (2.9.2) says -print Print program with Scala-specific features removed. But the following call with the -print option shows Scala-specific features: C:\Users\John\Test Scala Project\src\main\scala>type…
John Threepwood
  • 15,593
  • 27
  • 93
  • 149
2
votes
1 answer

Assertion failed: Invalid interfaces in / assertion failed: ClassBType.info not yet assigned

I fall on this two errors during compilation of my test part and unfortunately my attemps to find any hint to solve these issues failed. I tried to clean, rebuild from scratch without any success. I compiled with and without my idea with same…
KyBe
  • 842
  • 1
  • 14
  • 33
2
votes
1 answer

Cannot compile and run multiple files in Scala

i am new to scala I have two scala example files under same directory one is: package chap10 import Element.elem abstract class Element { def contents: Array[String] def height: Int = contents.length def width: Int = if (height == 0)…
Aaron Wei
  • 85
  • 1
  • 5
2
votes
0 answers

ERROR Input length = 1 using sbt 1.2.8 scala 2.12.10 play 2.8.1

I'm developing a Play! application using sbt 1.2.8 scala 2.12.10 I'm trying to upgrade Play from 2.7.4 to 2.8.1, but during compilation I get [error] Input length = 1. No stack trace, nothing. It was compiling up until 2.7.4. I've found…
2
votes
1 answer

stopping Scala compilation after a particular phase

I'm testing my plugin by running it in-process like this: type PluginMessage = StoreReporter#Info def runPlugin(fileName: String): List[PluginMessage] = { val settings = new Settings settings.outputDirs setSingleOutput (curDir +…
Yuvi Masory
  • 2,644
  • 2
  • 27
  • 36
2
votes
0 answers

Implicit conversions applied where not required

Scala apply implicit conversions where not required and make compilation fail with "Type mismatch" error. Example: import scala.language.implicitConversions case class Result(value: String) implicit def intToResult(v: Int): Result =…
David Geirola
  • 616
  • 3
  • 17