[FIR] KT-58674: Set expected type for loop conditions
^KT-58674 Fixed
This commit is contained in:
committed by
Space Team
parent
737c8c20f6
commit
fd54706e1a
+2
-2
@@ -217,7 +217,7 @@ FILE: forLoopChecker.kt
|
||||
|
||||
{
|
||||
lval <iterator>: R|ImproperIterator3| = R|<local>/notRange5|.R|/NotRange5.iterator|()
|
||||
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) {
|
||||
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext<CS errors: /ImproperIterator3.hasNext>#|()) {
|
||||
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|()
|
||||
{
|
||||
}
|
||||
@@ -239,7 +239,7 @@ FILE: forLoopChecker.kt
|
||||
|
||||
{
|
||||
lval <iterator>: R|ImproperIterator3| = R|<local>/notRange7|.R|/NotRange7.iterator|()
|
||||
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext|()) {
|
||||
while(R|<local>/<iterator>|.R|/ImproperIterator3.hasNext<CS errors: /ImproperIterator3.hasNext>#|()) {
|
||||
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|/ImproperIterator3.next|()
|
||||
{
|
||||
}
|
||||
|
||||
+4
-2
@@ -30,7 +30,8 @@ class FirControlFlowStatementsResolveTransformer(transformer: FirAbstractBodyRes
|
||||
override fun transformWhileLoop(whileLoop: FirWhileLoop, data: ResolutionMode): FirStatement {
|
||||
val context = ResolutionMode.ContextIndependent
|
||||
return whileLoop.also(dataFlowAnalyzer::enterWhileLoop)
|
||||
.transformCondition(transformer, context).also(dataFlowAnalyzer::exitWhileLoopCondition)
|
||||
.transformCondition(transformer, withExpectedType(session.builtinTypes.booleanType))
|
||||
.also(dataFlowAnalyzer::exitWhileLoopCondition)
|
||||
.transformBlock(transformer, context).also(dataFlowAnalyzer::exitWhileLoop)
|
||||
.transformOtherChildren(transformer, context)
|
||||
}
|
||||
@@ -43,7 +44,8 @@ class FirControlFlowStatementsResolveTransformer(transformer: FirAbstractBodyRes
|
||||
.also {
|
||||
transformer.expressionsTransformer.transformBlockInCurrentScope(it.block, context)
|
||||
}
|
||||
.also(dataFlowAnalyzer::enterDoWhileLoopCondition).transformCondition(transformer, context)
|
||||
.also(dataFlowAnalyzer::enterDoWhileLoopCondition)
|
||||
.transformCondition(transformer, withExpectedType(session.builtinTypes.booleanType))
|
||||
.also(dataFlowAnalyzer::exitDoWhileLoop)
|
||||
.transformOtherChildren(transformer, context)
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// INFERENCE_HELPERS
|
||||
|
||||
fun test() {
|
||||
while (<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>()) { // K1: OK, K2: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
|
||||
while (materialize()) {
|
||||
|
||||
}
|
||||
|
||||
do {
|
||||
|
||||
} while (<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>()) // K1: OK, K2: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
|
||||
} while (materialize())
|
||||
|
||||
if (materialize()) {
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// INFERENCE_HELPERS
|
||||
|
||||
fun test() {
|
||||
while (materialize()) { // K1: OK, K2: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
|
||||
while (materialize()) {
|
||||
|
||||
}
|
||||
|
||||
do {
|
||||
|
||||
} while (materialize()) // K1: OK, K2: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
|
||||
} while (materialize())
|
||||
|
||||
if (materialize()) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user