Raw FIR builder: fix situation with explicit type of for parameter
Before this commit we omitted for parameter type, even if it was stated explicitly. This also fixes PSI consistency test
This commit is contained in:
+2
-1
@@ -776,7 +776,8 @@ class ExpressionsConverter(
|
||||
FirFunctionCallImpl(null).apply {
|
||||
calleeReference = FirSimpleNamedReference(null, Name.identifier("next"), null)
|
||||
explicitReceiver = generateResolvedAccessExpression(null, iteratorVal)
|
||||
}
|
||||
},
|
||||
parameter!!.firValueParameter.returnTypeRef
|
||||
)
|
||||
if (multiDeclaration != null) {
|
||||
val destructuringBlock = generateDestructuringBlock(
|
||||
|
||||
@@ -291,12 +291,12 @@ internal fun generateDestructuringBlock(
|
||||
}
|
||||
|
||||
fun generateTemporaryVariable(
|
||||
session: FirSession, source: FirSourceElement?, name: Name, initializer: FirExpression
|
||||
session: FirSession, source: FirSourceElement?, name: Name, initializer: FirExpression, typeRef: FirTypeRef? = null
|
||||
): FirVariable<*> =
|
||||
FirPropertyImpl(
|
||||
source,
|
||||
session,
|
||||
FirImplicitTypeRefImpl(source),
|
||||
typeRef ?: FirImplicitTypeRefImpl(source),
|
||||
null,
|
||||
name,
|
||||
initializer,
|
||||
|
||||
@@ -1189,7 +1189,8 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
||||
FirFunctionCallImpl(loopSource).apply {
|
||||
calleeReference = FirSimpleNamedReference(loopSource, Name.identifier("next"), null)
|
||||
explicitReceiver = generateResolvedAccessExpression(loopSource, iteratorVal)
|
||||
}
|
||||
},
|
||||
parameter.typeReference.toFirOrImplicitType()
|
||||
)
|
||||
if (multiDeclaration != null) {
|
||||
val destructuringBlock = generateDestructuringBlock(
|
||||
|
||||
@@ -18,3 +18,9 @@ fun baz(set: Set<Some>) {
|
||||
println("x = $x y = $y")
|
||||
}
|
||||
}
|
||||
|
||||
fun withParameter(list: List<Some>) {
|
||||
for (s: Some in list) {
|
||||
println(s)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,3 +58,12 @@ FILE: for.kt
|
||||
}
|
||||
|
||||
}
|
||||
public? final? fun withParameter(list: List<Some>): R|kotlin/Unit| {
|
||||
lval <range>: <implicit> = list#
|
||||
lval <iterator>: <implicit> = R|<local>/<range>|.iterator#()
|
||||
while(R|<local>/<iterator>|.hasNext#()) {
|
||||
lval s: Some = R|<local>/<iterator>|.next#()
|
||||
println#(s#)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -267,7 +267,7 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
println("Not traversed ${element.javaClass}: ${element.text}")
|
||||
val traversedParent = element.parents.firstOrNull { it in psiSetViaFir }
|
||||
if (traversedParent != null) {
|
||||
println("(traversed parent: ${traversedParent.javaClass})")
|
||||
println("(traversed parent: ${traversedParent.javaClass} ${traversedParent.text})")
|
||||
}
|
||||
}
|
||||
println(firFile.render())
|
||||
|
||||
Reference in New Issue
Block a user