Skip to content

Remove dotty.runtime.LegacyApp #6763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 1 addition & 5 deletions compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
api.ClassLikeDef.of(name, acc, modifiers, anns, tparams, defType)
}

private[this] val LegacyAppClass = ctx.requiredClass("dotty.runtime.LegacyApp")

def apiClassStructure(csym: ClassSymbol): api.Structure = {
val cinfo = csym.classInfo

Expand Down Expand Up @@ -274,9 +272,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
// TODO: We shouldn't have to compute inherited members. Instead, `Structure`
// should have a lazy `parentStructures` field.
val inherited = cinfo.baseClasses
// We cannot filter out `LegacyApp` because it contains the main method,
// see the comment about main class discovery in `computeType`.
.filter(bc => !bc.is(Scala2x) || bc.eq(LegacyAppClass))
.filter(bc => !bc.is(Scala2x))
.flatMap(_.classInfo.decls.filter(s => !(s.is(Private) || declSet.contains(s))))
// Inherited members need to be computed lazily because a class might contain
// itself as an inherited member, like in `class A { class B extends A }`,
Expand Down
8 changes: 0 additions & 8 deletions library/src/dotty/runtime/LegacyApp.scala

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object B extends dotty.runtime.LegacyApp {
object B extends App {
println(A.`=`)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object E extends dotty.runtime.LegacyApp {
object E extends App {
assert(D.x == "3")
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object C extends dotty.runtime.LegacyApp {
object C extends App {
println(new B().foo(null))
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object C extends dotty.runtime.LegacyApp {
object C extends App {
println(new B().bar.x)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object C extends dotty.runtime.LegacyApp {
object C extends App {
println(new B().bar("")("").x)
}
2 changes: 1 addition & 1 deletion tests/disabled/existential/run/names-defaults.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import scala.language.{ higherKinds, existentials }

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
def get[T](x: T) = { println("get: "+ x); x }

// TESTS
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/existential/run/t0412.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(classOf[java.util.ArrayList[_]])
println(classOf[java.util.ArrayList[T] forSome { type T }])
}
2 changes: 1 addition & 1 deletion tests/disabled/existential/run/t0528.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class RichStr extends Sequ[Char] {
def toArray: Array[Char] = Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
val x: RichStr = new RichStr

println((x: Sequ[Char]).toArray.deep) // calling through the bridge misses unboxing
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/existential/run/t6443.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ object B extends A {
def foo(d: String)(d2: d.type): D forSome { type D <: Derived; type S <: Derived } = {d2.isEmpty; null} // Bridge method required here!
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
B.bar
}
2 changes: 1 addition & 1 deletion tests/disabled/long-running/t6253a.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import scala.collection.immutable.HashSet

object Test extends dotty.runtime.LegacyApp {
object Test extends App {

var hashCount = 0

Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/long-running/t6253b.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import scala.collection.immutable.HashSet

object Test extends dotty.runtime.LegacyApp {
object Test extends App {

var hashCount = 0

Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/long-running/t6253c.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import scala.collection.immutable.HashSet

object Test extends dotty.runtime.LegacyApp {
object Test extends App {

var hashCount = 0

Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/exprs_serialize.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
def test(expr: Expr[_]) =
try {
val fout = new ByteArrayOutputStream()
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/freetypes_false_alarm1.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
reify {
val ru = scala.reflect.runtime.universe
val tpe: ru.Type = ru.typeOf[List[Int]]
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/idempotency-case-classes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.{ToolBox, ToolBoxError}
import scala.tools.reflect.Eval

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
val casee = reify {
case class C(x: Int, y: Int)
println(C(2, 3))
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/idempotency-extractors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.{ToolBox, ToolBoxError}
import scala.tools.reflect.Eval

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
object Extractor { def unapply(x: Int): Option[Int] = Some(x) }
val extractor = reify {
2 match { case Extractor(x) => x }
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/idempotency-labels.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.{ToolBox, ToolBoxError}
import scala.tools.reflect.Eval

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
val label = reify {
var x = 0
while (x < 2) { x += 1 }
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/idempotency-lazy-vals.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.{ToolBox, ToolBoxError}
import scala.tools.reflect.Eval

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
val lazee = reify {
class C {
lazy val x = 2
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/idempotency-this.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.{ToolBox, ToolBoxError}
import scala.tools.reflect.Eval

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
val thiss = reify {
List[String]("")
}
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/macro-abort-fresh/Test_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/macro-auto-duplicate/Test_2.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(Macros.foo)
}
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/macro-basic-ma-md-mi/Test_3.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
import Macros.Shmacros._
println(foo(2) + Macros.bar(2) * new Macros().quux(4))
}
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/macro-basic-ma-mdmi/Test_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
import Macros.Shmacros._
println(foo(2) + Macros.bar(2) * new Macros().quux(4))
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Macros {
def quux(x: Int): Int = macro Impls.quux
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
import Macros.Shmacros._
println(foo(2) + Macros.bar(2) * new Macros().quux(4))
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(implicitly[C[Int]])
println(implicitly[C[String]])
println(implicitly[C[Nothing]])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Macros {
def foo(x: Int): Int = macro Impls.refToFoo(42)
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
import Macros._
println(foo(42))
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(new C().blackbox)
println(new C().refinedBlackbox)
println(new C().whitebox)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(new C().blackbox)
println(new C().whitebox)
}
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/macro-bundle-static/Test_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(Macros.mono)
println(Macros.poly[Int])
println(new Enclosing.Impl(???).weird)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(Macros.mono)
println(Macros.poly[Int])
println(new Impl(???).weird)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(Macros.mono)
println(Macros.poly[Int])
println(new Impl(???).weird)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(ReturnTypeRefinement.foo.x)

case class Foo(i: Int, s: String, b: Boolean)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(ReturnTypeRefinement.foo.x)

case class Foo(i: Int, s: String, b: Boolean)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println("it works")
}
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/macro-default-params/Test_2.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
Macros.foo
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
println(implicitly[Complex[Foo]])
}
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/macro-duplicate/Test_2.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import scala.concurrent._
import ExecutionContext.Implicits.global

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
Macros.foo
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
val a1 = Macros.foo
val a2 = Predef.identity(Predef.identity(Macros.foo))
val a3: Int = Macros.foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
val a1 = Macros.foo
val a2 = Predef.identity(Predef.identity(Macros.foo))
val a3: Int = Macros.foo
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/run/macro-enclosures/Test_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
test.Test.test
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
import Macros._
println(array(1, 2, 3).toList)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
implicit val x = 42
def foo(implicit x: Int): Unit = macro Impls.foo
foo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object Macros {
implicit def foo(x: String): Option[Int] = macro Impls.foo
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
import Macros._
println("2": Option[Int])
val s: Int = "2" getOrElse 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
implicit def foo: Int = macro Impls.foo
def bar(implicit x: Int) = println(x)
bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Macros {
implicit def foo(x: String): Option[Int] = macro Impls.foo
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
import Macros._
def bar[T <% Option[Int]](x: T) = println(x)
println("2")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Test extends dotty.runtime.LegacyApp {
object Test extends App {
def foo(x: Int)(y: Int): Unit = macro Impls.foo
foo(40)(2)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Macros {
def bar2[T](x: Int)(): Unit = macro Impls.barEmpty[T]
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
Macros.foo1[Int]
Macros.foo2[Int]
Macros.foo2[Int]()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Macros {
def bar2(x: Int)(): Unit = macro Impls.barEmpty
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
Macros.foo1
Macros.foo2
Macros.foo2()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Macros {
def foo(x: Boolean): Unit = println("fooClassBoolean")
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {
Macros.foo("42")
Macros.foo(42)
Macros.foo(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Z extends D {
override def foo(x: Boolean): Unit = println("fooZBoolean")
}

object Test extends dotty.runtime.LegacyApp {
object Test extends App {

val dd: D = new D()
dd.foo("42")
Expand Down
Loading