diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-25 14:15:45 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-25 16:28:44 -0800 |
commit | f3ac123f345b095580d1839e0f67ea07c6837946 (patch) | |
tree | 10322987043f41284f35da1d9a349e01179fcccb /test/files/run | |
parent | f01af109ae975461fe5a3120a69814521968fcce (diff) | |
parent | ac432bcde6b357194203d25df5f204ab8e426416 (diff) | |
download | scala-f3ac123f345b095580d1839e0f67ea07c6837946.tar.gz scala-f3ac123f345b095580d1839e0f67ea07c6837946.tar.bz2 scala-f3ac123f345b095580d1839e0f67ea07c6837946.zip |
Merge commit 'ac432bcde6' into pr/merge-2.10
* commit 'ac432bcde6':
Fix broken build.
SI-6434 Pretty print function types with by name arg as (=> A) => B
Removed class files.
SI-6994 Avoid spurious promiscuous catch warning
Addressing warnings.
SI-6439 Avoid spurious REPL warnings about companionship
use ArrayBuffer instead of Array to build Formulae
SI-6942 more efficient unreachability analysis
use Constant::isIntRange even if it's NIH
SI-6956 determine switchability by type, not tree
SI-5568 Comment improvements for getClass on primitive intersection.
SI-5568 Fixes verify error from getClass on refinement of value type
SI-6923 Context now buffers warnings as well as errors
Conflicts:
src/compiler/scala/tools/nsc/interpreter/IMain.scala
src/compiler/scala/tools/nsc/transform/Erasure.scala
src/compiler/scala/tools/nsc/typechecker/Contexts.scala
src/compiler/scala/tools/nsc/typechecker/Typers.scala
test/files/neg/t4851.check
Note:
This merge excludes b07228aebe7a as it breaks master.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/reify_magicsymbols.check | 2 | ||||
-rw-r--r-- | test/files/run/t5568.check | 9 | ||||
-rw-r--r-- | test/files/run/t5568.scala | 16 | ||||
-rw-r--r-- | test/files/run/t6434.check | 10 | ||||
-rw-r--r-- | test/files/run/t6434.scala | 8 | ||||
-rw-r--r-- | test/files/run/t6439.check | 77 | ||||
-rw-r--r-- | test/files/run/t6439.scala | 32 | ||||
-rw-r--r-- | test/files/run/t6956.check | 1 | ||||
-rw-r--r-- | test/files/run/t6956.scala | 26 |
9 files changed, 180 insertions, 1 deletions
diff --git a/test/files/run/reify_magicsymbols.check b/test/files/run/reify_magicsymbols.check index e2aa46a364..c9d892d793 100644 --- a/test/files/run/reify_magicsymbols.check +++ b/test/files/run/reify_magicsymbols.check @@ -10,4 +10,4 @@ List[Null] List[Nothing] AnyRef{def foo(x: Int): Int} Int* => Unit -=> Int => Unit +(=> Int) => Unit diff --git a/test/files/run/t5568.check b/test/files/run/t5568.check new file mode 100644 index 0000000000..67aaf16e07 --- /dev/null +++ b/test/files/run/t5568.check @@ -0,0 +1,9 @@ +void +int +class scala.runtime.BoxedUnit +class scala.runtime.BoxedUnit +class java.lang.Integer +class java.lang.Integer +5 +5 +5 diff --git a/test/files/run/t5568.scala b/test/files/run/t5568.scala new file mode 100644 index 0000000000..14599d9ed2 --- /dev/null +++ b/test/files/run/t5568.scala @@ -0,0 +1,16 @@ +object Test { + def main(args: Array[String]): Unit = { + // these should give unboxed results + println(().getClass) + println(5.getClass) + // these should give boxed results + println(().asInstanceOf[AnyRef with Unit].getClass) + println(().asInstanceOf[Unit with AnyRef].getClass) + println(5.asInstanceOf[AnyRef with Int].getClass) + println(5.asInstanceOf[Int with AnyRef].getClass) + //make sure ## wasn't broken + println(5.##) + println((5.asInstanceOf[AnyRef]).##) + println((5:Any).##) + } +} diff --git a/test/files/run/t6434.check b/test/files/run/t6434.check new file mode 100644 index 0000000000..f898b6b781 --- /dev/null +++ b/test/files/run/t6434.check @@ -0,0 +1,10 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> def f(x: => Int): Int = x +f: (x: => Int)Int + +scala> f _ +res0: (=> Int) => Int = <function1> + +scala> diff --git a/test/files/run/t6434.scala b/test/files/run/t6434.scala new file mode 100644 index 0000000000..e4a4579613 --- /dev/null +++ b/test/files/run/t6434.scala @@ -0,0 +1,8 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = +"""def f(x: => Int): Int = x +f _ +""" +} diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check new file mode 100644 index 0000000000..3f5f7dc8a4 --- /dev/null +++ b/test/files/run/t6439.check @@ -0,0 +1,77 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> class A +defined class A + +scala> object A // warn +defined object A +warning: previously defined class A is not a companion to object A. +Companions must be defined together; you may wish to use :paste mode for this. + +scala> trait B +defined trait B + +scala> object B // warn +defined object B +warning: previously defined trait B is not a companion to object B. +Companions must be defined together; you may wish to use :paste mode for this. + +scala> object C +defined object C + +scala> object Bippy +defined object Bippy + +scala> class C // warn +defined class C +warning: previously defined object C is not a companion to class C. +Companions must be defined together; you may wish to use :paste mode for this. + +scala> class D +defined class D + +scala> def D = 0 // no warn +D: Int + +scala> val D = 0 // no warn +D: Int = 0 + +scala> object E +defined object E + +scala> var E = 0 // no warn +E: Int = 0 + +scala> object F +defined object F + +scala> type F = Int // no warn +defined type alias F + +scala> :power +** Power User mode enabled - BEEP WHIR GYVE ** +** :phase has been set to 'typer'. ** +** scala.tools.nsc._ has been imported ** +** global._, definitions._ also imported ** +** Try :help, :vals, power.<tab> ** + +scala> object lookup { + import intp._ + def apply(name: String): Symbol = types(name) orElse terms(name) + def types(name: String): Symbol = replScope lookup (name: TypeName) orElse getClassIfDefined(name) + def terms(name: String): Symbol = replScope lookup (name: TermName) orElse getModuleIfDefined(name) + def types[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol + def terms[T: global.TypeTag] : Symbol = typeOf[T].termSymbol + def apply[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol +} +defined object lookup + +scala> lookup("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols +res0: $r.intp.global.Symbol = type F + +scala> + +scala> diff --git a/test/files/run/t6439.scala b/test/files/run/t6439.scala new file mode 100644 index 0000000000..175a1d134f --- /dev/null +++ b/test/files/run/t6439.scala @@ -0,0 +1,32 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + + def code = """ +class A +object A // warn +trait B +object B // warn +object C +object Bippy +class C // warn +class D +def D = 0 // no warn +val D = 0 // no warn +object E +var E = 0 // no warn +object F +type F = Int // no warn +:power +object lookup { + import intp._ + def apply(name: String): Symbol = types(name) orElse terms(name) + def types(name: String): Symbol = replScope lookup (name: TypeName) orElse getClassIfDefined(name) + def terms(name: String): Symbol = replScope lookup (name: TermName) orElse getModuleIfDefined(name) + def types[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol + def terms[T: global.TypeTag] : Symbol = typeOf[T].termSymbol + def apply[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol +} +lookup("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols + """ +} diff --git a/test/files/run/t6956.check b/test/files/run/t6956.check new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/files/run/t6956.check @@ -0,0 +1 @@ +2 diff --git a/test/files/run/t6956.scala b/test/files/run/t6956.scala new file mode 100644 index 0000000000..4a6583ca45 --- /dev/null +++ b/test/files/run/t6956.scala @@ -0,0 +1,26 @@ +import scala.tools.partest.IcodeTest + +class Switches { + private[this] final val ONE = 1 + + def switchBad(i: Byte): Int = i match { + case ONE => 1 + case 2 => 2 + case 3 => 3 + case _ => 0 + } + + def switchOkay(i: Byte): Int = i match { + case 1 => 1 + case 2 => 2 + case 3 => 3 + case _ => 0 + } +} + +object Test extends IcodeTest { + // ensure we get two switches out of this -- ignore the rest of the output for robustness + // exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file) + override def show() = println(collectIcode("").filter(x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1).size) +} + |