Allow to declare vararg parameters of unsigned types
varargs inside annotations will be supported later when constant evaluation of more complex expressions of unsigned types will be ready #KT-24880 In Progress
This commit is contained in:
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve
|
||||
import com.google.common.collect.ImmutableSet
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.UnsignedTypes
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
@@ -921,7 +922,9 @@ class DeclarationsChecker(
|
||||
val nullableNothing = callableDescriptor.builtIns.nullableNothingType
|
||||
for (parameter in varargParameters) {
|
||||
val varargElementType = parameter.varargElementType!!.upperIfFlexible()
|
||||
if (KotlinTypeChecker.DEFAULT.isSubtypeOf(varargElementType, nullableNothing) || varargElementType.isInlineClassType()) {
|
||||
if (KotlinTypeChecker.DEFAULT.isSubtypeOf(varargElementType, nullableNothing) ||
|
||||
(varargElementType.isInlineClassType() && !UnsignedTypes.isUnsignedType(varargElementType))
|
||||
) {
|
||||
val parameterDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(parameter) as? KtParameter ?: continue
|
||||
trace.report(FORBIDDEN_VARARG_PARAMETER_TYPE.on(parameterDeclaration, varargElementType))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user