isError() implemented for lazy java types

This commit is contained in:
Andrey Breslav
2013-10-24 13:49:54 +04:00
parent 03a9c776b2
commit 089352b525
2 changed files with 5 additions and 1 deletions
@@ -22,6 +22,8 @@ import org.jetbrains.jet.lang.types.TypeProjection
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.jet.lang.resolve.scopes.JetScope
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() {
@@ -42,7 +44,7 @@ abstract class LazyType(storageManager: StorageManager) : AbstractJetType() {
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()
}
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.util
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:
// foo.eq(bar).iif(a, b)
fun <T> T.eq(eq: T): Boolean = this == eq