bug
bug copied to clipboard
Scala 2 bug reports only. Please, no questions — proper bug reports only.
The following produces a bad classfile, both with 2.9.1 and latest nightly. ```scala object test { def main(args: Array[String]): Unit = { var out = 1 trait Trait { def...
implicit def x[T, U](value: U)(implicit fn: U => T): Option[T] not usable as implicit U => Option[T]
This code does not compile : ```scala object Sample extends App{ import scala.language.implicitConversions implicit def asOptional[T, U](value: U)(implicit fn: U => T): Option[T] = Some(fn(value)) case class A(v:Option[Double]) A(asOptional(1)) A(1)...
We could at least expose the `defaultGetter` method from NamesDefaults.scala: https://github.com/scala/scala/blob/f5357d98a2adfada4998fcdaea680ddc6d8460f8/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala#L424. Not sure how invocations will work though, because they might need stuff from lexical scope.
```scala import scala.language.experimental.macros import scala.reflect.macros.TypecheckException import scala.reflect.macros.whitebox.Context object Macros { def typecheck_impl(c: Context)(code: c.Expr[String]): c.Expr[Option[String]] = { import c.universe._ val Expr(Literal(Constant(codeStr: String))) = code try { c.typecheck(c.parse(codeStr)) c.Expr(q"None: Option[String]") }...
Problem occurred when I'm trying to instantiate following class (with self-type construct) by the means of anonymous class (`new Foo {...}`) ```scala type F0 = { def apply() : Unit...
```scala Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102). Type in expressions for evaluation. Or try :help. scala> val (a, b) = (getClass, getClass) :11: warning: inferred...
Scalac 2.12 got an assertion failure compiling the following code snippet. It seems to be a recent regression since scalac version 2.11.8 can compile the code. The case is generated...
Given these equivalent Scala and Java sources, and compilers running on JDK 17: ``` $ cat Main.scala import jdk.jfr.internal.Repository class Main {} $ cat Main.java import jdk.jfr.internal.Repository; public class Main...
```scala class C(x: Int = 0, y: Int = 0)(implicit blup: String) class D extends C(y = 1) ``` The compiler reports the missing implicit and then crashes ``` /Users/luc/code/scala/scala13/sandbox/T.scala:2:...
```scala object Node { trait Root { self: Node => val root = this } } trait Node { def root: Node } final class RootNode extends Node with Node.Root...