~ubuntu-branches/debian/sid/scala/sid

« back to all changes in this revision

Viewing changes to test/files/continuations-run/t5314.scala

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Mehdi Dogguy, Lucas Satabin, Frank S. Thomas, Emmanuel Bourg
  • Date: 2015-06-05 23:52:59 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150605235259-wk00vgk83dh8o19g
Tags: 2.10.5-1
* Team upload.

[ Mehdi Dogguy ]
* New upstream release (Closes: #744278).

[ Lucas Satabin ]
* Update patches
* Update the clean target
* Update paths of elements to install
* Update watch file

[ Frank S. Thomas ]
* Remove myself from Uploaders.

[ Emmanuel Bourg ]
* The package has been adopted by the Java Team (Closes: #754935)
* Patched the build to avoid downloading libraries from the Internet
* Replaced the minified JavaScript files with unobfuscated ones
* No longer build scala-partest.jar until diffutils is packaged or replaced
* debian/watch: Fixed the versions matched (x.y.z instead of x.y.z..z)
* debian/rules:
  - Added the missing get-orig-source target (Closes: #724704)
  - Improved the clean target
* debian/control:
  - Build depend on scala (>= 2.10) and bnd
  - Use canonical URLs for the Vcs-* fields
  - Standards-Version updated to 3.9.6 (no changes)
* Switch to debhelper level 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import scala.util.continuations._
 
2
 
 
3
class ReturnRepro { 
 
4
  def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } 
 
5
  def caller = reset { println(p(3)) }
 
6
  def caller2 = reset { println(p2(3)) }
 
7
 
 
8
  def p(i: Int): Int @cpsParam[Unit, Any] = { 
 
9
    val v= s1 + 3 
 
10
    return v 
 
11
  } 
 
12
 
 
13
  def p2(i: Int): Int @cpsParam[Unit, Any] = {
 
14
    val v = s1 + 3
 
15
    if (v > 0) {
 
16
      println("hi")
 
17
      return v
 
18
    } else {
 
19
      println("hi")
 
20
      return 8
 
21
    }
 
22
  }
 
23
}
 
24
 
 
25
object Test extends App {
 
26
  def foo(x:Int): Int @cps[Int] = shift { k => k(x) }
 
27
 
 
28
  def bar(x:Int): Int @cps[Int] = return foo(x)
 
29
 
 
30
  def nocps(x: Int): Int = { return x; x }
 
31
 
 
32
  def foo2(x:Int): Int @cps[Int] = 7
 
33
  def bar2(x:Int): Int @cps[Int] = { foo2(x); return 7 }
 
34
  def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) }
 
35
  def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) }
 
36
  def bar5(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else 8 }
 
37
  println(reset { bar2(10) })
 
38
  println(reset { bar3(10) })
 
39
  println(reset { bar4(10) })
 
40
  println(reset { bar5(10) })
 
41
  
 
42
  /* original test case */
 
43
  val repro = new ReturnRepro
 
44
  repro.caller
 
45
  repro.caller2
 
46
 
 
47
  reset {
 
48
    val res = bar(8)
 
49
    println(res)
 
50
    res
 
51
  }
 
52
}