Unit.VALUE -> Unit in testData
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
fun box(): String {
|
||||
val a = if(true) {
|
||||
}
|
||||
return if (a.toString() == "Unit.VALUE") "OK" else "fail"
|
||||
return if (a.toString() == "kotlin.Unit") "OK" else "fail"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
fun main(args: Array<String>?) {
|
||||
val y: Unit = Unit.VALUE //do not compile
|
||||
val y: Unit = Unit //do not compile
|
||||
A<Unit>() //do not compile
|
||||
C<Unit>(Unit.VALUE) //do not compile
|
||||
C<Unit>(Unit) //do not compile
|
||||
//do not compile
|
||||
System.out?.println(fff<Unit>(Unit.VALUE)) //do not compile
|
||||
System.out?.println(fff<Unit>(Unit)) //do not compile
|
||||
System.out?.println(id<Unit>(y)) //do not compile
|
||||
System.out?.println(fff<Unit>(id<Unit>(y)) == id<Unit>(foreach(Array<Int>(0,{0}),{(e : Int) : Unit -> }))) //do not compile
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ val baz: String by StringHandler
|
||||
|
||||
val metadatas = IdentityHashMap<PropertyMetadata, Unit>()
|
||||
|
||||
fun record(p: PropertyMetadata) = metadatas.put(p, Unit.VALUE)
|
||||
fun record(p: PropertyMetadata) = metadatas.put(p, Unit)
|
||||
|
||||
object IntHandler {
|
||||
fun get(t: Any?, p: PropertyMetadata): Int { record(p); return 42 }
|
||||
|
||||
@@ -15,7 +15,7 @@ fun test2(a: A): Int {
|
||||
}
|
||||
|
||||
fun test3(b: B): Int {
|
||||
return b[Unit.VALUE, Unit.VALUE]
|
||||
return b[Unit, Unit]
|
||||
}
|
||||
|
||||
|
||||
@@ -30,4 +30,4 @@ fun box() : String {
|
||||
if (result != 2) return "fail3: $result"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ tailRecursive fun foo(x: Int) {
|
||||
return if (x > 0) {
|
||||
(foo(x - 1))
|
||||
}
|
||||
else Unit.VALUE
|
||||
else Unit
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo(1000000)
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ class D {
|
||||
}
|
||||
|
||||
object P {
|
||||
val u = Unit.VALUE
|
||||
val u = Unit
|
||||
val v by D()
|
||||
var w = Unit.VALUE
|
||||
var w = Unit
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (P.u != P.v) return "Fail uv"
|
||||
P.w = Unit.VALUE
|
||||
P.w = Unit
|
||||
if (P.w != P.u) return "Fail w"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun foo() {}
|
||||
|
||||
fun box(): String {
|
||||
return if (foo() == Unit.VALUE) "OK" else "Fail"
|
||||
return if (foo() == Unit) "OK" else "Fail"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
val c = Unit.VALUE
|
||||
val c = Unit
|
||||
val d = c
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -11,7 +11,7 @@ fun quux(): Unit? = bar()
|
||||
fun box(): String {
|
||||
foo()
|
||||
|
||||
if (foo() != Unit.VALUE) return "Fail 1"
|
||||
if (foo() != Unit) return "Fail 1"
|
||||
if (foo() != bar()) return "Fail 2"
|
||||
if (bar() != baz()) return "Fail 3"
|
||||
if (baz() != quux()) return "Fail 4"
|
||||
|
||||
@@ -7,7 +7,5 @@ fun box(): String {
|
||||
|
||||
if (Unit != Unit) return "Fail Unit != Unit"
|
||||
|
||||
if (a.VALUE != Unit.VALUE) return "Fail a.VALUE != Unit.VALUE"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
data class A(val x: Unit)
|
||||
|
||||
fun box(): String {
|
||||
val a = A(Unit.VALUE)
|
||||
return if ("$a" == "A(x=Unit.VALUE)") "OK" else "$a"
|
||||
val a = A(Unit)
|
||||
return if ("$a" == "A(x=kotlin.Unit)") "OK" else "$a"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
data class A(val x: Unit)
|
||||
|
||||
fun box(): String {
|
||||
val a = A(Unit.VALUE)
|
||||
val a = A(Unit)
|
||||
return if (a.component1() is Unit) "OK" else "Fail ${a.component1()}"
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ fun t1() : Boolean {
|
||||
x = x + "45" + y
|
||||
x = x.substring(3)
|
||||
x += "aaa"
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
foo()
|
||||
|
||||
@@ -43,7 +43,7 @@ fun t2() : Boolean {
|
||||
x = x + 5 + y
|
||||
x += 5
|
||||
x++
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
foo()
|
||||
x -= 55
|
||||
@@ -55,7 +55,7 @@ fun t3() : Boolean {
|
||||
var x = true
|
||||
val foo = {
|
||||
x = false
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
foo()
|
||||
return !x
|
||||
@@ -67,7 +67,7 @@ fun t4() : Boolean {
|
||||
val foo = {
|
||||
x = x + 200.toFloat() + y
|
||||
x += 18
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
foo()
|
||||
System.out?.println(x)
|
||||
@@ -80,7 +80,7 @@ fun t5() : Boolean {
|
||||
val foo = {
|
||||
x = x + 200.toDouble() + y
|
||||
x -= 22
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
foo()
|
||||
System.out?.println(x)
|
||||
@@ -94,7 +94,7 @@ fun t6() : Boolean {
|
||||
x = (x + 20.toByte() + y).toByte()
|
||||
x += 2
|
||||
x--
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
foo()
|
||||
System.out?.println(x)
|
||||
@@ -105,7 +105,7 @@ fun t7() : Boolean {
|
||||
var x : Char = 'a'
|
||||
val foo = {
|
||||
x = 'b'
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
foo()
|
||||
System.out?.println(x)
|
||||
@@ -117,10 +117,10 @@ fun t8() : Boolean {
|
||||
val foo = {
|
||||
val bar = {
|
||||
x = 30.toShort()
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
bar()
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
foo()
|
||||
return x == 30.toShort()
|
||||
|
||||
Reference in New Issue
Block a user