KT-41 Make functions with errors in returning statement return ERROR type and not Nothing

This commit is contained in:
svtk
2011-11-22 15:09:59 +04:00
parent 8eabc2978e
commit 8cf7618dfb
2 changed files with 14 additions and 0 deletions
@@ -188,6 +188,9 @@ public class ExpressionTypingServices {
trace.record(STATEMENT, returnedExpression, false);
if (cachedType != null) {
typeMap.put(returnedExpression, cachedType);
}
else {
typeMap.put(returnedExpression, ErrorUtils.createErrorType("Error function type"));
}
}
return typeMap;
@@ -0,0 +1,11 @@
// KT-41 Make functions with errors in returning statement return ERROR type and not Nothing
namespace kt41
fun aaa() =
6 <!UNRESOLVED_REFERENCE!>foo<!> 1
fun bbb() {
aaa()
1 // Stupid error: unreachable code
}