summaryrefslogtreecommitdiff
path: root/test/files/run/t6439.check
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-01-19 13:01:31 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-01-19 13:01:31 +0100
commit3486d47508686e4b96560e176280fa9fc536fd41 (patch)
tree399425abd04da5981d0ffe6000c6414e3027e43e /test/files/run/t6439.check
parent6f72ed85c3882d2a8c824a41e6e42d7f33b8d1d6 (diff)
downloadscala-3486d47508686e4b96560e176280fa9fc536fd41.tar.gz
scala-3486d47508686e4b96560e176280fa9fc536fd41.tar.bz2
scala-3486d47508686e4b96560e176280fa9fc536fd41.zip
SI-6439 Avoid spurious REPL warnings about companionship
`val m` isn't a companion of `trait m`, check the pair of eponymous symbols are a ((class|trait), object) pair before emitting the warning. In order to correctly check this one a type alias is involved, `definedSymbols` must avoid normalizing through type aliases. AFAICT this is an improvement to the other clients of that Map, one such power mode progression is demonstrated at the end of the test case.
Diffstat (limited to 'test/files/run/t6439.check')
-rw-r--r--test/files/run/t6439.check66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check
new file mode 100644
index 0000000000..178ea739f5
--- /dev/null
+++ b/test/files/run/t6439.check
@@ -0,0 +1,66 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> class A
+defined class A
+
+scala> object A // warn
+defined module 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 module 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 module C
+
+scala> object Bippy
+defined module 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 module E
+
+scala> var E = 0 // no warn
+E: Int = 0
+
+scala> object F
+defined module 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> intp("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>