FIR: use more specific cone error for unresolved user type ref
replaces diagnostic with <No name> with specific qualifier
This commit is contained in:
+2
-2
@@ -22,8 +22,8 @@ FILE: upperBoundViolated.kt
|
||||
lval b1: R|B<kotlin/Int>| = R|/B.B|<R|kotlin/Int|>()
|
||||
lval b2: R|B<C>| = R|/B.B|<R|C|>()
|
||||
lval b3: R|B<kotlin/Any?>| = R|/B.B|<R|kotlin/Any?|>()
|
||||
lval b4: R|B<A>| = R|/B.B|<<ERROR TYPE REF: Symbol not found, for `UnexistingType`>>()
|
||||
lval b5: R|B<B<ERROR CLASS: Symbol not found, for `UnexistingType`>>| = R|/B.B|<R|B<ERROR CLASS: Symbol not found, for `UnexistingType`>|>()
|
||||
lval b4: R|B<A>| = R|/B.B|<<ERROR TYPE REF: Symbol not found for UnexistingType>>()
|
||||
lval b5: R|B<B<ERROR CLASS: Symbol not found for UnexistingType>>| = R|/B.B|<R|B<ERROR CLASS: Symbol not found for UnexistingType>|>()
|
||||
R|/fest|<R|kotlin/Boolean|>()
|
||||
R|/fest|<R|C|>()
|
||||
R|/fest|<R|C|>()
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
FILE: fakeRecursiveTypealias.kt
|
||||
public final typealias My = <ERROR TYPE REF: Symbol not found, for `incorrect.directory.My`>
|
||||
public final typealias My = <ERROR TYPE REF: Symbol not found for incorrect.directory.My>
|
||||
public final typealias Your = <ERROR TYPE REF: Loop in supertype: /Your -> /Your>
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ FILE: main.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract fun createTest(): <ERROR TYPE REF: Symbol not found, for `Test`>
|
||||
public abstract fun createTest(): <ERROR TYPE REF: Symbol not found for Test>
|
||||
|
||||
public abstract fun createObj(): R|test/Test.O|
|
||||
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ FILE: exposedSupertype.kt
|
||||
}
|
||||
|
||||
}
|
||||
public final class Test7 : <ERROR TYPE REF: Symbol not found, for `D.PublicButProtected`> {
|
||||
public final class Test7 : <ERROR TYPE REF: Symbol not found for D.PublicButProtected> {
|
||||
public constructor(): R|Test7| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ FILE: K1.kt
|
||||
super<R|J1|>()
|
||||
}
|
||||
|
||||
public final class Q : <ERROR TYPE REF: Symbol not found, for `Nested`> {
|
||||
public final class Q : <ERROR TYPE REF: Symbol not found for Nested> {
|
||||
public constructor(): R|K2.Q| {
|
||||
super<<ERROR TYPE REF: Symbol not found, for `Nested`>>()
|
||||
super<<ERROR TYPE REF: Symbol not found for Nested>>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,6 +27,7 @@ private fun ConeDiagnostic.toFirDiagnostic(source: FirSourceElement): FirDiagnos
|
||||
is ConeUnresolvedReferenceError -> FirErrors.UNRESOLVED_REFERENCE.on(source, this.name?.asString() ?: "<No name>")
|
||||
is ConeUnresolvedSymbolError -> FirErrors.UNRESOLVED_REFERENCE.on(source, this.classId.asString())
|
||||
is ConeUnresolvedNameError -> FirErrors.UNRESOLVED_REFERENCE.on(source, this.name.asString())
|
||||
is ConeUnresolvedQualifierError -> FirErrors.UNRESOLVED_REFERENCE.on(source, this.qualifier)
|
||||
is ConeHiddenCandidateError -> FirErrors.HIDDEN.on(source, this.candidateSymbol)
|
||||
is ConeAmbiguityError -> if (!this.applicability.isSuccess) {
|
||||
FirErrors.NONE_APPLICABLE.on(source, this.candidates)
|
||||
@@ -42,7 +43,6 @@ private fun ConeDiagnostic.toFirDiagnostic(source: FirSourceElement): FirDiagnos
|
||||
FirErrors.WRONG_NUMBER_OF_TYPE_ARGUMENTS.on(source, this.desiredCount, this.type)
|
||||
is ConeSimpleDiagnostic -> when {
|
||||
source.kind is FirFakeSourceElementKind -> null
|
||||
this.kind == DiagnosticKind.SymbolNotFound -> FirErrors.UNRESOLVED_REFERENCE.on(source, "<No name>")
|
||||
else -> this.getFactory().on(source)
|
||||
}
|
||||
is ConeInstanceAccessBeforeSuperCall -> FirErrors.INSTANCE_ACCESS_BEFORE_SUPER_CALL.on(source, this.target)
|
||||
|
||||
+4
@@ -26,6 +26,10 @@ class ConeUnresolvedSymbolError(val classId: ClassId) : ConeDiagnostic() {
|
||||
override val reason: String get() = "Symbol not found for $classId"
|
||||
}
|
||||
|
||||
class ConeUnresolvedQualifierError(val qualifier: String) : ConeDiagnostic() {
|
||||
override val reason: String get() = "Symbol not found for ${qualifier}"
|
||||
}
|
||||
|
||||
class ConeUnresolvedNameError(val name: Name) : ConeDiagnostic() {
|
||||
override val reason: String get() = "Unresolved name: $name"
|
||||
}
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.diagnostics.ConeUnexpectedTypeArgumentsError
|
||||
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.resolve.*
|
||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedQualifierError
|
||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeWrongNumberOfTypeArgumentsError
|
||||
import org.jetbrains.kotlin.fir.resolve.getSymbolByLookupTag
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
@@ -98,7 +99,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() {
|
||||
areBareTypesAllowed: Boolean
|
||||
): ConeKotlinType {
|
||||
if (symbol == null) {
|
||||
return ConeKotlinErrorType(ConeSimpleDiagnostic("Symbol not found, for `${typeRef.render()}`", DiagnosticKind.SymbolNotFound))
|
||||
return ConeKotlinErrorType(ConeUnresolvedQualifierError(typeRef.render()))
|
||||
}
|
||||
if (symbol is FirTypeParameterSymbol) {
|
||||
for (part in typeRef.qualifier) {
|
||||
|
||||
@@ -29,7 +29,6 @@ enum class DiagnosticKind {
|
||||
SuperNotAllowed,
|
||||
ValueParameterWithNoTypeAnnotation,
|
||||
UnknownCallableKind,
|
||||
SymbolNotFound,
|
||||
IllegalProjectionUsage,
|
||||
MissingStdlibClass,
|
||||
Other
|
||||
|
||||
Vendored
+4
-4
@@ -4,13 +4,13 @@ FILE: class.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final [BODY_RESOLVE] fun q(): <ERROR TYPE REF: Symbol not found, for `C`> {
|
||||
public final [BODY_RESOLVE] fun q(): <ERROR TYPE REF: Symbol not found for C> {
|
||||
}
|
||||
|
||||
private final [BODY_RESOLVE] val y: R|ERROR CLASS: Symbol not found, for `C`| = this@R|/B|.R|/B.q|()
|
||||
[BODY_RESOLVE] private get(): R|ERROR CLASS: Symbol not found, for `C`|
|
||||
private final [BODY_RESOLVE] val y: R|ERROR CLASS: Symbol not found for C| = this@R|/B|.R|/B.q|()
|
||||
[BODY_RESOLVE] private get(): R|ERROR CLASS: Symbol not found for C|
|
||||
|
||||
public final [BODY_RESOLVE] fun foo([BODY_RESOLVE] a: <ERROR TYPE REF: Symbol not found, for `A`>): <ERROR TYPE REF: Unresolved name: with> {
|
||||
public final [BODY_RESOLVE] fun foo([BODY_RESOLVE] a: <ERROR TYPE REF: Symbol not found for A>): <ERROR TYPE REF: Unresolved name: with> {
|
||||
^foo <Unresolved name: with>#(R|<local>/a|, <L> = [BODY_RESOLVE] with@fun <anonymous>(): R|ERROR CLASS: Unresolved name: bar| {
|
||||
^ <Unresolved name: bar>#(String(a), this@R|/B|.R|/B.y|)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user