blob: 3aa990f72cbab004b9f9c00566b0314fd0aa96ee (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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"""
}
|