Revert "Fix typealias usage nullability and annotations lost in deserialization"

This reverts commit 070848a1
This commit is contained in:
Sergey Igushkin
2020-08-05 20:17:49 +04:00
parent 5edbc75d7b
commit 093d4b3108
4 changed files with 2 additions and 47 deletions
@@ -1,31 +0,0 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
// FILE: A.kt
@Target(AnnotationTarget.TYPE)
annotation class Anno(val value: String)
class Foo
typealias MyFoo = Foo
class C<T>(val t: T)
typealias MyC = C<@Anno("OK") MyFoo?>
// FILE: B.kt
fun test(myc: MyC) {}
fun box(): String {
test(C(null))
val mycType = ::test.parameters.single().type
val argumentType = mycType.arguments.single().type!!
if (!argumentType.isMarkedNullable)
return "Fail: argument type should be seen as nullable"
val annotations = argumentType.annotations
if (annotations.toString() != "[@Anno(value=OK)]")
return "Fail: $annotations"
return "OK"
}
@@ -38,11 +38,6 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
runTest("compiler/testData/compileKotlinAgainstKotlin/annotationInInterface.kt");
}
@TestMetadata("annotationOnTypeUseInTypeAlias.kt")
public void testAnnotationOnTypeUseInTypeAlias() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/annotationOnTypeUseInTypeAlias.kt");
}
@TestMetadata("annotationsOnTypeAliases.kt")
public void testAnnotationsOnTypeAliases() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/annotationsOnTypeAliases.kt");
@@ -38,11 +38,6 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile
runTest("compiler/testData/compileKotlinAgainstKotlin/annotationInInterface.kt");
}
@TestMetadata("annotationOnTypeUseInTypeAlias.kt")
public void testAnnotationOnTypeUseInTypeAlias() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/annotationOnTypeUseInTypeAlias.kt");
}
@TestMetadata("annotationsOnTypeAliases.kt")
public void testAnnotationsOnTypeAliases() throws Exception {
runTest("compiler/testData/compileKotlinAgainstKotlin/annotationsOnTypeAliases.kt");
@@ -92,12 +92,8 @@ class TypeDeserializer(
val declarationDescriptor = constructor.declarationDescriptor
val simpleType = when {
expandTypeAliases && declarationDescriptor is TypeAliasDescriptor -> {
val expandedType = with(KotlinTypeFactory) { declarationDescriptor.computeExpandedType(arguments) }
expandedType
.makeNullableAsSpecified(proto.nullable)
.replaceAnnotations(Annotations.create(annotations + expandedType.annotations))
}
expandTypeAliases && declarationDescriptor is TypeAliasDescriptor ->
with(KotlinTypeFactory) { declarationDescriptor.computeExpandedType(arguments) }
Flags.SUSPEND_TYPE.get(proto.flags) ->
createSuspendFunctionType(annotations, constructor, arguments, proto.nullable)
else ->