FIR: add implementation of reified type parameter references
This adds support of T::class.java for reified type parameters
This commit is contained in:
@@ -1301,10 +1301,20 @@ class Fir2IrVisitor(
|
|||||||
|
|
||||||
override fun visitGetClassCall(getClassCall: FirGetClassCall, data: Any?): IrElement {
|
override fun visitGetClassCall(getClassCall: FirGetClassCall, data: Any?): IrElement {
|
||||||
return getClassCall.convertWithOffsets { startOffset, endOffset ->
|
return getClassCall.convertWithOffsets { startOffset, endOffset ->
|
||||||
IrGetClassImpl(
|
val argument = getClassCall.argument
|
||||||
startOffset, endOffset, getClassCall.typeRef.toIrType(session, declarationStorage),
|
val irType = getClassCall.typeRef.toIrType(session, declarationStorage)
|
||||||
getClassCall.argument.toIrExpression()
|
if (argument is FirResolvedReifiedParameterReference) {
|
||||||
)
|
IrClassReferenceImpl(
|
||||||
|
startOffset, endOffset, irType,
|
||||||
|
argument.symbol.toTypeParameterSymbol(declarationStorage),
|
||||||
|
argument.typeRef.toIrType(session, declarationStorage)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
IrGetClassImpl(
|
||||||
|
startOffset, endOffset, irType,
|
||||||
|
argument.toIrExpression()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
|||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionStub
|
import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionStub
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirResolvedQualifierImpl
|
import org.jetbrains.kotlin.fir.expressions.impl.FirResolvedQualifierImpl
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.impl.FirResolvedReifiedParameterReferenceImpl
|
||||||
import org.jetbrains.kotlin.fir.references.FirNamedReference
|
import org.jetbrains.kotlin.fir.references.FirNamedReference
|
||||||
import org.jetbrains.kotlin.fir.references.FirReference
|
import org.jetbrains.kotlin.fir.references.FirReference
|
||||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||||
@@ -202,22 +203,28 @@ class FirCallResolver(
|
|||||||
is FirNamedReferenceWithCandidate -> nameReference.candidateSymbol
|
is FirNamedReferenceWithCandidate -> nameReference.candidateSymbol
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
if (referencedSymbol is FirClassLikeSymbol<*>) {
|
when {
|
||||||
val classId = referencedSymbol.classId
|
referencedSymbol is FirClassLikeSymbol<*> -> {
|
||||||
return FirResolvedQualifierImpl(nameReference.source, classId.packageFqName, classId.relativeClassName).apply {
|
val classId = referencedSymbol.classId
|
||||||
resultType = if (classId.isLocal) {
|
return FirResolvedQualifierImpl(nameReference.source, classId.packageFqName, classId.relativeClassName).apply {
|
||||||
typeForQualifierByDeclaration(referencedSymbol.fir, resultType)
|
resultType = if (classId.isLocal) {
|
||||||
?: resultType.resolvedTypeFromPrototype(
|
typeForQualifierByDeclaration(referencedSymbol.fir, resultType)
|
||||||
session.builtinTypes.unitType.type//StandardClassIds.Unit(symbolProvider).constructType(emptyArray(), isNullable = false)
|
?: resultType.resolvedTypeFromPrototype(
|
||||||
)
|
session.builtinTypes.unitType.type//StandardClassIds.Unit(symbolProvider).constructType(emptyArray(), isNullable = false)
|
||||||
} else {
|
)
|
||||||
typeForQualifier(this)
|
} else {
|
||||||
|
typeForQualifier(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
referencedSymbol is FirTypeParameterSymbol && referencedSymbol.fir.isReified -> {
|
||||||
|
return FirResolvedReifiedParameterReferenceImpl(nameReference.source, referencedSymbol).apply {
|
||||||
if (qualifiedAccess.explicitReceiver == null) {
|
resultType = typeForReifiedParameterReference(this)
|
||||||
qualifiedResolver.reset()
|
}
|
||||||
|
}
|
||||||
|
qualifiedAccess.explicitReceiver == null -> {
|
||||||
|
qualifiedResolver.reset()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ import org.jetbrains.kotlin.fir.declarations.*
|
|||||||
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
||||||
import org.jetbrains.kotlin.fir.diagnostics.FirSimpleDiagnostic
|
import org.jetbrains.kotlin.fir.diagnostics.FirSimpleDiagnostic
|
||||||
import org.jetbrains.kotlin.fir.diagnostics.FirStubDiagnostic
|
import org.jetbrains.kotlin.fir.diagnostics.FirStubDiagnostic
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirResolvable
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionWithSmartcastImpl
|
import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionWithSmartcastImpl
|
||||||
import org.jetbrains.kotlin.fir.references.FirErrorNamedReference
|
import org.jetbrains.kotlin.fir.references.FirErrorNamedReference
|
||||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||||
@@ -336,6 +333,12 @@ fun BodyResolveComponents.typeForQualifier(resolvedQualifier: FirResolvedQualifi
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun typeForReifiedParameterReference(parameterReference: FirResolvedReifiedParameterReference): FirTypeRef {
|
||||||
|
val resultType = parameterReference.resultType
|
||||||
|
val typeParameterSymbol = parameterReference.symbol
|
||||||
|
return resultType.resolvedTypeFromPrototype(typeParameterSymbol.constructType(emptyArray(), false))
|
||||||
|
}
|
||||||
|
|
||||||
internal fun typeForQualifierByDeclaration(declaration: FirDeclaration, resultType: FirTypeRef): FirTypeRef? {
|
internal fun typeForQualifierByDeclaration(declaration: FirDeclaration, resultType: FirTypeRef): FirTypeRef? {
|
||||||
if (declaration is FirRegularClass) {
|
if (declaration is FirRegularClass) {
|
||||||
if (declaration.classKind == ClassKind.OBJECT) {
|
if (declaration.classKind == ClassKind.OBJECT) {
|
||||||
|
|||||||
+11
-3
@@ -386,7 +386,7 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
|
|||||||
val typeOfExpression = when (val lhs = transformedGetClassCall.argument) {
|
val typeOfExpression = when (val lhs = transformedGetClassCall.argument) {
|
||||||
is FirResolvedQualifier -> {
|
is FirResolvedQualifier -> {
|
||||||
val classId = lhs.classId
|
val classId = lhs.classId
|
||||||
classId?.let { classId ->
|
if (classId != null) {
|
||||||
val symbol = symbolProvider.getClassLikeSymbolByFqName(classId)
|
val symbol = symbolProvider.getClassLikeSymbolByFqName(classId)
|
||||||
// TODO: Unify logic?
|
// TODO: Unify logic?
|
||||||
symbol?.constructType(
|
symbol?.constructType(
|
||||||
@@ -395,9 +395,17 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
|
|||||||
},
|
},
|
||||||
isNullable = false
|
isNullable = false
|
||||||
)
|
)
|
||||||
} ?: lhs.resultType.coneTypeUnsafe<ConeKotlinType>()
|
} else {
|
||||||
|
null
|
||||||
|
} ?: lhs.resultType.coneTypeUnsafe()
|
||||||
|
}
|
||||||
|
is FirResolvedReifiedParameterReference -> {
|
||||||
|
val symbol = lhs.symbol
|
||||||
|
symbol.constructType(emptyArray(), isNullable = false)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
lhs.resultType.coneTypeUnsafe<ConeKotlinType>()
|
||||||
}
|
}
|
||||||
else -> lhs.resultType.coneTypeUnsafe<ConeKotlinType>()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transformedGetClassCall.resultType =
|
transformedGetClassCall.resultType =
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
inline fun <reified T : Any> foo(t: T): T {
|
inline fun <reified T : Any> foo(t: T): T {
|
||||||
val klass = <!OTHER_ERROR!>T<!>::class.<!INAPPLICABLE_CANDIDATE!>java<!>
|
val klass = T::class.java
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
FILE: classLiteralForParameter.kt
|
FILE: classLiteralForParameter.kt
|
||||||
public final inline fun <reified T : R|kotlin/Any|> foo(t: R|T|): R|T| {
|
public final inline fun <reified T : R|kotlin/Any|> foo(t: R|T|): R|T| {
|
||||||
lval klass: <ERROR TYPE REF: Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]> = <getClass>(R|?|).<Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#
|
lval klass: R|java/lang/Class<T>| = <getClass>(R|T|).R|kotlin/jvm/java|
|
||||||
^foo R|<local>/t|
|
^foo R|<local>/t|
|
||||||
}
|
}
|
||||||
|
|||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.expressions
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.fir.FirPureAbstractElement
|
||||||
|
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
|
import org.jetbrains.kotlin.fir.visitors.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file was generated automatically
|
||||||
|
* DO NOT MODIFY IT MANUALLY
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class FirResolvedReifiedParameterReference : FirPureAbstractElement(), FirExpression {
|
||||||
|
abstract override val source: FirSourceElement?
|
||||||
|
abstract override val typeRef: FirTypeRef
|
||||||
|
abstract override val annotations: List<FirAnnotationCall>
|
||||||
|
abstract val symbol: FirTypeParameterSymbol
|
||||||
|
|
||||||
|
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitResolvedReifiedParameterReference(this, data)
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.expressions.impl
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirResolvedReifiedParameterReference
|
||||||
|
import org.jetbrains.kotlin.fir.impl.FirAbstractAnnotatedElement
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
|
import org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImpl
|
||||||
|
import org.jetbrains.kotlin.fir.visitors.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file was generated automatically
|
||||||
|
* DO NOT MODIFY IT MANUALLY
|
||||||
|
*/
|
||||||
|
|
||||||
|
class FirResolvedReifiedParameterReferenceImpl(
|
||||||
|
override val source: FirSourceElement?,
|
||||||
|
override val symbol: FirTypeParameterSymbol
|
||||||
|
) : FirResolvedReifiedParameterReference(), FirAbstractAnnotatedElement {
|
||||||
|
override var typeRef: FirTypeRef = FirImplicitTypeRefImpl(null)
|
||||||
|
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
||||||
|
|
||||||
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
|
typeRef.accept(visitor, data)
|
||||||
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirResolvedReifiedParameterReferenceImpl {
|
||||||
|
typeRef = typeRef.transformSingle(transformer, data)
|
||||||
|
annotations.transformInplace(transformer, data)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun replaceTypeRef(newTypeRef: FirTypeRef) {
|
||||||
|
typeRef = newTypeRef
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -93,6 +93,7 @@ import org.jetbrains.kotlin.fir.expressions.FirLambdaArgumentExpression
|
|||||||
import org.jetbrains.kotlin.fir.expressions.FirSpreadArgumentExpression
|
import org.jetbrains.kotlin.fir.expressions.FirSpreadArgumentExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirNamedArgumentExpression
|
import org.jetbrains.kotlin.fir.expressions.FirNamedArgumentExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirResolvedReifiedParameterReference
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
|
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall
|
import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirThrowExpression
|
import org.jetbrains.kotlin.fir.expressions.FirThrowExpression
|
||||||
@@ -477,6 +478,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
|||||||
return transformElement(resolvedQualifier, data)
|
return transformElement(resolvedQualifier, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun transformResolvedReifiedParameterReference(resolvedReifiedParameterReference: FirResolvedReifiedParameterReference, data: D): CompositeTransformResult<FirStatement> {
|
||||||
|
return transformElement(resolvedReifiedParameterReference, data)
|
||||||
|
}
|
||||||
|
|
||||||
open fun transformReturnExpression(returnExpression: FirReturnExpression, data: D): CompositeTransformResult<FirStatement> {
|
open fun transformReturnExpression(returnExpression: FirReturnExpression, data: D): CompositeTransformResult<FirStatement> {
|
||||||
return transformElement(returnExpression, data)
|
return transformElement(returnExpression, data)
|
||||||
}
|
}
|
||||||
@@ -929,6 +934,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
|||||||
return transformResolvedQualifier(resolvedQualifier, data)
|
return transformResolvedQualifier(resolvedQualifier, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final override fun visitResolvedReifiedParameterReference(resolvedReifiedParameterReference: FirResolvedReifiedParameterReference, data: D): CompositeTransformResult<FirStatement> {
|
||||||
|
return transformResolvedReifiedParameterReference(resolvedReifiedParameterReference, data)
|
||||||
|
}
|
||||||
|
|
||||||
final override fun visitReturnExpression(returnExpression: FirReturnExpression, data: D): CompositeTransformResult<FirStatement> {
|
final override fun visitReturnExpression(returnExpression: FirReturnExpression, data: D): CompositeTransformResult<FirStatement> {
|
||||||
return transformReturnExpression(returnExpression, data)
|
return transformReturnExpression(returnExpression, data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ import org.jetbrains.kotlin.fir.expressions.FirLambdaArgumentExpression
|
|||||||
import org.jetbrains.kotlin.fir.expressions.FirSpreadArgumentExpression
|
import org.jetbrains.kotlin.fir.expressions.FirSpreadArgumentExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirNamedArgumentExpression
|
import org.jetbrains.kotlin.fir.expressions.FirNamedArgumentExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirResolvedReifiedParameterReference
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
|
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall
|
import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirThrowExpression
|
import org.jetbrains.kotlin.fir.expressions.FirThrowExpression
|
||||||
@@ -301,6 +302,8 @@ abstract class FirVisitor<out R, in D> {
|
|||||||
|
|
||||||
open fun visitResolvedQualifier(resolvedQualifier: FirResolvedQualifier, data: D): R = visitElement(resolvedQualifier, data)
|
open fun visitResolvedQualifier(resolvedQualifier: FirResolvedQualifier, data: D): R = visitElement(resolvedQualifier, data)
|
||||||
|
|
||||||
|
open fun visitResolvedReifiedParameterReference(resolvedReifiedParameterReference: FirResolvedReifiedParameterReference, data: D): R = visitElement(resolvedReifiedParameterReference, data)
|
||||||
|
|
||||||
open fun visitReturnExpression(returnExpression: FirReturnExpression, data: D): R = visitElement(returnExpression, data)
|
open fun visitReturnExpression(returnExpression: FirReturnExpression, data: D): R = visitElement(returnExpression, data)
|
||||||
|
|
||||||
open fun visitStringConcatenationCall(stringConcatenationCall: FirStringConcatenationCall, data: D): R = visitElement(stringConcatenationCall, data)
|
open fun visitStringConcatenationCall(stringConcatenationCall: FirStringConcatenationCall, data: D): R = visitElement(stringConcatenationCall, data)
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ import org.jetbrains.kotlin.fir.expressions.FirLambdaArgumentExpression
|
|||||||
import org.jetbrains.kotlin.fir.expressions.FirSpreadArgumentExpression
|
import org.jetbrains.kotlin.fir.expressions.FirSpreadArgumentExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirNamedArgumentExpression
|
import org.jetbrains.kotlin.fir.expressions.FirNamedArgumentExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirResolvedReifiedParameterReference
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
|
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall
|
import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirThrowExpression
|
import org.jetbrains.kotlin.fir.expressions.FirThrowExpression
|
||||||
@@ -475,6 +476,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
|
|||||||
visitElement(resolvedQualifier)
|
visitElement(resolvedQualifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun visitResolvedReifiedParameterReference(resolvedReifiedParameterReference: FirResolvedReifiedParameterReference) {
|
||||||
|
visitElement(resolvedReifiedParameterReference)
|
||||||
|
}
|
||||||
|
|
||||||
open fun visitReturnExpression(returnExpression: FirReturnExpression) {
|
open fun visitReturnExpression(returnExpression: FirReturnExpression) {
|
||||||
visitElement(returnExpression)
|
visitElement(returnExpression)
|
||||||
}
|
}
|
||||||
@@ -927,6 +932,10 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
|
|||||||
visitResolvedQualifier(resolvedQualifier)
|
visitResolvedQualifier(resolvedQualifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final override fun visitResolvedReifiedParameterReference(resolvedReifiedParameterReference: FirResolvedReifiedParameterReference, data: Nothing?) {
|
||||||
|
visitResolvedReifiedParameterReference(resolvedReifiedParameterReference)
|
||||||
|
}
|
||||||
|
|
||||||
final override fun visitReturnExpression(returnExpression: FirReturnExpression, data: Nothing?) {
|
final override fun visitReturnExpression(returnExpression: FirReturnExpression, data: Nothing?) {
|
||||||
visitReturnExpression(returnExpression)
|
visitReturnExpression(returnExpression)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -108,6 +108,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
|||||||
val namedArgumentExpression = element("NamedArgumentExpression", Expression, wrappedArgumentExpression)
|
val namedArgumentExpression = element("NamedArgumentExpression", Expression, wrappedArgumentExpression)
|
||||||
|
|
||||||
val resolvedQualifier = element("ResolvedQualifier", Expression, expression)
|
val resolvedQualifier = element("ResolvedQualifier", Expression, expression)
|
||||||
|
val resolvedReifiedParameterReference = element("ResolvedReifiedParameterReference", Expression, expression)
|
||||||
val returnExpression = element("ReturnExpression", Expression, jump)
|
val returnExpression = element("ReturnExpression", Expression, jump)
|
||||||
val stringConcatenationCall = element("StringConcatenationCall", Expression, call, expression)
|
val stringConcatenationCall = element("StringConcatenationCall", Expression, call, expression)
|
||||||
val throwExpression = element("ThrowExpression", Expression, expression)
|
val throwExpression = element("ThrowExpression", Expression, expression)
|
||||||
|
|||||||
+2
@@ -347,6 +347,8 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl(resolvedReifiedParameterReference)
|
||||||
|
|
||||||
impl(returnExpression) {
|
impl(returnExpression) {
|
||||||
lateinit("target")
|
lateinit("target")
|
||||||
default("typeRef", "FirImplicitNothingTypeRef(source)")
|
default("typeRef", "FirImplicitNothingTypeRef(source)")
|
||||||
|
|||||||
+4
@@ -430,6 +430,10 @@ object NodeConfigurator : AbstractFieldConfigurator() {
|
|||||||
+typeArguments.withTransform()
|
+typeArguments.withTransform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolvedReifiedParameterReference.configure {
|
||||||
|
+field("symbol", typeParameterSymbolType)
|
||||||
|
}
|
||||||
|
|
||||||
stringConcatenationCall.configure {
|
stringConcatenationCall.configure {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ val abstractFirBasedSymbolType = type("fir.symbols", "AbstractFirBasedSymbol")
|
|||||||
val backingFieldSymbolType = type("fir.symbols.impl", "FirBackingFieldSymbol")
|
val backingFieldSymbolType = type("fir.symbols.impl", "FirBackingFieldSymbol")
|
||||||
val delegateFieldSymbolType = type("fir.symbols.impl", "FirDelegateFieldSymbol")
|
val delegateFieldSymbolType = type("fir.symbols.impl", "FirDelegateFieldSymbol")
|
||||||
val classSymbolType = type("fir.symbols.impl", "FirClassSymbol")
|
val classSymbolType = type("fir.symbols.impl", "FirClassSymbol")
|
||||||
|
val typeParameterSymbolType = type("fir.symbols.impl", "FirTypeParameterSymbol")
|
||||||
|
|
||||||
val pureAbstractElementType = generatedType("FirPureAbstractElement")
|
val pureAbstractElementType = generatedType("FirPureAbstractElement")
|
||||||
val effectDeclarationType = type("fir.contracts.description", "ConeEffectDeclaration")
|
val effectDeclarationType = type("fir.contracts.description", "ConeEffectDeclaration")
|
||||||
|
|||||||
+2
-2
@@ -36,10 +36,10 @@ fun test8() {}
|
|||||||
|
|
||||||
inline val <reified T> T.test9
|
inline val <reified T> T.test9
|
||||||
get() = @AnnArray(arrayOf(
|
get() = @AnnArray(arrayOf(
|
||||||
<!OTHER_ERROR!>T<!>::class,
|
T::class,
|
||||||
Array<T>::class,
|
Array<T>::class,
|
||||||
Array<Array<Array<T>>>::class
|
Array<Array<Array<T>>>::class
|
||||||
)) object {}
|
)) object {}
|
||||||
|
|
||||||
inline val <reified T> T.test10
|
inline val <reified T> T.test10
|
||||||
get() = @AnnArray([<!OTHER_ERROR!>T<!>::class]) object {}
|
get() = @AnnArray([T::class]) object {}
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ annotation class Ann(vararg val k: KClass<*>)
|
|||||||
|
|
||||||
inline val <reified T> T.test
|
inline val <reified T> T.test
|
||||||
get() = @Ann(
|
get() = @Ann(
|
||||||
<!OTHER_ERROR!>T<!>::class,
|
T::class,
|
||||||
Array<T>::class,
|
Array<T>::class,
|
||||||
Array<Array<Array<T>>>::class
|
Array<Array<Array<T>>>::class
|
||||||
) object {}
|
) object {}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ fun <T : Any> foo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline fun <reified T : Any> bar() {
|
inline fun <reified T : Any> bar() {
|
||||||
val t3 = <!OTHER_ERROR!>T<!>?::class
|
val t3 = T?::class
|
||||||
}
|
}
|
||||||
|
|
||||||
val m = Map<String>::class
|
val m = Map<String>::class
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ public class A {
|
|||||||
// types checked by txt file
|
// types checked by txt file
|
||||||
|
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
inline fun <reified X> test1() = <!OTHER_ERROR!>X<!>::class.<!INAPPLICABLE_CANDIDATE!>java<!>
|
inline fun <reified X> test1() = X::class.java
|
||||||
inline fun <reified X : Any> test2() = <!OTHER_ERROR!>X<!>::class.<!INAPPLICABLE_CANDIDATE!>java<!>
|
inline fun <reified X : Any> test2() = X::class.java
|
||||||
inline fun <reified X : Any?> test3() = <!OTHER_ERROR!>X<!>::class.<!INAPPLICABLE_CANDIDATE!>java<!>
|
inline fun <reified X : Any?> test3() = X::class.java
|
||||||
inline fun <reified X : Number> test4() = <!OTHER_ERROR!>X<!>::class.<!INAPPLICABLE_CANDIDATE!>java<!>
|
inline fun <reified X : Number> test4() = X::class.java
|
||||||
inline fun <reified X : Number?> test5() = <!OTHER_ERROR!>X<!>::class.<!INAPPLICABLE_CANDIDATE!>java<!>
|
inline fun <reified X : Number?> test5() = X::class.java
|
||||||
|
|
||||||
fun test6() = A.getA()::class.java
|
fun test6() = A.getA()::class.java
|
||||||
fun test7() = A.getKClass().java
|
fun test7() = A.getKClass().java
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
inline fun<reified T> foo(block: () -> T): String = block().toString()
|
inline fun<reified T> foo(block: () -> T): String = block().toString()
|
||||||
|
|
||||||
inline fun <reified T: Any> javaClass(): Class<T> = <!OTHER_ERROR!>T<!>::class.<!INAPPLICABLE_CANDIDATE!>java<!>
|
inline fun <reified T: Any> javaClass(): Class<T> = T::class.java
|
||||||
|
|
||||||
fun box() {
|
fun box() {
|
||||||
val a = arrayOf(null!!)
|
val a = arrayOf(null!!)
|
||||||
|
|||||||
+3
-3
@@ -55,7 +55,7 @@ FILE fqName:<root> fileName:/classLiteralInAnnotation.kt
|
|||||||
BLOCK type=<root>.test2.<no name provided> origin=OBJECT_LITERAL
|
BLOCK type=<root>.test2.<no name provided> origin=OBJECT_LITERAL
|
||||||
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
||||||
annotations:
|
annotations:
|
||||||
A(klass = GET_CLASS type=kotlin.reflect.KClass<IrErrorType>)
|
A(klass = CLASS_REFERENCE 'TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]' type=kotlin.reflect.KClass<T of <root>.test2>)
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.test2.<no name provided>
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.test2.<no name provided>
|
||||||
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
@@ -70,7 +70,7 @@ FILE fqName:<root> fileName:/classLiteralInAnnotation.kt
|
|||||||
BLOCK type=<root>.<get-test3>.<no name provided> origin=OBJECT_LITERAL
|
BLOCK type=<root>.<get-test3>.<no name provided> origin=OBJECT_LITERAL
|
||||||
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
||||||
annotations:
|
annotations:
|
||||||
A(klass = GET_CLASS type=kotlin.reflect.KClass<IrErrorType>)
|
A(klass = CLASS_REFERENCE 'TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]' type=kotlin.reflect.KClass<T of <uninitialized parent>>)
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.<get-test3>.<no name provided>
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.<get-test3>.<no name provided>
|
||||||
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
@@ -84,7 +84,7 @@ FILE fqName:<root> fileName:/classLiteralInAnnotation.kt
|
|||||||
BLOCK type=<root>.<set-test3>.<no name provided> origin=OBJECT_LITERAL
|
BLOCK type=<root>.<set-test3>.<no name provided> origin=OBJECT_LITERAL
|
||||||
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
CLASS OBJECT name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]
|
||||||
annotations:
|
annotations:
|
||||||
A(klass = GET_CLASS type=kotlin.reflect.KClass<IrErrorType>)
|
A(klass = CLASS_REFERENCE 'TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]' type=kotlin.reflect.KClass<T of <uninitialized parent>>)
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.<set-test3>.<no name provided>
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.<set-test3>.<no name provided>
|
||||||
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
CONSTRUCTOR visibility:private <> () returnType:kotlin.Any [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
|
|||||||
+18
-24
@@ -1,53 +1,47 @@
|
|||||||
FILE fqName:<root> fileName:/typeParameterClassLiteral.kt
|
FILE fqName:<root> fileName:/typeParameterClassLiteral.kt
|
||||||
FUN name:classRefFun visibility:public modality:FINAL <T> () returnType:kotlin.reflect.KClass<IrErrorType> [inline]
|
FUN name:classRefFun visibility:public modality:FINAL <T> () returnType:kotlin.reflect.KClass<T of <root>.classRefFun> [inline]
|
||||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]
|
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun classRefFun <T> (): kotlin.reflect.KClass<IrErrorType> [inline] declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun classRefFun <T> (): kotlin.reflect.KClass<T of <root>.classRefFun> [inline] declared in <root>'
|
||||||
GET_CLASS type=kotlin.reflect.KClass<IrErrorType>
|
CLASS_REFERENCE 'TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<T of <root>.classRefFun>
|
||||||
ERROR_CALL 'Unresolved reference: R|?|' type=IrErrorType
|
FUN name:classRefExtFun visibility:public modality:FINAL <T> ($receiver:kotlin.Any) returnType:kotlin.reflect.KClass<T of <root>.classRefExtFun> [inline]
|
||||||
FUN name:classRefExtFun visibility:public modality:FINAL <T> ($receiver:kotlin.Any) returnType:kotlin.reflect.KClass<IrErrorType> [inline]
|
|
||||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]
|
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]
|
||||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun classRefExtFun <T> (): kotlin.reflect.KClass<IrErrorType> [inline] declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun classRefExtFun <T> (): kotlin.reflect.KClass<T of <root>.classRefExtFun> [inline] declared in <root>'
|
||||||
GET_CLASS type=kotlin.reflect.KClass<IrErrorType>
|
CLASS_REFERENCE 'TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<T of <root>.classRefExtFun>
|
||||||
ERROR_CALL 'Unresolved reference: R|?|' type=IrErrorType
|
|
||||||
PROPERTY name:classRefExtVal visibility:public modality:FINAL [val]
|
PROPERTY name:classRefExtVal visibility:public modality:FINAL [val]
|
||||||
FUN name:<get-classRefExtVal> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KClass<IrErrorType>
|
FUN name:<get-classRefExtVal> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KClass<T of <uninitialized parent>>
|
||||||
correspondingProperty: PROPERTY name:classRefExtVal visibility:public modality:FINAL [val]
|
correspondingProperty: PROPERTY name:classRefExtVal visibility:public modality:FINAL [val]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-classRefExtVal> (): kotlin.reflect.KClass<IrErrorType> declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun <get-classRefExtVal> (): kotlin.reflect.KClass<T of <uninitialized parent>> declared in <root>'
|
||||||
GET_CLASS type=kotlin.reflect.KClass<IrErrorType>
|
CLASS_REFERENCE 'TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<T of <uninitialized parent>>
|
||||||
ERROR_CALL 'Unresolved reference: R|?|' type=IrErrorType
|
|
||||||
CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]
|
CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Host
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Host
|
||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Host [primary]
|
CONSTRUCTOR visibility:public <> () returnType:<root>.Host [primary]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||||
FUN name:classRefGenericMemberFun visibility:public modality:FINAL <TF> ($this:<root>.Host) returnType:kotlin.reflect.KClass<IrErrorType> [inline]
|
FUN name:classRefGenericMemberFun visibility:public modality:FINAL <TF> ($this:<root>.Host) returnType:kotlin.reflect.KClass<TF of <root>.Host.classRefGenericMemberFun> [inline]
|
||||||
TYPE_PARAMETER name:TF index:0 variance: superTypes:[kotlin.Any]
|
TYPE_PARAMETER name:TF index:0 variance: superTypes:[kotlin.Any]
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host
|
$this: VALUE_PARAMETER name:<this> type:<root>.Host
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun classRefGenericMemberFun <TF> (): kotlin.reflect.KClass<IrErrorType> [inline] declared in <root>.Host'
|
RETURN type=kotlin.Nothing from='public final fun classRefGenericMemberFun <TF> (): kotlin.reflect.KClass<TF of <root>.Host.classRefGenericMemberFun> [inline] declared in <root>.Host'
|
||||||
GET_CLASS type=kotlin.reflect.KClass<IrErrorType>
|
CLASS_REFERENCE 'TYPE_PARAMETER name:TF index:0 variance: superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<TF of <root>.Host.classRefGenericMemberFun>
|
||||||
ERROR_CALL 'Unresolved reference: R|?|' type=IrErrorType
|
FUN name:classRefGenericMemberExtFun visibility:public modality:FINAL <TF> ($this:<root>.Host, $receiver:kotlin.Any) returnType:kotlin.reflect.KClass<TF of <root>.Host.classRefGenericMemberExtFun> [inline]
|
||||||
FUN name:classRefGenericMemberExtFun visibility:public modality:FINAL <TF> ($this:<root>.Host, $receiver:kotlin.Any) returnType:kotlin.reflect.KClass<IrErrorType> [inline]
|
|
||||||
TYPE_PARAMETER name:TF index:0 variance: superTypes:[kotlin.Any]
|
TYPE_PARAMETER name:TF index:0 variance: superTypes:[kotlin.Any]
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host
|
$this: VALUE_PARAMETER name:<this> type:<root>.Host
|
||||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun classRefGenericMemberExtFun <TF> (): kotlin.reflect.KClass<IrErrorType> [inline] declared in <root>.Host'
|
RETURN type=kotlin.Nothing from='public final fun classRefGenericMemberExtFun <TF> (): kotlin.reflect.KClass<TF of <root>.Host.classRefGenericMemberExtFun> [inline] declared in <root>.Host'
|
||||||
GET_CLASS type=kotlin.reflect.KClass<IrErrorType>
|
CLASS_REFERENCE 'TYPE_PARAMETER name:TF index:0 variance: superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<TF of <root>.Host.classRefGenericMemberExtFun>
|
||||||
ERROR_CALL 'Unresolved reference: R|?|' type=IrErrorType
|
|
||||||
PROPERTY name:classRefGenericMemberExtVal visibility:public modality:FINAL [val]
|
PROPERTY name:classRefGenericMemberExtVal visibility:public modality:FINAL [val]
|
||||||
FUN name:<get-classRefGenericMemberExtVal> visibility:public modality:FINAL <> ($this:<root>.Host) returnType:kotlin.reflect.KClass<IrErrorType>
|
FUN name:<get-classRefGenericMemberExtVal> visibility:public modality:FINAL <> ($this:<root>.Host) returnType:kotlin.reflect.KClass<TV of <uninitialized parent>>
|
||||||
correspondingProperty: PROPERTY name:classRefGenericMemberExtVal visibility:public modality:FINAL [val]
|
correspondingProperty: PROPERTY name:classRefGenericMemberExtVal visibility:public modality:FINAL [val]
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host
|
$this: VALUE_PARAMETER name:<this> type:<root>.Host
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-classRefGenericMemberExtVal> (): kotlin.reflect.KClass<IrErrorType> declared in <root>.Host'
|
RETURN type=kotlin.Nothing from='public final fun <get-classRefGenericMemberExtVal> (): kotlin.reflect.KClass<TV of <uninitialized parent>> declared in <root>.Host'
|
||||||
GET_CLASS type=kotlin.reflect.KClass<IrErrorType>
|
CLASS_REFERENCE 'TYPE_PARAMETER name:TV index:0 variance: superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<TV of <uninitialized parent>>
|
||||||
ERROR_CALL 'Unresolved reference: R|?|' type=IrErrorType
|
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
overridden:
|
overridden:
|
||||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||||
|
|||||||
Reference in New Issue
Block a user