-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
345 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package unroll | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
val instance = new Unrolled {} | ||
val cls = classOf[Unrolled] | ||
|
||
assert(scala.util.Try(cls.getMethod("foo", classOf[String])).isFailure) | ||
println() | ||
assert( | ||
cls.getMethod("foo", classOf[String], classOf[Int]).invoke(instance, "hello", 2: Integer) == | ||
"hello2true0" | ||
) | ||
assert( | ||
cls.getMethod("foo", classOf[String], classOf[Int], classOf[Boolean]) | ||
.invoke(instance, "hello", 2: Integer, java.lang.Boolean.FALSE) == | ||
"hello2false0" | ||
) | ||
assert( | ||
cls.getMethod("foo", classOf[String], classOf[Int], classOf[Boolean], classOf[Long]) | ||
.invoke(instance, "hello", 2: Integer, java.lang.Boolean.FALSE, 3: Integer) == | ||
"hello2false3" | ||
) | ||
|
||
cls.getMethods.filter(_.getName.contains("foo")).foreach(println) | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package unroll | ||
|
||
abstract class Unrolled{ | ||
def foo(s: String, n: Int = 1): String | ||
} | ||
|
||
object Unrolled extends Unrolled{ | ||
def foo(s: String, n: Int = 1) = s + n | ||
} | ||
|
||
class UnrolledCls extends Unrolled{ | ||
def foo(s: String, n: Int = 1) = s + n | ||
} |
14 changes: 14 additions & 0 deletions
14
unroll/tests/abstractClassMethod/v1/test/src/UnrollTestMain.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
val unrolled = new UnrolledCls | ||
logAssertStartsWith(unrolled.foo("cow"), "cow1") | ||
logAssertStartsWith(unrolled.foo("cow", 2), "cow2") | ||
|
||
logAssertStartsWith(Unrolled.foo("cow"), "cow1") | ||
logAssertStartsWith(Unrolled.foo("cow", 2), "cow2") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package unroll | ||
|
||
abstract class Unrolled{ | ||
def foo(s: String, n: Int = 1, @Unroll b: Boolean = true): String | ||
} | ||
|
||
object Unrolled extends Unrolled{ | ||
def foo(s: String, n: Int = 1, b: Boolean = true) = s + n + b | ||
} | ||
|
||
class UnrolledCls extends Unrolled{ | ||
def foo(s: String, n: Int = 1, b: Boolean = true) = s + n + b | ||
} |
30 changes: 30 additions & 0 deletions
30
unroll/tests/abstractClassMethod/v2/test/src/UnrollTestMain.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
val unrolled = new UnrolledCls | ||
logAssertStartsWith(unrolled.foo("cow"), "cow1true") | ||
logAssertStartsWith(unrolled.foo("cow", 2), "cow2true") | ||
logAssertStartsWith(unrolled.foo("cow", 2, false), "cow2false") | ||
|
||
logAssertStartsWith(Unrolled.foo("cow"), "cow1true") | ||
logAssertStartsWith(Unrolled.foo("cow", 2), "cow2true") | ||
logAssertStartsWith(Unrolled.foo("cow", 2, false), "cow2false") | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package unroll | ||
|
||
abstract class Unrolled{ | ||
def foo(s: String, n: Int = 1, @Unroll b: Boolean = true, l: Long = 0): String | ||
} | ||
|
||
object Unrolled extends Unrolled{ | ||
def foo(s: String, n: Int = 1, b: Boolean = true, l: Long = 0) = s + n + b + l | ||
} | ||
class UnrolledCls extends Unrolled{ | ||
def foo(s: String, n: Int = 1, b: Boolean = true, l: Long = 0) = s + n + b + l | ||
} |
32 changes: 32 additions & 0 deletions
32
unroll/tests/abstractClassMethod/v3/test/src/UnrollTestMain.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
val unrolled = new UnrolledCls | ||
logAssertStartsWith(unrolled.foo("cow"), "cow1true0") | ||
logAssertStartsWith(unrolled.foo("cow", 2), "cow2true0") | ||
logAssertStartsWith(unrolled.foo("cow", 2, false), "cow2false0") | ||
logAssertStartsWith(unrolled.foo("cow", 2, false, 3), "cow2false3") | ||
|
||
logAssertStartsWith(Unrolled.foo("cow"), "cow1true0") | ||
logAssertStartsWith(Unrolled.foo("cow", 2), "cow2true0") | ||
logAssertStartsWith(Unrolled.foo("cow", 2, false), "cow2false0") | ||
logAssertStartsWith(Unrolled.foo("cow", 2, false, 3), "cow2false3") | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package unroll | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
val instance = new Unrolled {} | ||
val cls = classOf[Unrolled] | ||
|
||
assert(scala.util.Try(cls.getMethod("foo", classOf[String])).isFailure) | ||
println() | ||
assert( | ||
cls.getMethod("foo", classOf[String], classOf[Int]).invoke(instance, "hello", 2: Integer) == | ||
"hello2true0" | ||
) | ||
assert( | ||
cls.getMethod("foo", classOf[String], classOf[Int], classOf[Boolean]) | ||
.invoke(instance, "hello", 2: Integer, java.lang.Boolean.FALSE) == | ||
"hello2false0" | ||
) | ||
assert( | ||
cls.getMethod("foo", classOf[String], classOf[Int], classOf[Boolean], classOf[Long]) | ||
.invoke(instance, "hello", 2: Integer, java.lang.Boolean.FALSE, 3: Integer) == | ||
"hello2false3" | ||
) | ||
|
||
cls.getMethods.filter(_.getName.contains("foo")).foreach(println) | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package unroll | ||
|
||
trait Unrolled{ | ||
def foo(s: String, n: Int = 1): String | ||
} | ||
|
||
object Unrolled extends Unrolled{ | ||
def foo(s: String, n: Int = 1) = s + n | ||
} | ||
|
||
class UnrolledCls extends Unrolled{ | ||
def foo(s: String, n: Int = 1) = s + n | ||
} |
14 changes: 14 additions & 0 deletions
14
unroll/tests/abstractTraitMethod/v1/test/src/UnrollTestMain.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
val unrolled = new UnrolledCls | ||
logAssertStartsWith(unrolled.foo("cow"), "cow1") | ||
logAssertStartsWith(unrolled.foo("cow", 2), "cow2") | ||
|
||
logAssertStartsWith(Unrolled.foo("cow"), "cow1") | ||
logAssertStartsWith(Unrolled.foo("cow", 2), "cow2") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package unroll | ||
|
||
trait Unrolled{ | ||
def foo(s: String, n: Int = 1, @Unroll b: Boolean = true): String | ||
} | ||
|
||
object Unrolled extends Unrolled{ | ||
def foo(s: String, n: Int = 1, b: Boolean = true) = s + n + b | ||
} | ||
|
||
class UnrolledCls extends Unrolled{ | ||
def foo(s: String, n: Int = 1, b: Boolean = true) = s + n + b | ||
} |
30 changes: 30 additions & 0 deletions
30
unroll/tests/abstractTraitMethod/v2/test/src/UnrollTestMain.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
val unrolled = new UnrolledCls | ||
logAssertStartsWith(unrolled.foo("cow"), "cow1true") | ||
logAssertStartsWith(unrolled.foo("cow", 2), "cow2true") | ||
logAssertStartsWith(unrolled.foo("cow", 2, false), "cow2false") | ||
|
||
logAssertStartsWith(Unrolled.foo("cow"), "cow1true") | ||
logAssertStartsWith(Unrolled.foo("cow", 2), "cow2true") | ||
logAssertStartsWith(Unrolled.foo("cow", 2, false), "cow2false") | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package unroll | ||
|
||
trait Unrolled{ | ||
def foo(s: String, n: Int = 1, @Unroll b: Boolean = true, l: Long = 0): String | ||
} | ||
|
||
object Unrolled extends Unrolled{ | ||
def foo(s: String, n: Int = 1, b: Boolean = true, l: Long = 0) = s + n + b + l | ||
} | ||
class UnrolledCls extends Unrolled{ | ||
def foo(s: String, n: Int = 1, b: Boolean = true, l: Long = 0) = s + n + b + l | ||
} |
32 changes: 32 additions & 0 deletions
32
unroll/tests/abstractTraitMethod/v3/test/src/UnrollTestMain.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
val unrolled = new UnrolledCls | ||
logAssertStartsWith(unrolled.foo("cow"), "cow1true0") | ||
logAssertStartsWith(unrolled.foo("cow", 2), "cow2true0") | ||
logAssertStartsWith(unrolled.foo("cow", 2, false), "cow2false0") | ||
logAssertStartsWith(unrolled.foo("cow", 2, false, 3), "cow2false3") | ||
|
||
logAssertStartsWith(Unrolled.foo("cow"), "cow1true0") | ||
logAssertStartsWith(Unrolled.foo("cow", 2), "cow2true0") | ||
logAssertStartsWith(Unrolled.foo("cow", 2, false), "cow2false0") | ||
logAssertStartsWith(Unrolled.foo("cow", 2, false, 3), "cow2false3") | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|