-
-
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.
implementation and tests for unrolling non-first parameter list
- Loading branch information
Showing
12 changed files
with
200 additions
and
29 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
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,5 @@ | ||
package unroll | ||
|
||
class Unrolled{ | ||
def foo(f: String => String)(s: String) = f(s) | ||
} |
23 changes: 23 additions & 0 deletions
23
unroll/tests/secondParameterList/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,23 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
logAssertStartsWith(new Unrolled().foo(identity)("cow"), "cow") | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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,7 @@ | ||
package unroll | ||
|
||
import scala.annotation.unroll | ||
|
||
class Unrolled{ | ||
def foo(f: String => String)(s: String, @unroll n: Int = 1, b: Boolean = true) = f(s + n + b) | ||
} |
25 changes: 25 additions & 0 deletions
25
unroll/tests/secondParameterList/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,25 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
logAssertStartsWith(new Unrolled().foo(identity)("cow"), "cow1true") | ||
logAssertStartsWith(new Unrolled().foo(identity)("cow", 2), "cow2true") | ||
logAssertStartsWith(new Unrolled().foo(identity)("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,10 @@ | ||
package unroll | ||
|
||
import scala.annotation.unroll | ||
|
||
class Unrolled{ | ||
def foo(f: String => String)(s: String, @unroll n: Int = 1, b: Boolean = true, @unroll l: Long = 0) = f(s + n + b + l) | ||
} | ||
|
||
|
||
|
5 changes: 5 additions & 0 deletions
5
unroll/tests/secondParameterList/v3/test/src-js/UnrollTestPlatformSpecific.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,5 @@ | ||
package unroll | ||
|
||
object UnrollTestPlatformSpecific{ | ||
def apply() = {} | ||
} |
30 changes: 30 additions & 0 deletions
30
unroll/tests/secondParameterList/v3/test/src-jvm/UnrollTestPlatformSpecific.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 | ||
|
||
object UnrollTestPlatformSpecific{ | ||
def apply() = { | ||
val instance = new Unrolled() | ||
val cls = classOf[Unrolled] | ||
|
||
assert( | ||
cls.getMethod("foo", classOf[String => String], classOf[String]) | ||
.invoke(instance, identity[String](_), "hello") == | ||
"hello1true0" | ||
) | ||
|
||
assert( | ||
scala.util.Try(cls.getMethod("foo", classOf[String => String], classOf[String], classOf[Int])).isFailure | ||
) | ||
assert( | ||
cls.getMethod("foo", classOf[String => String], classOf[String], classOf[Int], classOf[Boolean]) | ||
.invoke(instance, identity[String](_), "hello", 2: Integer, java.lang.Boolean.FALSE) == | ||
"hello2false0" | ||
) | ||
assert( | ||
cls.getMethod("foo", classOf[String => String], classOf[String], classOf[Int], classOf[Boolean], classOf[Long]) | ||
.invoke(instance, identity[String](_), "hello", 2: Integer, java.lang.Boolean.FALSE, 3: Integer) == | ||
"hello2false3" | ||
) | ||
|
||
cls.getMethods.filter(_.getName.contains("foo")).foreach(println) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
unroll/tests/secondParameterList/v3/test/src-native/UnrollTestPlatformSpecific.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,5 @@ | ||
package unroll | ||
|
||
object UnrollTestPlatformSpecific{ | ||
def apply() = {} | ||
} |
28 changes: 28 additions & 0 deletions
28
unroll/tests/secondParameterList/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,28 @@ | ||
package unroll | ||
|
||
import unroll.TestUtils.logAssertStartsWith | ||
|
||
object UnrollTestMain{ | ||
def main(args: Array[String]): Unit = { | ||
UnrollTestPlatformSpecific() | ||
|
||
logAssertStartsWith(new Unrolled().foo(identity)("cow"), "cow1true0") | ||
logAssertStartsWith(new Unrolled().foo(identity)("cow", 2), "cow2true0") | ||
logAssertStartsWith(new Unrolled().foo(identity)("cow", 2, false), "cow2false0") | ||
logAssertStartsWith(new Unrolled().foo(identity)("cow", 2, false, 3), "cow2false3") | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|