[FIR] Add ConeUnsupportedDynamicType
This commit is contained in:
committed by
teamcityserver
parent
0ec693db89
commit
e8a790993b
+1
@@ -84,6 +84,7 @@ private fun ConeDiagnostic.toFirDiagnostic(
|
||||
is ConeTypeParameterInQualifiedAccess -> null // reported in various checkers instead
|
||||
is ConeNotAnnotationContainer -> null
|
||||
is ConeImportFromSingleton -> FirErrors.CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON.createOn(source, this.name)
|
||||
is ConeUnsupportedDynamicType -> FirErrors.UNSUPPORTED.createOn(source, this.reason)
|
||||
else -> throw IllegalArgumentException("Unsupported diagnostic type: ${this.javaClass}")
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -133,6 +133,10 @@ class ConeImportFromSingleton(val name: Name) : ConeDiagnostic() {
|
||||
override val reason: String get() = "Import from singleton $name is not allowed"
|
||||
}
|
||||
|
||||
class ConeUnsupportedDynamicType() : ConeDiagnostic() {
|
||||
override val reason: String get() = "Dynamic types are not supported in this context"
|
||||
}
|
||||
|
||||
private fun describeSymbol(symbol: AbstractFirBasedSymbol<*>): String {
|
||||
return when (symbol) {
|
||||
is FirClassLikeSymbol<*> -> symbol.classId.asString()
|
||||
|
||||
+2
-4
@@ -8,13 +8,11 @@ package org.jetbrains.kotlin.fir.resolve.providers.impl
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.ThreadSafeMutableState
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
|
||||
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.ConeUnsupportedDynamicType
|
||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeWrongNumberOfTypeArgumentsError
|
||||
import org.jetbrains.kotlin.fir.resolve.getSymbolByLookupTag
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
@@ -186,7 +184,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() {
|
||||
resolveUserType(typeRef, symbol, substitutor, areBareTypesAllowed)
|
||||
}
|
||||
is FirFunctionTypeRef -> createFunctionalType(typeRef)
|
||||
is FirDynamicTypeRef -> ConeKotlinErrorType(ConeIntermediateDiagnostic("Not supported: ${typeRef::class.simpleName}"))
|
||||
is FirDynamicTypeRef -> ConeKotlinErrorType(ConeUnsupportedDynamicType())
|
||||
else -> error(typeRef.render())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
interface Tr {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
class C(d: dynamic) : Tr by d
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface Tr {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
val foo: dynamic = 1
|
||||
|
||||
fun foo() {
|
||||
class C {
|
||||
val foo: dynamic = 1
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
val foo: <!UNSUPPORTED!>dynamic<!> = 1
|
||||
|
||||
fun foo() {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class J {
|
||||
import p.*
|
||||
|
||||
class K: J.C() {
|
||||
fun dynamic.test() {
|
||||
fun <!UNSUPPORTED!>dynamic<!>.test() {
|
||||
<!INVISIBLE_REFERENCE!>sam<!>(null)
|
||||
<!INVISIBLE_REFERENCE!>sam<!>(
|
||||
name = null,
|
||||
|
||||
Reference in New Issue
Block a user