scala-compiler Questions

1

Solved

During the running of a scala script, I would like it to generate some code and execute this. I thought I had found two examples online that might work, but they aren't successful import scala.refl...
Hallux asked 30/9, 2022 at 16:50

3

Solved

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...
Jorgensen asked 3/9, 2013 at 20:58

1

Solved

I have been stuck on this issue for a week and don't seem to be getting anywhere. I am trying to copy some methods and fields from one class to another. I have two phases that are involved in this....
Planospore asked 21/10, 2021 at 5:21

1

It is known in scala 2 that macros are strictly local and are only executed once, when the class is defined. This feature seems particularly weak when combining with abstract type, as the process t...
Ratcliff asked 25/4, 2021 at 21:1

2

Solved

I have a trait Foo[T, U] and a type-level algorithm that given an L <: HList and a target type U, tells me whether there exists T in L such that there is an implicit Foo[T, U] in scope. This is ...

1

Solved

I have the following code and I would like to compile it on the fly and run it. object HelloWorld { def main(args: Array[String]): Unit = { println("Hello, world!") } } So far I have tried so...
Gotten asked 16/9, 2019 at 21:56

2

Consider the default codec as offered in the io package. implicitly[io.Codec].name //res0: String = UTF-8 It's a "low priority" implicit so it's easy to override without ambiguity. implicit val...
Hun asked 1/4, 2019 at 19:29

1

Solved

I have a custom class, A, and I have defined some operations within the class as follows: def +(that: A) = ... def -(that: A) = ... def *(that: A) = ... def +(that: Double) = ... def -(that: Doub...
Paola asked 14/4, 2019 at 23:11

3

Solved

Let's consider following trait: sealed trait AB case class A(a: Int) extends AB case class B(b: Int) extends AB I am trying to collect to limit a collection to specific subclass. If I try to co...

4

Solved

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 ...
Mendelson asked 14/1, 2015 at 1:6

1

Consider the following snippet: trait X[-T] object Y extends X[Nothing] def a[T](x: X[T]): X[T] = x a(Y) Compilation of the above (2.12.3) fails with: type mismatch; found : Y.type required: X[...
Largess asked 9/10, 2017 at 9:6

2

Solved

So I googl'ed a bit, but no information other than the sparse: -Yrangepos Use range positions for syntax trees. Ok. And I know I need to use it if I want to capture source fragments in a macro. ...
Heterogenesis asked 1/9, 2017 at 20:41

2

Solved

Does the scala compiler optimize for memory usage by removing refs to vals used only once within a block? Imagine an object holding in aggregate some huge data - reaching a size where cloning dat...
Biogeography asked 22/11, 2015 at 9:25

3

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...
Rossner asked 22/4, 2015 at 0:15

1

Solved

When decompiling Scala files to Java code, one often comes across classes that are annotated with the ScalaSignatures. These seem to only have one annotation value, a somewhat encoded String. Why d...
Incommunicado asked 25/3, 2015 at 21:49

5

Solved

The error in Test.test seems unjustified: sealed trait A[-K, +V] case class B[+V]() extends A[Option[Unit], V] case class Test[U]() { def test[V](t: A[Option[U], V]) = t match { case B() =>...
Ideation asked 12/6, 2013 at 17:59

2

Solved

I want to design a Scala program that accepts Scala files as parameters which can customize the execution of the program. In particular, I want to supply at runtime files that contain implementatio...
Rosenberry asked 26/5, 2014 at 16:24

2

Solved

I want my Scala code to take a Scala class as input, compile and execute that class. How can I programmatically invoke a Scala compiler? I will be using the latest Scala version, i.e. 2.10.
Juice asked 2/12, 2013 at 7:1

1

Solved

I'm trying to run a Scala application packed as JAR (including dependencies) but this fails until the Scala library is added by using the -Xbootclasspath/p option. Failing invocation: java -jar /...
Suppositive asked 9/8, 2013 at 16:0

2

The scala compiler should generate warnings for the if statements I've commented on below, but it doesn't. Why? sealed trait T object A extends T val s:Seq[T] = Seq(A) val result = s.map { //Th...
Fenny asked 23/4, 2013 at 18:10

1

Solved

I'm trying to write a Scala compiler plugin that will allow extremely general code generation: something like the generality of the C preprocessor, but a bit more typesafe (I'm not sure if this is ...
Leone asked 14/3, 2013 at 5:38

1

Solved

I have a Scala 2.9 compiler plugin (source code) and works just fine in 2.9 but does not even compile with 2.10. There are dozens (maybe 100+) of errors all of the same kind such as: [scalac] C:\...
Swansdown asked 16/1, 2013 at 20:26

2

Solved

What is the "Scala Presentation Compiler"?
Leptospirosis asked 27/2, 2012 at 16:20
1

© 2022 - 2024 — McMap. All rights reserved.