Questions tagged [scala-compiler]
135 questions
0
votes
2 answers
How do I bind types into my Scala Interpreter?
I am trying to bind values into an interpreter with types from an external library.
This is how I am currently declaring my interpreter:
val interpreter = new IMain({
val settings = new Settings
settings.usejavacp.value = true
…

Robby Zambito
- 3
- 2
0
votes
0 answers
In scala, why this implicit parameter cannot be inferred from the same scope?
I'm writing a simple Apache Spark utility that automatically creates an AccumulatorV2 based on provided initial value:
import java.lang
type Acc[T] = AccumulatorV2[T, T]
implicit val long1: Long => Acc[lang.Long] = _ => new…

tribbloid
- 4,026
- 14
- 64
- 103
0
votes
1 answer
Scala compiler throws "internal" type mismatch error without giving error location
I'm compiling a project that has 77 Scala files with scala 2.10.5.
I got 0 warning and 1 weird error message:
[ERROR] type mismatch;
found : Array[?B]
required: scala.collection.GenTraversableOnce[?]
Note that implicit conversions are not…

tribbloid
- 4,026
- 14
- 64
- 103
0
votes
1 answer
scala compiler plugin development best practice
Iterating on my compiler plugin's code, I am publishing my compiler plugin to my local ivy repository after each compilation of it (via publishLocal), and then running my other project where a dependency upon this plugin is defined via…

matanster
- 15,072
- 19
- 88
- 167
0
votes
0 answers
object scala in compiler mirror not found - running Scala compiler programatically [no sbt - no IDE]
[EDIT : add precisions asked in comments]
I'm trying to run the compiler programatically and get a "Missing dependency 'object scala in compiler mirror'" error.
I found this post object scala in compiler mirror not found - running Scala compiler…

lorilan
- 311
- 1
- 9
0
votes
2 answers
obtaining the source of a case class's automatically generated methods
How can one obtain the code of all automatically generated methods of a case class, to cleanly preserve any of them when refactoring to a regular (non-case) class? is there some compilation flag that reveals the case class's auto-generated methods,…

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
1 answer
Scalac hanging in phase typer
I am having a problem with 2.10.3 and code generated by Slick (Codegen). It seems very similar to
Scalac hanging on phase typer of RegexParser
Other files generated by Codegen work, but this one just hangs forever in "scalac: phase typer…

opus111
- 2,744
- 4
- 25
- 41
0
votes
1 answer
What does `[ERROR] Nothing <: com.some.SomeType?` mean?
I have a project with scala and java. For scala compilation scala-maven-plugin is used.
So during the build there are some messages like that:
[INFO] --- scala-maven-plugin:3.1.6:testCompile (scala-test-compile) @ project_name ---
...
[ERROR]…

Cherry
- 31,309
- 66
- 224
- 364
0
votes
1 answer
scala tools nsc: set compiler flags in compiler settings
I have the following code:
def compile(target: String, srcs: Seq[String]): Unit =
{
import scala.tools.nsc._
val settings = new Settings
settings.outputDirs.setSingleOutput(target)
val comp = new Global(settings)
val crun:…

Rich Oliver
- 6,001
- 4
- 34
- 57
0
votes
1 answer
How does the case by type work in scala?
I know about case classes, pattern matching, unapply and PartialFunction, but I'm confused about bellow macros snippet.
val declarations = weakTypeOf[T].declarations
val methods = declarations.collect { case m: MethodSymbol => m }
Scaladoc of…

sh1ng
- 2,808
- 4
- 24
- 38
0
votes
1 answer
I'm not able to call classes from scala AST. The classes are not being found
I want to know how to create nodes so that they instantiate classes in the code. Currently it's not able to recognize the nodes if I modify the code.
object Test{
def main(args: Array[String]) {
val a= new Avi;
}
}
class Avi{}
class pra{}
In…

Avinash Varma
- 43
- 3
0
votes
1 answer
Upgrade scala to "2.10.3" but my jar file only display "2.10"
I do specify scalaVersion := "2.10.3" in my build.sbt, but after ./sbt package I got my package as myapp_2.10-1.0.0.jar.
Doesn't it suppose to be myapp_2.10.3-1.0.0.jar ??
Is there any parameter I need to change as well ?
Thanks!

James
- 59
- 3
0
votes
1 answer
Why do my bytes appear to get corrupted when I try to write them from inside if statements or pattern matches
I'm playing with Pickled Scala signatures, writing bytes to a PickleBuffer and reading them back out with ShowPickled.
I can write and read back an Int as expected by using
PB.myBuf.writeByte(2)
giving the '2' (a reference to an entry number in…

Julian Peeters
- 853
- 1
- 6
- 19
-1
votes
1 answer
Is it possible to override an inline function?
I am assuming that Scala compiler will inline the function after it has been overriden.

Dragonborn
- 1,755
- 1
- 16
- 37