No synthetic properties of type Unit

This commit is contained in:
Valentin Kipyatkov
2015-07-09 12:43:32 +03:00
parent bfdc74ce74
commit 82f1eafa0b
3 changed files with 8 additions and 1 deletions
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider
import org.jetbrains.kotlin.resolve.scopes.JetScope import org.jetbrains.kotlin.resolve.scopes.JetScope
import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.storage.StorageManager
import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.types.typeUtil.isUnit
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
import org.jetbrains.kotlin.utils.addIfNotNull import org.jetbrains.kotlin.utils.addIfNotNull
import java.util.* import java.util.*
@@ -69,6 +70,7 @@ class SyntheticExtensionsScope(storageManager: StorageManager) : JetScope by Jet
return descriptor.getValueParameters().isEmpty() return descriptor.getValueParameters().isEmpty()
&& descriptor.getTypeParameters().isEmpty() && descriptor.getTypeParameters().isEmpty()
&& descriptor.getVisibility() == Visibilities.PUBLIC //TODO: what about protected and package-local? && descriptor.getVisibility() == Visibilities.PUBLIC //TODO: what about protected and package-local?
&& !(descriptor.getReturnType()?.isUnit() ?: true)
} }
private fun isGoodSetMethod(descriptor: FunctionDescriptor, propertyType: JetType): Boolean { private fun isGoodSetMethod(descriptor: FunctionDescriptor, propertyType: JetType): Boolean {
@@ -3,12 +3,16 @@ fun foo(javaClass: JavaClass) {
javaClass.<!UNRESOLVED_REFERENCE!>something1<!> javaClass.<!UNRESOLVED_REFERENCE!>something1<!>
javaClass.<!UNRESOLVED_REFERENCE!>something2<!> javaClass.<!UNRESOLVED_REFERENCE!>something2<!>
javaClass.<!UNRESOLVED_REFERENCE!>somethingStatic<!> javaClass.<!UNRESOLVED_REFERENCE!>somethingStatic<!>
javaClass.<!UNRESOLVED_REFERENCE!>somethingVoid<!>
} }
// FILE: JavaClass.java // FILE: JavaClass.java
public class JavaClass { public class JavaClass {
public int getSomething1(int p) { return p; } public int getSomething1(int p) { return p; }
public <T> T getSomething2() { return null; } public <T> T getSomething2() { return null; }
public static int getSomethingStatic() { return 1; } public static int getSomethingStatic() { return 1; }
}
public void getSomethingVoid() { }
}
@@ -7,6 +7,7 @@ public open class JavaClass {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open fun getSomething1(/*0*/ p: kotlin.Int): kotlin.Int public open fun getSomething1(/*0*/ p: kotlin.Int): kotlin.Int
public open fun </*0*/ T> getSomething2(): T! public open fun </*0*/ T> getSomething2(): T!
public open fun getSomethingVoid(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String