FIR: don't add T <: Unit constraints that will only remove errors
^KT-55693 Fixed
This commit is contained in:
+1
-1
@@ -184,7 +184,7 @@ class FirCallCompleter(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
!expectedType.isUnitOrFlexibleUnit || !mayBeCoercionToUnitApplied -> {
|
!expectedType.isUnitOrFlexibleUnit || (!mayBeCoercionToUnitApplied && !expectedTypeMismatchIsReportedInChecker) -> {
|
||||||
system.addSubtypeConstraint(initialType, expectedType, expectedTypeConstraintPosition)
|
system.addSubtypeConstraint(initialType, expectedType, expectedTypeConstraintPosition)
|
||||||
}
|
}
|
||||||
system.notFixedTypeVariables.isEmpty() -> return
|
system.notFixedTypeVariables.isEmpty() -> return
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ fun testResultOfAnonFun2() =
|
|||||||
|
|
||||||
fun testReturnFromAnonFun() =
|
fun testReturnFromAnonFun() =
|
||||||
run(fun () {
|
run(fun () {
|
||||||
return if (true) 42 else println()
|
return <!ARGUMENT_TYPE_MISMATCH, RETURN_TYPE_MISMATCH!>if (true) 42 else println()<!>
|
||||||
})
|
})
|
||||||
|
|
||||||
fun <!IMPLICIT_NOTHING_RETURN_TYPE!>testReturn1<!>() =
|
fun <!IMPLICIT_NOTHING_RETURN_TYPE!>testReturn1<!>() =
|
||||||
|
|||||||
+1
-1
@@ -29,5 +29,5 @@ fun example() {
|
|||||||
return <!INVALID_IF_AS_EXPRESSION!>if<!> (true) true
|
return <!INVALID_IF_AS_EXPRESSION!>if<!> (true) true
|
||||||
}
|
}
|
||||||
|
|
||||||
return if (true) true else {}
|
return <!RETURN_TYPE_MISMATCH!>if (true) true else {}<!>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user