Typechecker logic fixed for one-branch ifs and 'return x' for Unit-returning functions

This commit is contained in:
Andrey Breslav
2011-04-07 14:43:25 +04:00
parent e61e908ab7
commit 30d8349272
7 changed files with 39 additions and 15 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ l5:
<END>
=====================
== nonlocals1 ==
fun nonlocals1(a : Boolean, b : Boolean) : Unit {
fun nonlocals1(a : Boolean, b : Boolean) : Any? {
if (a)
return 1
1
+1 -1
View File
@@ -1,4 +1,4 @@
fun nonlocals1(a : Boolean, b : Boolean) : Unit {
fun nonlocals1(a : Boolean, b : Boolean) : Any? {
if (a)
return 1
1
@@ -3,6 +3,8 @@
fun unitEmptyInfer() {}
fun unitEmpty() : Unit {}
fun unitEmptyReturn() : Unit {return}
fun unitIntReturn() : Unit {return <error>1</error>}
fun unitUnitReturn() : Unit {return ()}
fun unitShort() : Unit = ()
fun unitShortConv() : Unit = 1
fun unitShortNull() : Unit = null