summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2015-03-23 20:55:02 +0100
committerLukas Rytz <lukas.rytz@typesafe.com>2015-03-23 20:55:02 +0100
commitb40b81cd3b1cd8b8b93df3b912fa10ccf1b53b26 (patch)
treee94b84c405aaf351377f4bb053928b718455a068 /test/files/run
parentec0a860766467de78f4932431608d423705e1e41 (diff)
parent33c568c029201b8bd76ace556ff3641db47d12fe (diff)
downloadscala-b40b81cd3b1cd8b8b93df3b912fa10ccf1b53b26.tar.gz
scala-b40b81cd3b1cd8b8b93df3b912fa10ccf1b53b26.tar.bz2
scala-b40b81cd3b1cd8b8b93df3b912fa10ccf1b53b26.zip
Merge pull request #4301 from som-snytt/issue/8918-deferred
SI-8918 Unary ids are plain ids
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t8918-unary-ids.scala49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/files/run/t8918-unary-ids.scala b/test/files/run/t8918-unary-ids.scala
new file mode 100644
index 0000000000..1f29abe464
--- /dev/null
+++ b/test/files/run/t8918-unary-ids.scala
@@ -0,0 +1,49 @@
+
+
+import scala.tools.partest.SessionTest
+
+// Taking unary ids as plain
+object Test extends SessionTest {
+ def session =
+"""Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> val - = 42
+-: Int = 42
+
+scala> val i = -
+i: Int = 42
+
+scala> - { 42 }
+res0: Int = -42
+
+scala> - if (true) 1 else 2
+<console>:1: error: illegal start of simple expression
+ - if (true) 1 else 2
+ ^
+
+scala> - - 1
+<console>:1: error: ';' expected but integer literal found.
+ - - 1
+ ^
+
+scala> -.-(1)
+res1: Int = 41
+
+scala> -
+res2: Int = 42
+
+scala> - -
+res3: Int = -42
+
+scala> + -
+res4: Int = 42
+
+scala> object X { def -(i: Int) = 42 - i ; def f(g: Int => Int) = g(7) ; def j = f(-) }
+defined object X
+
+scala> X.j
+res5: Int = 35
+
+scala> :quit"""
+}