Measure unresolved function call & qualified access # in FIR bench
This commit is contained in:
@@ -8,6 +8,8 @@ import com.intellij.openapi.fileEditor.FileDocumentManager
|
|||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
|
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression
|
||||||
import org.jetbrains.kotlin.fir.resolve.FirProvider
|
import org.jetbrains.kotlin.fir.resolve.FirProvider
|
||||||
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
|
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
@@ -38,6 +40,8 @@ class FirResolveBench(val withProgress: Boolean) {
|
|||||||
var resolvedTypes = 0
|
var resolvedTypes = 0
|
||||||
var errorTypes = 0
|
var errorTypes = 0
|
||||||
var unresolvedTypes = 0
|
var unresolvedTypes = 0
|
||||||
|
var errorFunctionCallTypes = 0
|
||||||
|
var errorQualifiedAccessTypes = 0
|
||||||
var implicitTypes = 0
|
var implicitTypes = 0
|
||||||
var fileCount = 0
|
var fileCount = 0
|
||||||
|
|
||||||
@@ -113,6 +117,30 @@ class FirResolveBench(val withProgress: Boolean) {
|
|||||||
element.acceptChildren(this)
|
element.acceptChildren(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun visitFunctionCall(functionCall: FirFunctionCall) {
|
||||||
|
val typeRef = functionCall.typeRef
|
||||||
|
if (typeRef is FirResolvedTypeRef) {
|
||||||
|
val type = typeRef.type
|
||||||
|
if (type is ConeKotlinErrorType) {
|
||||||
|
errorFunctionCallTypes++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.visitFunctionCall(functionCall)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitQualifiedAccessExpression(qualifiedAccessExpression: FirQualifiedAccessExpression) {
|
||||||
|
val typeRef = qualifiedAccessExpression.typeRef
|
||||||
|
if (typeRef is FirResolvedTypeRef) {
|
||||||
|
val type = typeRef.type
|
||||||
|
if (type is ConeKotlinErrorType) {
|
||||||
|
errorQualifiedAccessTypes++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.visitQualifiedAccessExpression(qualifiedAccessExpression)
|
||||||
|
}
|
||||||
|
|
||||||
override fun visitTypeRef(typeRef: FirTypeRef) {
|
override fun visitTypeRef(typeRef: FirTypeRef) {
|
||||||
unresolvedTypes++
|
unresolvedTypes++
|
||||||
|
|
||||||
@@ -177,6 +205,8 @@ class FirResolveBench(val withProgress: Boolean) {
|
|||||||
val goodTypes = resolvedTypes - errorTypes - implicitTypes
|
val goodTypes = resolvedTypes - errorTypes - implicitTypes
|
||||||
stream.println("CORRECTLY RESOLVED TYPES: $goodTypes (${goodTypes percentOf resolvedTypes} of resolved)")
|
stream.println("CORRECTLY RESOLVED TYPES: $goodTypes (${goodTypes percentOf resolvedTypes} of resolved)")
|
||||||
stream.println("ERRONEOUSLY RESOLVED TYPES: $errorTypes (${errorTypes percentOf resolvedTypes} of resolved)")
|
stream.println("ERRONEOUSLY RESOLVED TYPES: $errorTypes (${errorTypes percentOf resolvedTypes} of resolved)")
|
||||||
|
stream.println(" - unresolved calls: $errorFunctionCallTypes")
|
||||||
|
stream.println(" - unresolved q.accesses: $errorQualifiedAccessTypes")
|
||||||
stream.println("ERRONEOUSLY RESOLVED IMPLICIT TYPES: $implicitTypes (${implicitTypes percentOf resolvedTypes} of resolved)")
|
stream.println("ERRONEOUSLY RESOLVED IMPLICIT TYPES: $implicitTypes (${implicitTypes percentOf resolvedTypes} of resolved)")
|
||||||
stream.println("UNIQUE ERROR TYPES: ${errorTypesReports.size}")
|
stream.println("UNIQUE ERROR TYPES: ${errorTypesReports.size}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user