isError() implemented for lazy java types
This commit is contained in:
+3
-1
@@ -22,6 +22,8 @@ import org.jetbrains.jet.lang.types.TypeProjection
|
|||||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor
|
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||||
import org.jetbrains.jet.lang.types.AbstractJetType
|
import org.jetbrains.jet.lang.types.AbstractJetType
|
||||||
|
import org.jetbrains.jet.lang.types.ErrorUtils
|
||||||
|
import org.jetbrains.kotlin.util.inn
|
||||||
|
|
||||||
abstract class LazyType(storageManager: StorageManager) : AbstractJetType() {
|
abstract class LazyType(storageManager: StorageManager) : AbstractJetType() {
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@ abstract class LazyType(storageManager: StorageManager) : AbstractJetType() {
|
|||||||
|
|
||||||
override fun isNullable() = false
|
override fun isNullable() = false
|
||||||
|
|
||||||
override fun isError() = false
|
override fun isError()= getConstructor().getDeclarationDescriptor().inn({ d -> ErrorUtils.isError(d)}, false)
|
||||||
|
|
||||||
override fun getAnnotations(): List<AnnotationDescriptor> = listOf()
|
override fun getAnnotations(): List<AnnotationDescriptor> = listOf()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.util
|
|||||||
|
|
||||||
fun Boolean.iif<T>(then: T, _else: T): T = if (this) then else _else
|
fun Boolean.iif<T>(then: T, _else: T): T = if (this) then else _else
|
||||||
|
|
||||||
|
fun <T: Any, R> T?.inn(then: (T) -> R, _else: R): R = if (this != null) then(this) else _else
|
||||||
|
|
||||||
// These two functions are needed in conjunction with iif:
|
// These two functions are needed in conjunction with iif:
|
||||||
// foo.eq(bar).iif(a, b)
|
// foo.eq(bar).iif(a, b)
|
||||||
fun <T> T.eq(eq: T): Boolean = this == eq
|
fun <T> T.eq(eq: T): Boolean = this == eq
|
||||||
|
|||||||
Reference in New Issue
Block a user