[Jspecify] Substitute enhancement of type instead of type itself directly

This commit is contained in:
Victor Petukhov
2021-05-12 19:17:34 +03:00
parent 2479655708
commit 12f6146bdf
3 changed files with 7 additions and 6 deletions
@@ -54,8 +54,9 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker {
} else {
val lowerBound = substitute(type.lowerBound, keepAnnotation, runCapturedChecks)
val upperBound = substitute(type.upperBound, keepAnnotation, runCapturedChecks)
val enhancement =
if (type is TypeWithEnhancement) substituteTypeEnhancement(type, keepAnnotation, runCapturedChecks) else null
val enhancement = if (type is TypeWithEnhancement) {
substituteTypeEnhancement(type.enhancement, keepAnnotation, runCapturedChecks)
} else null
if (lowerBound == null && upperBound == null) {
null
@@ -18,8 +18,8 @@ fun <T : Test> main(a1: NonPlatformTypeParameter<Any?>, a2: NonPlatformTypeParam
a1.bar<T>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
a1.bar<T>(x)
// jspecify_nullness_mismatch{mute}
a2.foo(null)
// jspecify_nullness_mismatch
a2.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
a2.bar<Test?>(null)
// jspecify_nullness_mismatch
a2.bar<T>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
@@ -18,8 +18,8 @@ fun <T : Test> main(a1: NonPlatformTypeParameter<Any?>, a2: NonPlatformTypeParam
a1.bar<T>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
a1.bar<T>(x)
// jspecify_nullness_mismatch{mute}
a2.foo(null)
// jspecify_nullness_mismatch
a2.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
a2.bar<Test?>(null)
// jspecify_nullness_mismatch
a2.bar<T>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)