[FE 1.0] Keep the same type attributes during union or intersection type attributes
^KT-51317 Fixed
This commit is contained in:
+6
@@ -11472,6 +11472,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt47493.kt");
|
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt47493.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt51317.kt")
|
||||||
|
public void testKt51317() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt51317.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt6541_extensionForExtensionFunction.kt")
|
@TestMetadata("kt6541_extensionForExtensionFunction.kt")
|
||||||
public void testKt6541_extensionForExtensionFunction() throws Exception {
|
public void testKt6541_extensionForExtensionFunction() throws Exception {
|
||||||
|
|||||||
+6
@@ -11472,6 +11472,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt47493.kt");
|
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt47493.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt51317.kt")
|
||||||
|
public void testKt51317() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt51317.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt6541_extensionForExtensionFunction.kt")
|
@TestMetadata("kt6541_extensionForExtensionFunction.kt")
|
||||||
public void testKt6541_extensionForExtensionFunction() throws Exception {
|
public void testKt6541_extensionForExtensionFunction() throws Exception {
|
||||||
|
|||||||
+6
@@ -11472,6 +11472,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt47493.kt");
|
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt47493.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt51317.kt")
|
||||||
|
public void testKt51317() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt51317.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt6541_extensionForExtensionFunction.kt")
|
@TestMetadata("kt6541_extensionForExtensionFunction.kt")
|
||||||
public void testKt6541_extensionForExtensionFunction() throws Exception {
|
public void testKt6541_extensionForExtensionFunction() throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
val f: (String.() -> String)? = null
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val g = when {
|
||||||
|
f != null -> f
|
||||||
|
else -> {
|
||||||
|
{ this + "K" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return g("O")
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
val f: (String.() -> String)? = null
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val g = when {
|
||||||
|
f != null -> <!DEBUG_INFO_SMARTCAST!>f<!>
|
||||||
|
else -> {
|
||||||
|
{ this + "K" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return g("O")
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public val f: (kotlin.String.() -> kotlin.String)? = null
|
||||||
|
public fun box(): kotlin.String
|
||||||
Generated
+6
@@ -11478,6 +11478,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt47493.kt");
|
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt47493.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt51317.kt")
|
||||||
|
public void testKt51317() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/functionLiterals/kt51317.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("kt6541_extensionForExtensionFunction.kt")
|
@TestMetadata("kt6541_extensionForExtensionFunction.kt")
|
||||||
public void testKt6541_extensionForExtensionFunction() throws Exception {
|
public void testKt6541_extensionForExtensionFunction() throws Exception {
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ import org.jetbrains.kotlin.descriptors.annotations.composeAnnotations
|
|||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
class AnnotationsTypeAttribute(val annotations: Annotations) : TypeAttribute<AnnotationsTypeAttribute>() {
|
class AnnotationsTypeAttribute(val annotations: Annotations) : TypeAttribute<AnnotationsTypeAttribute>() {
|
||||||
override fun union(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute? = null
|
override fun union(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute? =
|
||||||
|
if (other == this) this else null
|
||||||
|
|
||||||
override fun intersect(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute? = null
|
override fun intersect(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute? =
|
||||||
|
if (other == this) this else null
|
||||||
|
|
||||||
override fun add(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute {
|
override fun add(other: AnnotationsTypeAttribute?): AnnotationsTypeAttribute {
|
||||||
if (other == null) return this
|
if (other == null) return this
|
||||||
@@ -23,6 +25,13 @@ class AnnotationsTypeAttribute(val annotations: Annotations) : TypeAttribute<Ann
|
|||||||
|
|
||||||
override val key: KClass<out AnnotationsTypeAttribute>
|
override val key: KClass<out AnnotationsTypeAttribute>
|
||||||
get() = AnnotationsTypeAttribute::class
|
get() = AnnotationsTypeAttribute::class
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (other !is AnnotationsTypeAttribute) return false
|
||||||
|
return other.annotations == this.annotations
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int = annotations.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
val TypeAttributes.annotationsAttribute: AnnotationsTypeAttribute? by TypeAttributes.attributeAccessor<AnnotationsTypeAttribute>()
|
val TypeAttributes.annotationsAttribute: AnnotationsTypeAttribute? by TypeAttributes.attributeAccessor<AnnotationsTypeAttribute>()
|
||||||
|
|||||||
Reference in New Issue
Block a user