scalac - Compiler for the Scala 2 language
Questions tagged [scalac]
176 questions
0
votes
1 answer
yet another elusive non exhaustive match
I get the following match warning.
"match may not be exhaustive. It would fail on the following input: Some((x: Abstract forSome x not in (A, B, C)))"
code:
abstract class Abstract
case class A() extends Abstract
case class B() extends…

matanster
- 15,072
- 19
- 88
- 167
0
votes
1 answer
Main method invocation in scala nsc
I was trying to go through the code for nsc(new scala compiler). I am a little confused about Main.scala. It is implemented as follows:
/* NSC -- new Scala compiler
* Copyright 2005-2013 LAMP/EPFL
* @author Martin Odersky
*/
package…

sc_ray
- 7,803
- 11
- 63
- 100
0
votes
0 answers
Scala compiler with space in classpath
scalac D:\temp\main.scala works
scalac "D:\Programming\Java works\my project\main.scala" returns this error:
works\my was unexpected at this time
I think the problem is caused by spaces in path.
How can I resolve this problem (I would not remove…

Alex 75
- 2,798
- 1
- 31
- 48
0
votes
1 answer
scala compiler's stackoverflow protection
In runtime I can:
def X(R: Any): Any = X(R)
But can't do simmilar thing for compile-time:
scala> type X[R] = X[R]
:11: error: illegal cyclic reference involving type X
type X[R] = X[R]
^
Seems like infinite…

dk14
- 22,206
- 4
- 51
- 88
0
votes
3 answers
How to compile this Scala code
I have a file called sumit.scala with the following contents
object sumit {
def main(args: Array[String]) = {
val start:Double = System.nanoTime
total_select_values(1 to 15000, {e => true})
val end:Double =…

user2386854
- 173
- 1
- 11
0
votes
2 answers
Scala: Difference between file.class and file$.class from scalac
When I use scalac to compile file.scala, I end up with 2 outputs, file.class and file$.class. What is the difference between these files and which is the appropriate one to then run? I get distinctly different error messages between executing…

J Calbreath
- 2,665
- 4
- 22
- 31
0
votes
1 answer
scalac for Call-by-Name use references
I have some function:
def f(x: Int) = x * x
and then I call it:
var y = 0
f { y += 1; y }
Bytecode generated for above code looks like:
0: iconst_0
1: istore_1
2: aload_0
3: iload_1
4: iconst_1 …

piobab
- 1,352
- 2
- 13
- 21
0
votes
2 answers
When anonfun$1 becomes anonfun$m1$1 (or vice versa) in Scala?
Can anyone explain why Scala gives two different names in the following cases? Why couldn't Scala give the same names in each case?! Is there some kind of consistency I don't know yet? It must be related to eta-expansion, right?
object A {
val ms:…

Jacek Laskowski
- 72,696
- 27
- 242
- 420
0
votes
2 answers
Compiling and running functions by name in Scala?
Following along in this Masters thesis[1] to learn parsing in Scala, but can't figure out how to get this example working (see pages 28-29):
import util.parsing.combinator.JavaTokenParsers
trait ArithParser extends JavaTokenParsers {
def expr:…

A T
- 13,008
- 21
- 97
- 158
0
votes
1 answer
Scala Compiler doesn't compile in ScalaIDE
I'm trying to develop on the Scala compiler project with the help of ScalaIDE. I followed this guide to set up the development environment. When I now try to build the mentioned projects, the reflect project won't get built. Instead, I get the…

sebastian_oe
- 7,186
- 2
- 18
- 20
0
votes
0 answers
How can scalac be used on a source with spaces in it?
The man page for the command (http://www.scala-lang.org/docu/files/tools/scalac.html) does not explain how to do this.
The obvious workaround it to simply change the file name to avoid spaces, but this is not a solution.
I am using windows and…

Sepia
- 447
- 6
- 21