[FIR] Initialize annotations in FirErrorTypeRef

^KT-62447 Fixed
^KT-62628 Fixed
This commit is contained in:
Ivan Kochurkin
2023-10-19 18:56:34 +02:00
committed by Space Team
parent ec3cfdefcb
commit bb937a8a21
24 changed files with 127 additions and 73 deletions
@@ -36,7 +36,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
SUPER_TYPES: SUPER_TYPES:
FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public? final? [ResolvedTo(SUPER_TYPES)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public? final? [ResolvedTo(SUPER_TYPES)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](LAZY_EXPRESSION) <ERROR TYPE REF: Symbol not found for Foo> {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
LAZY_super<<implicit>> LAZY_super<<implicit>>
} }
@@ -45,7 +45,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
TYPES: TYPES:
FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public? final? [ResolvedTo(TYPES)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public? final? [ResolvedTo(TYPES)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](LAZY_EXPRESSION) <ERROR TYPE REF: Symbol not found for Foo> {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
LAZY_super<<implicit>> LAZY_super<<implicit>>
} }
@@ -54,7 +54,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
STATUS: STATUS:
FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public final [ResolvedTo(STATUS)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(STATUS)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](LAZY_EXPRESSION) <ERROR TYPE REF: Symbol not found for Foo> {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
LAZY_super<<implicit>> LAZY_super<<implicit>>
} }
@@ -63,7 +63,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
EXPECT_ACTUAL_MATCHING: EXPECT_ACTUAL_MATCHING:
FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](LAZY_EXPRESSION) <ERROR TYPE REF: Symbol not found for Foo> {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
LAZY_super<<implicit>> LAZY_super<<implicit>>
} }
@@ -72,7 +72,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
CONTRACTS: CONTRACTS:
FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public final [ResolvedTo(CONTRACTS)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(CONTRACTS)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](LAZY_EXPRESSION) <ERROR TYPE REF: Symbol not found for Foo> {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
LAZY_super<<implicit>> LAZY_super<<implicit>>
} }
@@ -81,7 +81,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
IMPLICIT_TYPES_BODY_RESOLVE: IMPLICIT_TYPES_BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](LAZY_EXPRESSION) <ERROR TYPE REF: Symbol not found for Foo> {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
LAZY_super<<implicit>> LAZY_super<<implicit>>
} }
@@ -90,7 +90,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
ANNOTATION_ARGUMENTS: ANNOTATION_ARGUMENTS:
FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public final [ResolvedTo(ANNOTATION_ARGUMENTS)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(ANNOTATION_ARGUMENTS)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo> {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
LAZY_super<<implicit>> LAZY_super<<implicit>>
} }
@@ -99,7 +99,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
BODY_RESOLVE: BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public final [ResolvedTo(BODY_RESOLVE)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(BODY_RESOLVE)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo> {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -108,7 +108,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithArgumentInsideSuperTypeCallUnresolved.
FILE RAW TO BODY: FILE RAW TO BODY:
FILE: [ResolvedTo(BODY_RESOLVE)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt FILE: [ResolvedTo(BODY_RESOLVE)] annotationWithArgumentInsideSuperTypeCallUnresolved.kt
public final [ResolvedTo(BODY_RESOLVE)] class MyClass : <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(BODY_RESOLVE)] class MyClass : @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo> {
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] constructor(): R|MyClass| { public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=MyClass] constructor(): R|MyClass| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -20,37 +20,37 @@ FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt
TYPES: TYPES:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt
public? final? [ResolvedTo(TYPES)] fun foo([ResolvedTo(TYPES)] a: <ERROR TYPE REF: Symbol not found for Foo>): <ERROR TYPE REF: Symbol not found for Foo> { LAZY_BLOCK } public? final? [ResolvedTo(TYPES)] fun foo([ResolvedTo(TYPES)] a: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo> { LAZY_BLOCK }
STATUS: STATUS:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt
public final [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] a: <ERROR TYPE REF: Symbol not found for Foo>): <ERROR TYPE REF: Symbol not found for Foo> { LAZY_BLOCK } public final [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] a: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo> { LAZY_BLOCK }
EXPECT_ACTUAL_MATCHING: EXPECT_ACTUAL_MATCHING:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt
public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun foo([ResolvedTo(EXPECT_ACTUAL_MATCHING)] a: <ERROR TYPE REF: Symbol not found for Foo>): <ERROR TYPE REF: Symbol not found for Foo> { LAZY_BLOCK } public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun foo([ResolvedTo(EXPECT_ACTUAL_MATCHING)] a: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo> { LAZY_BLOCK }
CONTRACTS: CONTRACTS:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt
public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] a: <ERROR TYPE REF: Symbol not found for Foo>): <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(CONTRACTS)] fun foo([ResolvedTo(CONTRACTS)] a: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo> {
} }
IMPLICIT_TYPES_BODY_RESOLVE: IMPLICIT_TYPES_BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo([ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] a: <ERROR TYPE REF: Symbol not found for Foo>): <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo([ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] a: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo> {
} }
ANNOTATION_ARGUMENTS: ANNOTATION_ARGUMENTS:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt
public final [ResolvedTo(ANNOTATION_ARGUMENTS)] fun foo([ResolvedTo(ANNOTATION_ARGUMENTS)] a: <ERROR TYPE REF: Symbol not found for Foo>): <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(ANNOTATION_ARGUMENTS)] fun foo([ResolvedTo(ANNOTATION_ARGUMENTS)] a: @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>): @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo> {
} }
BODY_RESOLVE: BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnFunctionType.kt
public final [ResolvedTo(BODY_RESOLVE)] fun foo([ResolvedTo(BODY_RESOLVE)] a: <ERROR TYPE REF: Symbol not found for Foo>): <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(BODY_RESOLVE)] fun foo([ResolvedTo(BODY_RESOLVE)] a: @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>): @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo> {
} }
FILE RAW TO BODY: FILE RAW TO BODY:
FILE: [ResolvedTo(BODY_RESOLVE)] unresolvedAnnotationOnFunctionType.kt FILE: [ResolvedTo(BODY_RESOLVE)] unresolvedAnnotationOnFunctionType.kt
public final [ResolvedTo(BODY_RESOLVE)] fun foo([ResolvedTo(BODY_RESOLVE)] a: <ERROR TYPE REF: Symbol not found for Foo>): <ERROR TYPE REF: Symbol not found for Foo> { public final [ResolvedTo(BODY_RESOLVE)] fun foo([ResolvedTo(BODY_RESOLVE)] a: @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>): @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo> {
} }
@@ -25,40 +25,40 @@ FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt
TYPES: TYPES:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt
public? final? [ResolvedTo(TYPES)] val prop: <ERROR TYPE REF: Symbol not found for Foo> public? final? [ResolvedTo(TYPES)] val prop: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
public? [ResolvedTo(TYPES)] get(): <ERROR TYPE REF: Symbol not found for Foo> public? [ResolvedTo(TYPES)] get(): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
STATUS: STATUS:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt
public final [ResolvedTo(STATUS)] val prop: <ERROR TYPE REF: Symbol not found for Foo> public final [ResolvedTo(STATUS)] val prop: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
public [ResolvedTo(STATUS)] get(): <ERROR TYPE REF: Symbol not found for Foo> public [ResolvedTo(STATUS)] get(): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
EXPECT_ACTUAL_MATCHING: EXPECT_ACTUAL_MATCHING:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt
public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] val prop: <ERROR TYPE REF: Symbol not found for Foo> public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] val prop: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] get(): <ERROR TYPE REF: Symbol not found for Foo> public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] get(): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
CONTRACTS: CONTRACTS:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt
public final [ResolvedTo(CONTRACTS)] val prop: <ERROR TYPE REF: Symbol not found for Foo> public final [ResolvedTo(CONTRACTS)] val prop: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
public [ResolvedTo(CONTRACTS)] get(): <ERROR TYPE REF: Symbol not found for Foo> public [ResolvedTo(CONTRACTS)] get(): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
IMPLICIT_TYPES_BODY_RESOLVE: IMPLICIT_TYPES_BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val prop: <ERROR TYPE REF: Symbol not found for Foo> public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val prop: @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): <ERROR TYPE REF: Symbol not found for Foo> public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): @<ERROR TYPE REF: Symbol not found for Anno>[Unresolved](Foo#) <ERROR TYPE REF: Symbol not found for Foo>
ANNOTATION_ARGUMENTS: ANNOTATION_ARGUMENTS:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt
public final [ResolvedTo(ANNOTATION_ARGUMENTS)] val prop: <ERROR TYPE REF: Symbol not found for Foo> public final [ResolvedTo(ANNOTATION_ARGUMENTS)] val prop: @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>
public [ResolvedTo(ANNOTATION_ARGUMENTS)] get(): <ERROR TYPE REF: Symbol not found for Foo> public [ResolvedTo(ANNOTATION_ARGUMENTS)] get(): @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>
BODY_RESOLVE: BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt FILE: [ResolvedTo(IMPORTS)] unresolvedAnnotationOnPropertyType.kt
public final [ResolvedTo(BODY_RESOLVE)] val prop: <ERROR TYPE REF: Symbol not found for Foo> public final [ResolvedTo(BODY_RESOLVE)] val prop: @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>
public [ResolvedTo(BODY_RESOLVE)] get(): <ERROR TYPE REF: Symbol not found for Foo> public [ResolvedTo(BODY_RESOLVE)] get(): @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>
FILE RAW TO BODY: FILE RAW TO BODY:
FILE: [ResolvedTo(BODY_RESOLVE)] unresolvedAnnotationOnPropertyType.kt FILE: [ResolvedTo(BODY_RESOLVE)] unresolvedAnnotationOnPropertyType.kt
public final [ResolvedTo(BODY_RESOLVE)] val prop: <ERROR TYPE REF: Symbol not found for Foo> public final [ResolvedTo(BODY_RESOLVE)] val prop: @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>
public [ResolvedTo(BODY_RESOLVE)] get(): <ERROR TYPE REF: Symbol not found for Foo> public [ResolvedTo(BODY_RESOLVE)] get(): @<ERROR TYPE REF: Symbol not found for Anno>[Types]() <ERROR TYPE REF: Symbol not found for Foo>
@@ -1554,6 +1554,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt"); runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt");
} }
@Test
@TestMetadata("AnnotatedErrorTypeRef.kt")
public void testAnnotatedErrorTypeRef() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedErrorTypeRef.kt");
}
@Test @Test
@TestMetadata("annotatedExpressionInsideAnnotation.kt") @TestMetadata("annotatedExpressionInsideAnnotation.kt")
public void testAnnotatedExpressionInsideAnnotation() throws Exception { public void testAnnotatedExpressionInsideAnnotation() throws Exception {
@@ -1554,6 +1554,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt"); runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt");
} }
@Test
@TestMetadata("AnnotatedErrorTypeRef.kt")
public void testAnnotatedErrorTypeRef() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedErrorTypeRef.kt");
}
@Test @Test
@TestMetadata("annotatedExpressionInsideAnnotation.kt") @TestMetadata("annotatedExpressionInsideAnnotation.kt")
public void testAnnotatedExpressionInsideAnnotation() throws Exception { public void testAnnotatedExpressionInsideAnnotation() throws Exception {
@@ -1554,6 +1554,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt"); runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt");
} }
@Test
@TestMetadata("AnnotatedErrorTypeRef.kt")
public void testAnnotatedErrorTypeRef() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedErrorTypeRef.kt");
}
@Test @Test
@TestMetadata("annotatedExpressionInsideAnnotation.kt") @TestMetadata("annotatedExpressionInsideAnnotation.kt")
public void testAnnotatedExpressionInsideAnnotation() throws Exception { public void testAnnotatedExpressionInsideAnnotation() throws Exception {
@@ -1554,6 +1554,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt"); runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt");
} }
@Test
@TestMetadata("AnnotatedErrorTypeRef.kt")
public void testAnnotatedErrorTypeRef() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedErrorTypeRef.kt");
}
@Test @Test
@TestMetadata("annotatedExpressionInsideAnnotation.kt") @TestMetadata("annotatedExpressionInsideAnnotation.kt")
public void testAnnotatedExpressionInsideAnnotation() throws Exception { public void testAnnotatedExpressionInsideAnnotation() throws Exception {
@@ -49,6 +49,7 @@ fun FirTypeRef.resolvedTypeFromPrototype(
source = this@resolvedTypeFromPrototype.source ?: fallbackSource source = this@resolvedTypeFromPrototype.source ?: fallbackSource
this.type = type this.type = type
diagnostic = type.diagnostic diagnostic = type.diagnostic
annotations += this@resolvedTypeFromPrototype.annotations
} }
} else { } else {
buildResolvedTypeRef { buildResolvedTypeRef {
@@ -412,6 +412,7 @@ fun FirTypeRef.withReplacedConeType(
buildErrorTypeRef { buildErrorTypeRef {
source = newSource source = newSource
type = newType type = newType
annotations += this@withReplacedConeType.annotations
diagnostic = newType.diagnostic diagnostic = newType.diagnostic
} }
} else { } else {
@@ -282,6 +282,7 @@ open class PsiRawFirBuilder(
diagnostic = ConeSyntaxDiagnostic( diagnostic = ConeSyntaxDiagnostic(
if (this@toFirOrErrorType == null) "Incomplete code" else "Conversion failed" if (this@toFirOrErrorType == null) "Incomplete code" else "Conversion failed"
) )
this@toFirOrErrorType?.extractAnnotationsTo(this)
} }
// Here we accept lambda as receiver to prevent expression calculation in stub mode // Here we accept lambda as receiver to prevent expression calculation in stub mode
@@ -120,6 +120,7 @@ class FirSpecificTypeResolverTransformer(
if (resolvedType != null) { if (resolvedType != null) {
type = resolvedType type = resolvedType
} }
annotations += functionTypeRef.annotations
this.diagnostic = diagnostic ?: (resolvedType as? ConeErrorType)?.diagnostic this.diagnostic = diagnostic ?: (resolvedType as? ConeErrorType)?.diagnostic
?: ConeSimpleDiagnostic("Unresolved function type: ${functionTypeRef.render()}") ?: ConeSimpleDiagnostic("Unresolved function type: ${functionTypeRef.render()}")
} }
@@ -188,6 +189,7 @@ class FirSpecificTypeResolverTransformer(
delegatedTypeRef = typeRef delegatedTypeRef = typeRef
type = resolvedType type = resolvedType
annotations += typeRef.annotations
val partiallyResolvedTypeRef = tryCalculatingPartiallyResolvedTypeRef(typeRef, scopeClassDeclaration) val partiallyResolvedTypeRef = tryCalculatingPartiallyResolvedTypeRef(typeRef, scopeClassDeclaration)
this.partiallyResolvedTypeRef = partiallyResolvedTypeRef this.partiallyResolvedTypeRef = partiallyResolvedTypeRef
@@ -365,6 +365,7 @@ open class FirTypeResolveTransformer(
val errorTypeRef = buildErrorTypeRef { val errorTypeRef = buildErrorTypeRef {
source = originalTypeRef.source source = originalTypeRef.source
type = coneTypeFromCompilerRequiredPhase type = coneTypeFromCompilerRequiredPhase
annotations += originalTypeRef.annotations
delegatedTypeRef = originalTypeRef.delegatedTypeRef delegatedTypeRef = originalTypeRef.delegatedTypeRef
diagnostic = ConeAmbiguouslyResolvedAnnotationFromPlugin( diagnostic = ConeAmbiguouslyResolvedAnnotationFromPlugin(
coneTypeFromCompilerRequiredPhase, coneTypeFromCompilerRequiredPhase,
@@ -1236,12 +1236,14 @@ open class FirDeclarationsResolveTransformer(
return when (this) { return when (this) {
is FirImplicitTypeRef -> buildErrorTypeRef { is FirImplicitTypeRef -> buildErrorTypeRef {
diagnostic = ConeSimpleDiagnostic("No result type for initializer", DiagnosticKind.InferenceError) diagnostic = ConeSimpleDiagnostic("No result type for initializer", DiagnosticKind.InferenceError)
annotations.addAll(this@toExpectedTypeRef.annotations)
} }
is FirErrorTypeRef -> buildErrorTypeRef { is FirErrorTypeRef -> buildErrorTypeRef {
diagnostic = this@toExpectedTypeRef.diagnostic diagnostic = this@toExpectedTypeRef.diagnostic
this@toExpectedTypeRef.source?.fakeElement(KtFakeSourceElementKind.ImplicitTypeRef)?.let { this@toExpectedTypeRef.source?.fakeElement(KtFakeSourceElementKind.ImplicitTypeRef)?.let {
source = it source = it
} }
annotations.addAll(this@toExpectedTypeRef.annotations)
} }
else -> { else -> {
buildResolvedTypeRef { buildResolvedTypeRef {
@@ -293,6 +293,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
val actualSuperTypeRef = actualSuperType?.toFirResolvedTypeRef(superTypeRef.source, superTypeRef) ?: buildErrorTypeRef { val actualSuperTypeRef = actualSuperType?.toFirResolvedTypeRef(superTypeRef.source, superTypeRef) ?: buildErrorTypeRef {
source = superTypeRef.source source = superTypeRef.source
diagnostic = ConeSimpleDiagnostic("Not a super type", DiagnosticKind.NotASupertype) diagnostic = ConeSimpleDiagnostic("Not a super type", DiagnosticKind.NotASupertype)
annotations = superTypeRef.annotations.toMutableList()
} }
superReferenceContainer.resultType = actualSuperTypeRef.type superReferenceContainer.resultType = actualSuperTypeRef.type
superReference.replaceSuperTypeRef(actualSuperTypeRef) superReference.replaceSuperTypeRef(actualSuperTypeRef)
@@ -58,7 +58,7 @@ internal class FirErrorFunctionImpl(
override val typeParameters: List<FirTypeParameterRef> override val typeParameters: List<FirTypeParameterRef>
get() = emptyList() get() = emptyList()
override var status: FirDeclarationStatus = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS override var status: FirDeclarationStatus = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS
override var returnTypeRef: FirTypeRef = FirErrorTypeRefImpl(null, null, diagnostic) override var returnTypeRef: FirTypeRef = FirErrorTypeRefImpl(null, MutableOrEmptyList.empty(), null, null, diagnostic)
override val receiverParameter: FirReceiverParameter? override val receiverParameter: FirReceiverParameter?
get() = null get() = null
override var controlFlowGraphReference: FirControlFlowGraphReference? = null override var controlFlowGraphReference: FirControlFlowGraphReference? = null
@@ -60,7 +60,7 @@ internal class FirErrorPropertyImpl(
override val typeParameters: List<FirTypeParameterRef> override val typeParameters: List<FirTypeParameterRef>
get() = emptyList() get() = emptyList()
override var status: FirDeclarationStatus = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS override var status: FirDeclarationStatus = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS
override var returnTypeRef: FirTypeRef = FirErrorTypeRefImpl(null, null, diagnostic) override var returnTypeRef: FirTypeRef = FirErrorTypeRefImpl(null, MutableOrEmptyList.empty(), null, null, diagnostic)
override val receiverParameter: FirReceiverParameter? override val receiverParameter: FirReceiverParameter?
get() = null get() = null
override val initializer: FirExpression? override val initializer: FirExpression?
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.types.builder
import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirAnnotation
import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.ConeKotlinType
@@ -20,34 +21,22 @@ import kotlin.contracts.contract
@FirBuilderDsl @FirBuilderDsl
class FirErrorTypeRefBuilder : FirAnnotationContainerBuilder { class FirErrorTypeRefBuilder : FirAnnotationContainerBuilder {
override var source: KtSourceElement? = null override var source: KtSourceElement? = null
override var annotations: MutableList<FirAnnotation> = mutableListOf()
var type: ConeKotlinType? = null var type: ConeKotlinType? = null
var delegatedTypeRef: FirTypeRef? = null var delegatedTypeRef: FirTypeRef? = null
var partiallyResolvedTypeRef: FirTypeRef? = null var partiallyResolvedTypeRef: FirTypeRef? = null
lateinit var diagnostic: ConeDiagnostic lateinit var diagnostic: ConeDiagnostic
override fun build(): FirErrorTypeRef { override fun build(): FirErrorTypeRef {
val type = this.type return FirErrorTypeRefImpl(
return if (type != null) { source,
FirErrorTypeRefImpl( annotations.toMutableOrEmpty(),
source, this.type,
type, delegatedTypeRef,
delegatedTypeRef, diagnostic,
diagnostic, partiallyResolvedTypeRef = partiallyResolvedTypeRef,
partiallyResolvedTypeRef = partiallyResolvedTypeRef, )
)
} else {
FirErrorTypeRefImpl(
source,
delegatedTypeRef,
diagnostic,
partiallyResolvedTypeRef = partiallyResolvedTypeRef,
)
}
} }
@Deprecated("Modification of 'annotations' has no impact for FirErrorTypeRefBuilder", level = DeprecationLevel.HIDDEN)
override val annotations: MutableList<FirAnnotation> = mutableListOf()
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
@@ -66,6 +55,7 @@ inline fun buildErrorTypeRefCopy(original: FirErrorTypeRef, init: FirErrorTypeRe
val copyBuilder = FirErrorTypeRefBuilder() val copyBuilder = FirErrorTypeRefBuilder()
copyBuilder.source = original.source copyBuilder.source = original.source
copyBuilder.type = original.type copyBuilder.type = original.type
copyBuilder.annotations = original.annotations.toMutableList()
copyBuilder.delegatedTypeRef = original.delegatedTypeRef copyBuilder.delegatedTypeRef = original.delegatedTypeRef
copyBuilder.diagnostic = original.diagnostic copyBuilder.diagnostic = original.diagnostic
return copyBuilder.apply(init).build() return copyBuilder.apply(init).build()
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.types.impl
import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.fir.MutableOrEmptyList import org.jetbrains.kotlin.fir.MutableOrEmptyList
import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirAnnotation
import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.ConeErrorType
@@ -19,23 +20,13 @@ import org.jetbrains.kotlin.fir.visitors.transformInplace
internal class FirErrorTypeRefImpl( internal class FirErrorTypeRefImpl(
override val source: KtSourceElement?, override val source: KtSourceElement?,
override val type: ConeKotlinType, override var annotations: MutableOrEmptyList<FirAnnotation>,
typeOrNull: ConeKotlinType?,
override var delegatedTypeRef: FirTypeRef?, override var delegatedTypeRef: FirTypeRef?,
override val diagnostic: ConeDiagnostic, override val diagnostic: ConeDiagnostic,
override var partiallyResolvedTypeRef: FirTypeRef? = null, override var partiallyResolvedTypeRef: FirTypeRef? = null,
) : FirErrorTypeRef() { ) : FirErrorTypeRef() {
constructor( override val type: ConeKotlinType = typeOrNull ?: ConeErrorType(diagnostic)
source: KtSourceElement?, delegatedTypeRef: FirTypeRef?, diagnostic: ConeDiagnostic,
partiallyResolvedTypeRef: FirTypeRef? = null,
) : this(
source,
ConeErrorType(diagnostic),
delegatedTypeRef,
diagnostic,
partiallyResolvedTypeRef,
)
override val annotations: MutableOrEmptyList<FirAnnotation> = MutableOrEmptyList.empty()
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) { override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
annotations.forEach { it.accept(visitor, data) } annotations.forEach { it.accept(visitor, data) }
@@ -48,7 +39,7 @@ internal class FirErrorTypeRefImpl(
} }
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) { override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
throw AssertionError("Replacing annotations in FirErrorTypeRefImpl is not supported") annotations = newAnnotations.toMutableOrEmpty()
} }
override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirErrorTypeRefImpl { override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirErrorTypeRefImpl {
@@ -307,7 +307,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
"getter", "setter", "getter", "setter",
withGetter = true withGetter = true
) )
default("returnTypeRef", "FirErrorTypeRefImpl(null, null, diagnostic)") default("returnTypeRef", "FirErrorTypeRefImpl(null, MutableOrEmptyList.empty(), null, null, diagnostic)")
useTypes(errorTypeRefImplType) useTypes(errorTypeRefImplType)
} }
@@ -536,7 +536,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
impl(errorFunction) { impl(errorFunction) {
defaultNull("receiverParameter", "body", withGetter = true) defaultNull("receiverParameter", "body", withGetter = true)
default("returnTypeRef", "FirErrorTypeRefImpl(null, null, diagnostic)") default("returnTypeRef", "FirErrorTypeRefImpl(null, MutableOrEmptyList.empty(), null, null, diagnostic)")
useTypes(errorTypeRefImplType) useTypes(errorTypeRefImplType)
} }
@@ -0,0 +1,11 @@
// ISSUE: KT-62447, KT-62628
// FIR_DUMP
fun main() {
val x: <!SYNTAX, WRONG_ANNOTATION_TARGET!>@SinceKotlin("2.0")<!><!SYNTAX!><!>
}
@Target(AnnotationTarget.TYPE)
annotation class Anno
val prop: @Anno <!UNRESOLVED_REFERENCE!>Foo<!>? = null
@@ -0,0 +1,12 @@
FILE: AnnotatedErrorTypeRef.fir.kt
public final fun main(): R|kotlin/Unit| {
lval x: @R|kotlin/SinceKotlin|(version = String(2.0)) <ERROR TYPE REF: Incomplete code>
}
@R|kotlin/annotation/Target|(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|)) public final annotation class Anno : R|kotlin/Annotation| {
public constructor(): R|Anno| {
super<R|kotlin/Any|>()
}
}
public final val prop: @R|Anno|() <ERROR TYPE REF: Symbol not found for Foo?> = Null(null)
public get(): @R|Anno|() <ERROR TYPE REF: Symbol not found for Foo?>
@@ -0,0 +1,11 @@
// ISSUE: KT-62447, KT-62628
// FIR_DUMP
fun main() {
val x: <!WRONG_ANNOTATION_TARGET!>@SinceKotlin("2.0")<!><!SYNTAX!><!>
}
@Target(AnnotationTarget.TYPE)
annotation class Anno
val prop: @Anno <!UNRESOLVED_REFERENCE!>Foo<!>? = null
@@ -1554,6 +1554,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt"); runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedConstructorParams.kt");
} }
@Test
@TestMetadata("AnnotatedErrorTypeRef.kt")
public void testAnnotatedErrorTypeRef() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/AnnotatedErrorTypeRef.kt");
}
@Test @Test
@TestMetadata("annotatedExpressionInsideAnnotation.kt") @TestMetadata("annotatedExpressionInsideAnnotation.kt")
public void testAnnotatedExpressionInsideAnnotation() throws Exception { public void testAnnotatedExpressionInsideAnnotation() throws Exception {
@@ -1,3 +1,3 @@
FILE: ambigousKinds.kt FILE: ambigousKinds.kt
public final fun incorrect(block: <ERROR TYPE REF: There are multiple function kinds for functional type ref>): R|kotlin/Unit| { public final fun incorrect(block: @R|org/jetbrains/kotlin/fir/plugin/MyComposable|() <ERROR TYPE REF: There are multiple function kinds for functional type ref>): R|kotlin/Unit| {
} }