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()
|
||||
|
||||
@@ -12,5 +12,5 @@ fun test() : Unit {
|
||||
y <!USELESS_CAST!>as?<!> Int : Int?
|
||||
x <!USELESS_CAST!>as?<!> Int? : Int?
|
||||
y <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as?<!> Int? : Int?
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ fun unitEmptyInfer() {}
|
||||
fun unitEmpty() : Unit {}
|
||||
fun unitEmptyReturn() : Unit {return}
|
||||
fun unitIntReturn() : Unit {return <!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>}
|
||||
fun unitUnitReturn() : Unit {return Unit.VALUE}
|
||||
fun unitUnitReturn() : Unit {return Unit}
|
||||
fun test1() : Any = {<!RETURN_NOT_ALLOWED, RETURN_TYPE_MISMATCH!>return<!>}
|
||||
fun test2() : Any = @a {<!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@a 1<!>}
|
||||
fun test3() : Any { <!RETURN_TYPE_MISMATCH!>return<!> }
|
||||
@@ -27,7 +27,7 @@ fun foo(<!UNUSED_PARAMETER!>expr<!>: StringBuilder): Int {
|
||||
}
|
||||
|
||||
|
||||
fun unitShort() : Unit = Unit.VALUE
|
||||
fun unitShort() : Unit = Unit
|
||||
fun unitShortConv() : Unit = <!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>
|
||||
fun unitShortNull() : Unit = <!NULL_FOR_NONNULL_TYPE!>null<!>
|
||||
|
||||
@@ -44,7 +44,7 @@ fun intFunctionLiteral(): Int = <!TYPE_MISMATCH!>{ 10 }<!>
|
||||
fun blockReturnUnitMismatch() : Int {<!RETURN_TYPE_MISMATCH!>return<!>}
|
||||
fun blockReturnValueTypeMismatch() : Int {return <!CONSTANT_EXPECTED_TYPE_MISMATCH!>3.4<!>}
|
||||
fun blockReturnValueTypeMatch() : Int {return 1}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>Unit.VALUE<!>}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>Unit<!>}
|
||||
|
||||
fun blockAndAndMismatch() : Int {
|
||||
true && false
|
||||
@@ -205,4 +205,4 @@ fun testFunctionLiterals() {
|
||||
object A {}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ fun cannotBe() {
|
||||
|
||||
<!UNRESOLVED_REFERENCE!>z<!> = 30;
|
||||
<!VARIABLE_EXPECTED!>""<!> = "";
|
||||
<!VARIABLE_EXPECTED!>foo()<!> = Unit.VALUE;
|
||||
<!VARIABLE_EXPECTED!>foo()<!> = Unit;
|
||||
|
||||
(<!VARIABLE_EXPECTED!>i <!USELESS_CAST!>as<!> Int<!>) = 34
|
||||
(<!VARIABLE_EXPECTED!>i is Int<!>) = false
|
||||
|
||||
@@ -39,7 +39,7 @@ fun test() {
|
||||
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
|
||||
}
|
||||
|
||||
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println(0) == Unit.VALUE) {
|
||||
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println(0) == Unit) {
|
||||
out?.println(1)
|
||||
out<!UNSAFE_CALL!>.<!>println(1)
|
||||
}
|
||||
@@ -47,21 +47,21 @@ fun test() {
|
||||
<!DEBUG_INFO_AUTOCAST!>out<!>.println(2)
|
||||
}
|
||||
|
||||
if (out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit.VALUE) {
|
||||
if (out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit) {
|
||||
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
|
||||
}
|
||||
else {
|
||||
out?.println();
|
||||
}
|
||||
|
||||
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit.VALUE) {
|
||||
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit) {
|
||||
out?.println();
|
||||
}
|
||||
else {
|
||||
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
|
||||
}
|
||||
|
||||
if (1 == 2 || out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println(1) == Unit.VALUE) {
|
||||
if (1 == 2 || out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println(1) == Unit) {
|
||||
out?.println(2);
|
||||
out<!UNSAFE_CALL!>.<!>println(2);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ fun test() {
|
||||
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
|
||||
}
|
||||
|
||||
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println(0) == Unit.VALUE) {
|
||||
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println(0) == Unit) {
|
||||
out?.println(1)
|
||||
out<!UNSAFE_CALL!>.<!>println(1)
|
||||
}
|
||||
@@ -106,7 +106,7 @@ fun test() {
|
||||
<!DEBUG_INFO_AUTOCAST!>out<!>.println(2)
|
||||
}
|
||||
|
||||
if (out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit.VALUE) {
|
||||
if (out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit) {
|
||||
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
|
||||
}
|
||||
else {
|
||||
@@ -114,7 +114,7 @@ fun test() {
|
||||
out<!UNSAFE_CALL!>.<!>println();
|
||||
}
|
||||
|
||||
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit.VALUE) {
|
||||
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit) {
|
||||
out?.println();
|
||||
out<!UNSAFE_CALL!>.<!>println();
|
||||
}
|
||||
@@ -122,7 +122,7 @@ fun test() {
|
||||
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
|
||||
}
|
||||
|
||||
if (1 == 2 || out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println(1) == Unit.VALUE) {
|
||||
if (1 == 2 || out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println(1) == Unit) {
|
||||
out?.println(2);
|
||||
out<!UNSAFE_CALL!>.<!>println(2);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
fun test() {
|
||||
return Unit.VALUE : Unit
|
||||
}
|
||||
return Unit : Unit
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ fun f3(s: Number?) {
|
||||
|
||||
fun f4(s: Int?) {
|
||||
var u = <!IMPLICIT_CAST_TO_UNIT_OR_ANY!>if (s!! == 42)<!>;
|
||||
if (u == Unit.VALUE) u = if (s == 239);
|
||||
if (u == Unit) u = if (s == 239);
|
||||
return u
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package outer
|
||||
|
||||
fun Int?.optint() : Unit {}
|
||||
val Int?.optval : Unit get() = Unit.VALUE
|
||||
val Int?.optval : Unit get() = Unit
|
||||
|
||||
fun <T: Any, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T {
|
||||
y.plus(1)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
fun test(a: Int) {
|
||||
val x = run @f{
|
||||
if (a > 0) <!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f<!>
|
||||
else <!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f Unit.VALUE<!>
|
||||
else <!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return@f Unit<!>
|
||||
}
|
||||
x: Unit
|
||||
}
|
||||
|
||||
fun run<T>(f: () -> T): T { return f() }
|
||||
fun run<T>(f: () -> T): T { return f() }
|
||||
|
||||
@@ -20,7 +20,7 @@ fun f9(init : A?) {
|
||||
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
a?.foo()
|
||||
}
|
||||
if (!(a is B) || <!DEBUG_INFO_AUTOCAST!>a<!>.bar() == Unit.VALUE) {
|
||||
if (!(a is B) || <!DEBUG_INFO_AUTOCAST!>a<!>.bar() == Unit) {
|
||||
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
if (!(a is B)) {
|
||||
@@ -102,7 +102,7 @@ fun f13(a : A?) {
|
||||
}
|
||||
|
||||
a?.foo()
|
||||
if (a is B && <!DEBUG_INFO_AUTOCAST!>a<!>.foo() == Unit.VALUE) {
|
||||
if (a is B && <!DEBUG_INFO_AUTOCAST!>a<!>.foo() == Unit) {
|
||||
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
|
||||
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
|
||||
}
|
||||
@@ -216,4 +216,4 @@ fun foo(aa: Any): Int {
|
||||
return <!AUTOCAST_IMPOSSIBLE!>a<!>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ public abstract class Aaa {
|
||||
// FILE: bbb.kt
|
||||
|
||||
class Bbb() : Aaa() {
|
||||
override fun foo(vararg args: String?) = Unit.VALUE
|
||||
override fun foo(vararg args: String?) = Unit
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ trait Bar
|
||||
trait A {
|
||||
fun <T> foo()
|
||||
where T : Foo, T : Bar
|
||||
= Unit.VALUE
|
||||
= Unit
|
||||
}
|
||||
|
||||
class B : A {
|
||||
override fun <T> foo()
|
||||
where T : Foo, T : Bar
|
||||
= Unit.VALUE
|
||||
= Unit
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ open class MyClass() : MyTrait, MyAbstractClass() {
|
||||
override fun foo() {}
|
||||
override fun bar() {}
|
||||
|
||||
override val pr : Unit = Unit.VALUE
|
||||
override val prr : Unit = Unit.VALUE
|
||||
override val pr : Unit = Unit
|
||||
override val prr : Unit = Unit
|
||||
}
|
||||
|
||||
class MyChildClass() : MyClass() {}
|
||||
@@ -25,14 +25,14 @@ class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass<!> : MyTrait, MyAbstract
|
||||
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass2<!>() : MyTrait, MyAbstractClass() {
|
||||
override fun foo() {}
|
||||
override val pr : Unit = Unit.VALUE
|
||||
override val prr : Unit = Unit.VALUE
|
||||
override val pr : Unit = Unit
|
||||
override val prr : Unit = Unit
|
||||
}
|
||||
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass3<!>() : MyTrait, MyAbstractClass() {
|
||||
override fun bar() {}
|
||||
override val pr : Unit = Unit.VALUE
|
||||
override val prr : Unit = Unit.VALUE
|
||||
override val pr : Unit = Unit
|
||||
override val prr : Unit = Unit
|
||||
}
|
||||
|
||||
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass4<!>() : MyTrait, MyAbstractClass() {
|
||||
@@ -44,7 +44,7 @@ class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass4<!>() : MyTrait, MyAbstr
|
||||
|
||||
class MyChildClass1() : MyClass() {
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>fun foo()<!> {}
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>val pr : Unit<!> = Unit.VALUE
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>val pr : Unit<!> = Unit
|
||||
override fun bar() {}
|
||||
override val prr : Unit = Unit.VALUE
|
||||
}
|
||||
override val prr : Unit = Unit
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ fun foo(a: A) {
|
||||
a.gen() // unit can be inferred
|
||||
}
|
||||
else {
|
||||
Unit.VALUE
|
||||
Unit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,4 @@ fun foo(a: A) {
|
||||
}
|
||||
|
||||
a.<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>gen<!>() // Shouldn't work: no info for inference
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
val foo: Unit = Unit.VALUE
|
||||
val foo: Unit = Unit
|
||||
var bar: String = ""
|
||||
var self: A
|
||||
get() = this
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public open class MethodTypePOneUpperBound() : java.lang.Object() {
|
||||
public open fun <T : Cloneable?> bar() : Unit = Unit.VALUE
|
||||
public open fun <T : Cloneable?> bar() : Unit = Unit
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public class MethodWithTypeP() : java.lang.Object() {
|
||||
public fun <P> f() : Unit = Unit.VALUE
|
||||
public fun <P> f() : Unit = Unit
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public class MethodWithTypePP() : java.lang.Object() {
|
||||
public fun <P, Q : P> f() : Unit = Unit.VALUE
|
||||
public fun <P, Q : P> f() : Unit = Unit
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public open class MethodWithTypePRefClassP<P>() : java.lang.Object() {
|
||||
public fun <Q : P> f() : Unit = Unit.VALUE
|
||||
public fun <Q : P> f() : Unit = Unit
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public final class MethosWithPRefTP() : java.lang.Object() {
|
||||
public fun <P> f(p0: P?) : Unit = Unit.VALUE
|
||||
public fun <P> f(p0: P?) : Unit = Unit
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public open class VarargInt() : java.lang.Object() {
|
||||
public open fun vararg(vararg p0: Int): Unit = Unit.VALUE
|
||||
public open fun vararg(vararg p0: Int): Unit = Unit
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package test
|
||||
|
||||
public open class VarargString() : java.lang.Object() {
|
||||
public open fun vararg(vararg p0: String?): Unit = Unit.VALUE
|
||||
public open fun vararg(vararg p0: String?): Unit = Unit
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@ trait Bar
|
||||
|
||||
fun <T> foo(): Unit
|
||||
where T : Foo, T : Bar
|
||||
= Unit.VALUE
|
||||
= Unit
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//ALLOW_AST_ACCESS
|
||||
package test
|
||||
|
||||
fun unit() = Unit.VALUE
|
||||
fun unit() = Unit
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package test
|
||||
|
||||
public open class Super {
|
||||
public fun String.foo() = Unit.VALUE
|
||||
public fun String.foo() = Unit
|
||||
public abstract fun String.bar(p: String)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun a(
|
||||
a : foo = Unit.VALUE,
|
||||
a : foo = Unit,
|
||||
a : foo = 10,
|
||||
a : foo = 0x10,
|
||||
a : foo = '1',
|
||||
@@ -43,4 +43,4 @@ fun a(
|
||||
continue
|
||||
@la
|
||||
continue @la
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,8 @@ JetFile: SimpleExpressions.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('VALUE')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
@@ -728,4 +724,4 @@ JetFile: SimpleExpressions.kt
|
||||
LABEL
|
||||
PsiElement(LABEL_IDENTIFIER)('@la')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
|
||||
@@ -12,5 +12,5 @@ fun test() : Unit {
|
||||
y <warning>as?</warning> Int : Int?
|
||||
x <warning>as?</warning> Int? : Int?
|
||||
y <warning>as?</warning> Int? : Int?
|
||||
Unit.VALUE
|
||||
}
|
||||
Unit
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun Int?.optint() : Unit {}
|
||||
val Int?.optval : Unit get() = Unit.VALUE
|
||||
val Int?.optval : Unit get() = Unit
|
||||
|
||||
fun <T: Any, E> T.foo(<warning>x</warning> : E, y : A) : T {
|
||||
y.plus(1)
|
||||
|
||||
@@ -4,7 +4,7 @@ fun unitEmptyInfer() {}
|
||||
fun unitEmpty() : Unit {}
|
||||
fun unitEmptyReturn() : Unit {return}
|
||||
fun unitIntReturn() : Unit {return <error>1</error>}
|
||||
fun unitUnitReturn() : Unit {return Unit.VALUE}
|
||||
fun unitUnitReturn() : Unit {return Unit}
|
||||
fun test1() : Any = { <error>return</error> }
|
||||
fun test2() : Any = @a {<error>return@a 1</error>}
|
||||
fun test3() : Any { <error>return</error> }
|
||||
@@ -22,7 +22,7 @@ fun foo(<warning>expr</warning>: StringBuilder): Int {
|
||||
}
|
||||
|
||||
|
||||
fun unitShort() : Unit = Unit.VALUE
|
||||
fun unitShort() : Unit = Unit
|
||||
fun unitShortConv() : Unit = <error>1</error>
|
||||
fun unitShortNull() : Unit = <error>null</error>
|
||||
|
||||
@@ -39,7 +39,7 @@ fun intFunctionLiteral(): Int = <error>{ 10 }</error>
|
||||
fun blockReturnUnitMismatch() : Int {<error>return</error>}
|
||||
fun blockReturnValueTypeMismatch() : Int {return <error>3.4</error>}
|
||||
fun blockReturnValueTypeMatch() : Int {return 1}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <error>Unit.VALUE</error>}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <error>Unit</error>}
|
||||
|
||||
fun blockAndAndMismatch() : Int {
|
||||
true && false
|
||||
|
||||
@@ -38,28 +38,28 @@ fun test() {
|
||||
out.println();
|
||||
}
|
||||
|
||||
if (out == null || out.println(0) == Unit.VALUE) {
|
||||
if (out == null || out.println(0) == Unit) {
|
||||
out?.println(1)
|
||||
}
|
||||
else {
|
||||
out.println(2)
|
||||
}
|
||||
|
||||
if (out != null && out.println() == Unit.VALUE) {
|
||||
if (out != null && out.println() == Unit) {
|
||||
out.println();
|
||||
}
|
||||
else {
|
||||
out?.println();
|
||||
}
|
||||
|
||||
if (out == null || out.println() == Unit.VALUE) {
|
||||
if (out == null || out.println() == Unit) {
|
||||
out?.println();
|
||||
}
|
||||
else {
|
||||
out.println();
|
||||
}
|
||||
|
||||
if (1 == 2 || out != null && out.println(1) == Unit.VALUE) {
|
||||
if (1 == 2 || out != null && out.println(1) == Unit) {
|
||||
out?.println(2);
|
||||
}
|
||||
else {
|
||||
@@ -94,28 +94,28 @@ fun test() {
|
||||
out.println();
|
||||
}
|
||||
|
||||
if (out == null || out.println(0) == Unit.VALUE) {
|
||||
if (out == null || out.println(0) == Unit) {
|
||||
out?.println(1)
|
||||
}
|
||||
else {
|
||||
out.println(2)
|
||||
}
|
||||
|
||||
if (out != null && out.println() == Unit.VALUE) {
|
||||
if (out != null && out.println() == Unit) {
|
||||
out.println();
|
||||
}
|
||||
else {
|
||||
out?.println();
|
||||
}
|
||||
|
||||
if (out == null || out.println() == Unit.VALUE) {
|
||||
if (out == null || out.println() == Unit) {
|
||||
out?.println();
|
||||
}
|
||||
else {
|
||||
out.println();
|
||||
}
|
||||
|
||||
if (1 == 2 || out != null && out.println(1) == Unit.VALUE) {
|
||||
if (1 == 2 || out != null && out.println(1) == Unit) {
|
||||
out?.println(2);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -19,7 +19,7 @@ fun f9(a : A?) {
|
||||
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||
a<info>?.</info>foo()
|
||||
}
|
||||
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == Unit.VALUE) {
|
||||
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == Unit) {
|
||||
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||
}
|
||||
if (!(a is B)) {
|
||||
@@ -97,7 +97,7 @@ fun f13(a : A?) {
|
||||
}
|
||||
|
||||
a<info>?.</info>foo()
|
||||
if (a is B && <info descr="Automatically cast to B">a</info>.foo() == Unit.VALUE) {
|
||||
if (a is B && <info descr="Automatically cast to B">a</info>.foo() == Unit) {
|
||||
<info descr="Automatically cast to B">a</info>.foo()
|
||||
<info descr="Automatically cast to B">a</info>.bar()
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
fun test() {
|
||||
class Test()
|
||||
|
||||
fun Test.invoke(): Unit = Unit.VALUE
|
||||
fun Test.invoke(): Unit = Unit
|
||||
|
||||
val test = Test()
|
||||
test.i<caret>nvoke()
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
fun test() {
|
||||
class Test()
|
||||
|
||||
fun Test.invoke(): Unit = Unit.VALUE
|
||||
fun Test.invoke(): Unit = Unit
|
||||
|
||||
val test = Test()
|
||||
test()
|
||||
|
||||
@@ -1 +1 @@
|
||||
val x <caret>= Unit.VALUE
|
||||
val x <caret>= Unit
|
||||
|
||||
@@ -1 +1 @@
|
||||
val x: Unit = Unit.VALUE
|
||||
val x: Unit = Unit
|
||||
|
||||
@@ -1 +1 @@
|
||||
fun <caret>test(a : Int = 1) = Unit.VALUE
|
||||
fun <caret>test(a : Int = 1) = Unit
|
||||
|
||||
Reference in New Issue
Block a user