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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user