From ee927a15a98231c39f214917b4a8086db71812e0 Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Tue, 11 May 2021 17:17:37 +0300 Subject: [PATCH] Compute nullability for stub types properly --- .../src/org/jetbrains/kotlin/types/TypeUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.java b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.java index c60dc0756eb..c6b1d244c70 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.java @@ -303,6 +303,11 @@ public class TypeUtils { if (isTypeParameter(type)) { return hasNullableSuperType(type); } + if (type instanceof AbstractStubType) { + NewTypeVariableConstructor typeVariableConstructor = (NewTypeVariableConstructor) ((AbstractStubType) type).getOriginalTypeVariable(); + TypeParameterDescriptor typeParameter = typeVariableConstructor.getOriginalTypeParameter(); + return typeParameter == null || hasNullableSuperType(typeParameter.getDefaultType()); + } TypeConstructor constructor = type.getConstructor(); if (constructor instanceof IntersectionTypeConstructor) {