diff options
Diffstat (limited to 'tests/disabled')
9 files changed, 274 insertions, 0 deletions
diff --git a/tests/disabled/scalac-dependent/neg/selfreq.scala b/tests/disabled/scalac-dependent/neg/selfreq.scala new file mode 100644 index 000000000..1ca373b4b --- /dev/null +++ b/tests/disabled/scalac-dependent/neg/selfreq.scala @@ -0,0 +1,37 @@ +trait X { self: Y => // error: cannot resolve reference to type (Y & X)(X.this).V + + type T <: self.U + + def foo(x: T): T // old-error: cannot resolve reference to type (Y & X)(X.this).V + def foo(x: String): String + +} + +trait Y { self: Z => + + type U <: self.V + +} + +trait Z { + + class V + +} + +object O { + val x: X = ??? + x.foo("a") // error: cannot resolve reference to type (Y & X)(X.this).V +} + +import scala.tools.nsc.interpreter.IMain + +object Test extends dotty.runtime.LegacyApp { + val engine = new IMain.Factory getScriptEngine() + engine.asInstanceOf[IMain].settings.usejavacp.value = true // no longer an error since we unpickle Scala2 inner classes with fixed syms + val res2 = engine.asInstanceOf[javax.script.Compilable] + res2 compile "8" eval() + val res5 = res2 compile """println("hello") ; 8""" + res5 eval() + res5 eval() +} diff --git a/tests/disabled/scalac-dependent/pos-special/i859.scala b/tests/disabled/scalac-dependent/pos-special/i859.scala new file mode 100644 index 000000000..a9f6b51c9 --- /dev/null +++ b/tests/disabled/scalac-dependent/pos-special/i859.scala @@ -0,0 +1,3 @@ +class Analyzer { + def foo: scala.tools.nsc.Global = ??? +} 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) diff --git a/tests/disabled/scalac-dependent/run/t1618.scala b/tests/disabled/scalac-dependent/run/t1618.scala new file mode 100644 index 000000000..248af9b4f --- /dev/null +++ b/tests/disabled/scalac-dependent/run/t1618.scala @@ -0,0 +1,11 @@ + +object Test extends dotty.runtime.LegacyApp { + import scala.tools.nsc.io._ + + val dir: VirtualDirectory = new VirtualDirectory("foo", None) + dir.subdirectoryNamed("foo") + assert(dir.lookupName("foo", true) != null) + +} + + diff --git a/tests/disabled/scalac-dependent/run/t7775.scala b/tests/disabled/scalac-dependent/run/t7775.scala new file mode 100644 index 000000000..bc6a67d0e --- /dev/null +++ b/tests/disabled/scalac-dependent/run/t7775.scala @@ -0,0 +1,17 @@ +import scala.concurrent.{duration, Future, Await, ExecutionContext} +import scala.tools.nsc.Settings +import ExecutionContext.Implicits.global + +// Was failing pretty regularly with a ConcurrentModificationException as +// WrappedProperties#systemProperties iterated directly over the mutable +// global system properties map. +object Test { + def main(args: Array[String]): Unit = { + val tries = 1000 // YMMV + val compiler = Future { + for(_ <- 1 to tries) new Settings(_ => {}) + } + for(i <- 1 to tries * 10) System.setProperty(s"foo$i", i.toString) + Await.result(compiler, duration.Duration.Inf) + } +} |