Skip to content

Instantly share code, notes, and snippets.

@sir-wabbit
Last active August 14, 2018 04:44
Show Gist options
  • Select an option

  • Save sir-wabbit/f82224ffc33f8deac604b069f5ce3d1b to your computer and use it in GitHub Desktop.

Select an option

Save sir-wabbit/f82224ffc33f8deac604b069f5ce3d1b to your computer and use it in GitHub Desktop.
// All of these compile in Dotty
// https://scastie.scala-lang.org/pLOvDSM8QNy7yNfvOhZ6xQ
class I0(i: Int) {
def this() = this()
}
object I1 {
val t : Int = 10
def this(I1: Int) = { this() }
}
// https://github.com/lampepfl/dotty/issues/4936
abstract object I2 {
val t : Int = 10
}
abstract class I3 {
lazy val t: String
}
abstract class I3_1 extends I3 {
// override val t: String = ""
}
// https://github.com/lampepfl/dotty/issues/4936
sealed abstract object I4 { }
trait I5 {
type I1 >: Null <: i2
trait i3
type i2 <: i3
}
trait I6[i1]
object I6 extends I6
class I7(val I1: Int) {
def I1(x: I7) = x match {
case Tuple1 => // no warnings
}
}
// https://github.com/lampepfl/dotty/issues/4935
object I8 {
val (A, B) = ()
}
object I9 {
def unapply(I0: List[Int]) = I0 match {
case 1 :: List(8, map: _*) => map
case _ => I0
}
}
// https://github.com/lampepfl/dotty/issues/4934
object I10 {
def main: Unit = {
val I1 = false
""); // yes, there is an extra closing parenthesis
}
}
object I11 {
def foo: Unit = {
val i1 = Nil map { case (_: Any) => } _
val i2 : Int = i1 // found: List[Unit](i1); required: Int
}
}
object App {
def main(args: Array[String]): Unit = {
println(I2.t)
// println(I8.A) // value `A` is not a member of I8
// println(I8.b) // if you change B to b, you'll get a different error
println(I9.unapply(List(1, 8, 9, 10)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment