Support generic underlying type of inline class

Use upper bound in JVM representation.
 #KT-32162
This commit is contained in:
Ilmir Usmanov
2021-12-09 03:37:17 +01:00
parent 732b8d4067
commit 9060168542
22 changed files with 326 additions and 12 deletions
@@ -95,7 +95,6 @@ object InlineClassDeclarationChecker : DeclarationChecker {
val baseParameterTypes = descriptor.safeAs<ClassDescriptor>()?.defaultType?.substitutedUnderlyingTypes() ?: emptyList()
for ((baseParameter, baseParameterType) in primaryConstructor.valueParameters zip baseParameterTypes) {
if (!isParameterAcceptableForInlineClass(baseParameter)) {
trace.report(Errors.VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER.on(baseParameter))
baseParametersOk = false
@@ -104,7 +103,10 @@ object InlineClassDeclarationChecker : DeclarationChecker {
val baseParameterTypeReference = baseParameter.typeReference
if (baseParameterType != null && baseParameterTypeReference != null) {
if (baseParameterType.isInapplicableParameterType()) {
if (baseParameterType.isInapplicableParameterType() &&
!(context.languageVersionSettings.supportsFeature(LanguageFeature.GenericInlineClassParameter) &&
(baseParameterType.isTypeParameter() || baseParameterType.isGenericArrayOfTypeParameter()))
) {
trace.report(Errors.VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE.on(baseParameterTypeReference, baseParameterType))
baseParametersOk = false
continue