GreatSyntacticShift: Codegen testdata fixed
This commit is contained in:
@@ -5,7 +5,7 @@ fun reformat(
|
||||
divideByCamelHumps : Boolean = true,
|
||||
wordSeparator : String = " "
|
||||
) =
|
||||
(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
|
||||
#(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
|
||||
|
||||
trait A {
|
||||
fun bar2(arg: Int = 239) : Int
|
||||
@@ -38,7 +38,7 @@ class C() : B() {
|
||||
fun <T> T.toPrefixedString(prefix: String = "", suffix: String="") = prefix + (this as java.lang.Object).toString() + suffix
|
||||
|
||||
fun box() : String {
|
||||
val expected = (true, true, true, " ")
|
||||
val expected = #(true, true, true, " ")
|
||||
|
||||
if("mama".toPrefixedString(suffix="321", prefix="papa") != "papamama321") return "fail"
|
||||
if("mama".toPrefixedString(prefix="papa") != "papamama") return "fail"
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
fun Any.foo1() : fun(): String {
|
||||
fun Any.foo1() : ()-> String {
|
||||
return { "239" + this }
|
||||
}
|
||||
|
||||
fun Int.foo2() : fun(i : Int) : Int {
|
||||
return { x => x + this }
|
||||
fun Int.foo2() : (i : Int) -> Int {
|
||||
return { x -> x + this }
|
||||
}
|
||||
|
||||
fun fooT1<T>(t : T) = { t.toString() }
|
||||
|
||||
fun fooT2<T>(t: T) = { (x:T) => t.toString() + x.toString() }
|
||||
fun fooT2<T>(t: T) = { (x:T) -> t.toString() + x.toString() }
|
||||
|
||||
fun box() : String {
|
||||
if( (10.foo1())() != "23910") return "foo1 fail"
|
||||
if( (10.foo2())(1) != 11 ) return "foo2 fail"
|
||||
|
||||
if(1.{Int.() => this + 1}() != 2) return "test 3 failed";
|
||||
if(1.{Int.() -> this + 1}() != 2) return "test 3 failed";
|
||||
if( {1}() != 1) return "test 4 failed";
|
||||
if( {(x : Int) => x}(1) != 1) return "test 5 failed";
|
||||
if( 1.{Int.(x : Int) => x + this}(1) != 2) return "test 6 failed";
|
||||
if( 1.({Int.() => this})() != 1) return "test 7 failed";
|
||||
if( {(x : Int) -> x}(1) != 1) return "test 5 failed";
|
||||
if( 1.{Int.(x : Int) -> x + this}(1) != 2) return "test 6 failed";
|
||||
if( 1.({Int.() -> this})() != 1) return "test 7 failed";
|
||||
if( (fooT1<String>("mama"))() != "mama") return "test 8 failed";
|
||||
if( (fooT2<String>("mama"))("papa") != "mamapapa") return "test 9 failed";
|
||||
return "OK"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fun loop(var times : Int) {
|
||||
while(times > 0) {
|
||||
val u : fun(value : Int) : Unit = {
|
||||
val u : (value : Int) -> Unit = {
|
||||
System.out?.println(it)
|
||||
}
|
||||
u(times--)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class X<T> () {
|
||||
fun getTypeChecker() = { (a : Any) => a is T }
|
||||
fun getTypeChecker() = { (a : Any) -> a is T }
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
|
||||
Reference in New Issue
Block a user