aboutsummaryrefslogtreecommitdiff
path: root/tests/disabled/scalac-dependent/pos
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-02-16 23:35:18 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-02-18 19:24:05 +0100
commit5aac086d63807331e380bb2d861e4e07800b1f63 (patch)
tree0846ffcc133ce47ba1355e960959295d1e6f1bc2 /tests/disabled/scalac-dependent/pos
parent6df672c7e7be65d7be1cd6524c610aed4f35178c (diff)
downloaddotty-5aac086d63807331e380bb2d861e4e07800b1f63.tar.gz
dotty-5aac086d63807331e380bb2d861e4e07800b1f63.tar.bz2
dotty-5aac086d63807331e380bb2d861e4e07800b1f63.zip
Disable tests that require scala-compiler
This is necessary if we ever want to get rid of our dependency on scala-compiler
Diffstat (limited to 'tests/disabled/scalac-dependent/pos')
-rw-r--r--tests/disabled/scalac-dependent/pos/t5604/ReplConfig.scala53
-rw-r--r--tests/disabled/scalac-dependent/pos/t5604/ReplReporter.scala30
-rw-r--r--tests/disabled/scalac-dependent/pos/t5899.scala19
-rw-r--r--tests/disabled/scalac-dependent/pos/t7591.scala86
-rw-r--r--tests/disabled/scalac-dependent/pos/trait-force-info.scala18
5 files changed, 206 insertions, 0 deletions
diff --git a/tests/disabled/scalac-dependent/pos/t5604/ReplConfig.scala b/tests/disabled/scalac-dependent/pos/t5604/ReplConfig.scala
new file mode 100644
index 000000000..8c589eba6
--- /dev/null
+++ b/tests/disabled/scalac-dependent/pos/t5604/ReplConfig.scala
@@ -0,0 +1,53 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2011 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.nsc
+package interpreter
+
+import util.Exceptional.unwrap
+import util.stackTraceString
+
+trait ReplConfig {
+ lazy val replProps = new ReplProps
+
+ class TapMaker[T](x: T) {
+ def tapInfo(msg: => String): T = tap(x => replinfo(parens(x)))
+ def tapDebug(msg: => String): T = tap(x => repldbg(parens(x)))
+ def tapTrace(msg: => String): T = tap(x => repltrace(parens(x)))
+ def tap[U](f: T => U): T = {
+ f(x)
+ x
+ }
+ }
+
+ private def parens(x: Any) = "(" + x + ")"
+ private def echo(msg: => String) =
+ try Console println msg
+ catch { case x: AssertionError => Console.println("Assertion error printing debugging output: " + x) }
+
+ private[nsc] def repldbg(msg: => String) = if (isReplDebug) echo(msg)
+ private[nsc] def repltrace(msg: => String) = if (isReplTrace) echo(msg)
+ private[nsc] def replinfo(msg: => String) = if (isReplInfo) echo(msg)
+
+ private[nsc] def logAndDiscard[T](label: String, alt: => T): PartialFunction[Throwable, T] = {
+ case t =>
+ repldbg(label + ": " + unwrap(t))
+ repltrace(stackTraceString(unwrap(t)))
+ alt
+ }
+ private[nsc] def substituteAndLog[T](alt: => T)(body: => T): T =
+ substituteAndLog("" + alt, alt)(body)
+ private[nsc] def substituteAndLog[T](label: String, alt: => T)(body: => T): T = {
+ try body
+ catch logAndDiscard(label, alt)
+ }
+ private[nsc] def squashAndLog(label: String)(body: => Unit): Unit =
+ substituteAndLog(label, ())(body)
+
+ def isReplTrace: Boolean = replProps.trace
+ def isReplDebug: Boolean = replProps.debug || isReplTrace
+ def isReplInfo: Boolean = replProps.info || isReplDebug
+ def isReplPower: Boolean = replProps.power
+}
diff --git a/tests/disabled/scalac-dependent/pos/t5604/ReplReporter.scala b/tests/disabled/scalac-dependent/pos/t5604/ReplReporter.scala
new file mode 100644
index 000000000..9423efd8a
--- /dev/null
+++ b/tests/disabled/scalac-dependent/pos/t5604/ReplReporter.scala
@@ -0,0 +1,30 @@
+/* NSC -- new Scala compiler
+ * Copyright 2002-2011 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.nsc
+package interpreter
+
+import reporters._
+import IMain._
+
+class ReplReporter(intp: IMain) extends ConsoleReporter(intp.settings, Console.in, new ReplStrippingWriter(intp)) {
+ override def printMessage(msg: String): Unit = {
+ // Avoiding deadlock if the compiler starts logging before
+ // the lazy val is complete.
+ if (intp.isInitializeComplete) {
+ if (intp.totalSilence) {
+ if (isReplTrace)
+ super.printMessage("[silent] " + msg)
+ }
+ else super.printMessage(msg)
+ }
+ else Console.println("[init] " + msg)
+ }
+
+ override def displayPrompt(): Unit = {
+ if (intp.totalSilence) ()
+ else super.displayPrompt()
+ }
+}
diff --git a/tests/disabled/scalac-dependent/pos/t5899.scala b/tests/disabled/scalac-dependent/pos/t5899.scala
new file mode 100644
index 000000000..852b4e3e7
--- /dev/null
+++ b/tests/disabled/scalac-dependent/pos/t5899.scala
@@ -0,0 +1,19 @@
+import scala.tools.nsc._
+
+trait Foo {
+ val global: Global
+ import global.{Name, Symbol, nme}
+
+ case class Bippy(name: Name)
+
+ def f(x: Bippy, sym: Symbol): Int = {
+ // no warning (!) for
+ // val Stable = sym.name.toTermName
+
+ val Stable = sym.name
+ Bippy(Stable) match {
+ case Bippy(nme.WILDCARD) => 1
+ case Bippy(Stable) => 2 // should not be considered unreachable
+ }
+ }
+}
diff --git a/tests/disabled/scalac-dependent/pos/t7591.scala b/tests/disabled/scalac-dependent/pos/t7591.scala
new file mode 100644
index 000000000..dd127b881
--- /dev/null
+++ b/tests/disabled/scalac-dependent/pos/t7591.scala
@@ -0,0 +1,86 @@
+/* NEST (New Scala Test)
+ * Copyright 2007-2013 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+import scala.tools.cmd._
+
+/** A sample command specification for illustrative purposes.
+ * First take advantage of the meta-options:
+ *
+ * // this command creates an executable runner script "demo"
+ * % scala scala.tools.cmd.Demo --self-update demo
+ *
+ * // this one creates and sources a completion file - note backticks
+ * % `./demo --bash`
+ *
+ * // and now you have a runner with working completion
+ * % ./demo --<tab>
+ * --action --defint --int
+ * --bash --defstr --str
+ * --defenv --self-update --unary
+ *
+ * The normal option configuration is plausibly self-explanatory.
+ */
+trait DemoSpec extends Spec with Meta.StdOpts with Interpolation {
+ lazy val referenceSpec = DemoSpec
+ lazy val programInfo = Spec.Info("demo", "Usage: demo [<options>]", "scala.tools.cmd.Demo")
+
+ help("""Usage: demo [<options>]""")
+ heading("Unary options:")
+
+ val optIsUnary = "unary" / "a unary option" --? ;
+ ("action" / "a body which may be run") --> println("Hello, I am the --action body.")
+
+ heading("Binary options:")
+ val optopt = "str" / "an optional String" --|
+ val optoptInt = ("int" / "an optional Int") . --^[Int]
+ val optEnv = "defenv" / "an optional String" defaultToEnv "PATH"
+ val optDefault = "defstr" / "an optional String" defaultTo "default"
+ val optDefaultInt = "defint" / "an optional Int" defaultTo -1
+ val optExpand = "alias" / "an option which expands" expandTo ("--int", "15")
+}
+
+object DemoSpec extends DemoSpec with Property {
+ lazy val propMapper = new PropertyMapper(DemoSpec)
+
+ type ThisCommandLine = SpecCommandLine
+ def creator(args: List[String]) =
+ new SpecCommandLine(args) {
+ override def errorFn(msg: String) = { println("Error: " + msg) ; sys.exit(0) }
+ }
+}
+
+class Demo(args: List[String]) extends DemoSpec with Instance {
+// TODO NEEDS MANUAL CHANGE (early initializers)
+// BEGIN copied early initializers
+val parsed = DemoSpec(args: _*)
+// END copied early initializers
+
+ import java.lang.reflect._
+
+ def helpMsg = DemoSpec.helpMsg
+ def demoSpecMethods = this.getClass.getMethods.toList
+ private def isDemo(m: Method) = (m.getName startsWith "opt") && !(m.getName contains "$") && (m.getParameterTypes.isEmpty)
+
+ def demoString(ms: List[Method]) = {
+ val longest = ms map (_.getName.length) max
+ val formatStr = " %-" + longest + "s: %s"
+ val xs = ms map (m => formatStr.format(m.getName, m.invoke(this)))
+
+ xs mkString ("Demo(\n ", "\n ", "\n)\n")
+ }
+
+ override def toString = demoString(demoSpecMethods filter isDemo)
+}
+
+object Demo {
+ def main(args: Array[String]): Unit = {
+ val runner = new Demo(args.toList)
+
+ if (args.isEmpty)
+ println(runner.helpMsg)
+
+ println(runner)
+ }
+}
diff --git a/tests/disabled/scalac-dependent/pos/trait-force-info.scala b/tests/disabled/scalac-dependent/pos/trait-force-info.scala
new file mode 100644
index 000000000..c2b33869c
--- /dev/null
+++ b/tests/disabled/scalac-dependent/pos/trait-force-info.scala
@@ -0,0 +1,18 @@
+/** This does NOT crash unless it's in the interactive package.
+ */
+
+package scala.tools.nsc
+package interactive
+
+trait MyContextTrees {
+ val self: Global
+ val NoContext = self.analyzer.NoContext
+}
+//
+// error: java.lang.AssertionError: assertion failed: trait Contexts.NoContext$ linkedModule: <none>List()
+// at scala.Predef$.assert(Predef.scala:160)
+// at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.innerSymbol$1(ClassfileParser.scala:1211)
+// at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.classSymbol(ClassfileParser.scala:1223)
+// at scala.tools.nsc.symtab.classfile.ClassfileParser.classNameToSymbol(ClassfileParser.scala:489)
+// at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:757)
+// at scala.tools.nsc.symtab.classfile.ClassfileParser.sig2type$1(ClassfileParser.scala:789)