summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/class-symbol-contravariant.check36
-rw-r--r--test/files/run/class-symbol-contravariant.scala15
2 files changed, 51 insertions, 0 deletions
diff --git a/test/files/run/class-symbol-contravariant.check b/test/files/run/class-symbol-contravariant.check
new file mode 100644
index 0000000000..987f215bca
--- /dev/null
+++ b/test/files/run/class-symbol-contravariant.check
@@ -0,0 +1,36 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+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> val u = rootMirror.universe
+u: $r.intp.global.type = <global>
+
+scala> import u._, scala.reflect.internal.Flags
+import u._
+import scala.reflect.internal.Flags
+
+scala> class C
+defined class C
+
+scala> val sym = u.typeOf[C].typeSymbol
+sym: u.Symbol = class C
+
+scala> sym.isContravariant
+res0: Boolean = false
+
+scala> sym setFlag Flags.INCONSTRUCTOR
+res1: sym.type = class C
+
+scala> sym.isClassLocalToConstructor
+res2: Boolean = true
+
+scala> sym.isContravariant // was true
+res3: Boolean = false
+
+scala>
diff --git a/test/files/run/class-symbol-contravariant.scala b/test/files/run/class-symbol-contravariant.scala
new file mode 100644
index 0000000000..6a84944e3b
--- /dev/null
+++ b/test/files/run/class-symbol-contravariant.scala
@@ -0,0 +1,15 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ override def code = """
+ |:power
+ |val u = rootMirror.universe
+ |import u._, scala.reflect.internal.Flags
+ |class C
+ |val sym = u.typeOf[C].typeSymbol
+ |sym.isContravariant
+ |sym setFlag Flags.INCONSTRUCTOR
+ |sym.isClassLocalToConstructor
+ |sym.isContravariant // was true
+ |""".stripMargin.trim
+} \ No newline at end of file