aboutsummaryrefslogtreecommitdiff
path: root/tests/run/inlinePrivates.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-09-10 20:58:34 +0200
committerMartin Odersky <odersky@gmail.com>2016-10-02 16:11:21 +0200
commitd575e585389b025d7b8056bcb43fea67dddd15d0 (patch)
tree657453c9e17f109e29ead11d52807d1e335930ae /tests/run/inlinePrivates.scala
parente93b7bfe770c8950a52d17bb0aebd3e0a5e93b3c (diff)
downloaddotty-d575e585389b025d7b8056bcb43fea67dddd15d0.tar.gz
dotty-d575e585389b025d7b8056bcb43fea67dddd15d0.tar.bz2
dotty-d575e585389b025d7b8056bcb43fea67dddd15d0.zip
Make inline a keyword
`inline` is now a modifier keyword. To keep disruption tolerable, we still allow `@inline` as an annotation as well. Other uses of `inline` are supported only under `-language:Scala2` and are rewritten to identifiers in backticks.
Diffstat (limited to 'tests/run/inlinePrivates.scala')
-rw-r--r--tests/run/inlinePrivates.scala32
1 files changed, 7 insertions, 25 deletions
diff --git a/tests/run/inlinePrivates.scala b/tests/run/inlinePrivates.scala
index ade4592df..ce438ae8d 100644
--- a/tests/run/inlinePrivates.scala
+++ b/tests/run/inlinePrivates.scala
@@ -6,19 +6,19 @@ object Test {
private var y: T = _
- @inline def get1 = x
- @inline def get2[U](c: C[U]) = c.x
+ inline def get1 = x
+ inline def get2[U](c: C[U]) = c.x
- @inline def foo1(x: Int) = foo(x)
- @inline def foo2[U](c: C[U]) = c.foo(x)
+ inline def foo1(x: Int) = foo(x)
+ inline def foo2[U](c: C[U]) = c.foo(x)
- @inline def set1(z: T) = { y = z; y }
- @inline def set2[U](c: C[U]) = { c.y = c.x; c.y }
+ inline def set1(z: T) = { y = z; y }
+ inline def set2[U](c: C[U]) = { c.y = c.x; c.y }
}
object CC {
private val x = 3
- @inline def get1 = x
+ inline def get1 = x
}
def main(args: Array[String]) = {
@@ -29,24 +29,6 @@ object Test {
assert(cc.foo2(cc) == 2)
assert(cc.set1(3) == 3)
assert(cc.set2(cc) == 2)
-object Test {
-
- @inline
- def swap[T](x: T, x_= : T => Unit, y: T, y_= : T => Unit) = {
- val t = x
- x_=(y)
- y_=(t)
- }
-
- def main(args: Array[String]) = {
- var x = 1
- var y = 2
- @inline def setX(z: Int) = x = z
- @inline def setY(z: Int) = y = z
- swap[Int](x, setX, y, setY)
- assert(x == 2 && y == 1)
- }
-}
assert(CC.get1 == 3)
}