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:
Mikhail Zarechenskiy
2018-06-14 12:55:54 +03:00
parent 3f462659d2
commit 3e45a1529c
4 changed files with 46 additions and 1 deletions
@@ -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))
}