File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
frontends/benchmarks/imperative/valid Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,34 @@ object MutableTuple {
5
5
case class Foo (var value : BigInt )
6
6
case class Bar (var value : BigInt )
7
7
8
- def t1 (pair : (Foo , Bar )) = {
8
+ def t1 (pair : (Foo , Bar )): BigInt = {
9
9
pair._1.value = 1
10
10
assert(pair._1.value == 1 )
11
+ pair._2.value
12
+ }
13
+
14
+ def t2 () = {
15
+ val pair = (Foo (1 ), Foo (2 ), Foo (3 ))
16
+ val secondFoo = pair._2
17
+ secondFoo.value = 4
18
+ assert(pair == (Foo (1 ), Foo (4 ), Foo (3 )))
19
+ assert(pair._2.value == secondFoo.value)
20
+
21
+ pair._2.value = 6
22
+ assert(pair == (Foo (1 ), Foo (6 ), Foo (3 )))
23
+ assert(pair._2.value == secondFoo.value)
24
+ }
25
+
26
+ def t3 (): (Foo , Bar ) = {
27
+ val bar = Bar (1 )
28
+ val foo = Foo (2 )
29
+ (foo, bar)
30
+ }
31
+
32
+ def t4 () = {
33
+ val pair = t3()
34
+ pair._2.value = 100
35
+
36
+ assert(t1((pair._1, pair._2)) == 100 )
11
37
}
12
38
}
You can’t perform that action at this time.
0 commit comments