Use 'Any?' instead of throwing NPE when calculating star projection type

It's a quite hacky solution, but the choice seems to be conservative, so these types can be refined later

 #KT-9597 Fixed
This commit is contained in:
Denis Zharkov
2016-06-23 17:50:45 +03:00
parent 71476d5d43
commit 8caee7940e
4 changed files with 71 additions and 2 deletions
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.types
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
class StarProjectionImpl(
private val typeParameter: TypeParameterDescriptor
@@ -45,7 +46,7 @@ fun TypeParameterDescriptor.starProjectionType(): KotlinType {
else null
}
).substitute(this.upperBounds.first(), Variance.OUT_VARIANCE)!!
).substitute(this.upperBounds.first(), Variance.OUT_VARIANCE) ?: builtIns.defaultBound
}
class TypeBasedStarProjectionImpl(
@@ -56,4 +57,4 @@ class TypeBasedStarProjectionImpl(
override fun getProjectionKind() = Variance.OUT_VARIANCE
override fun getType() = _type
}
}