[Nice-commit] Nice/src/bossa/syntax typecheck.nice,1.85,1.86
Brought to you by:
bonniot
From: <ar...@us...> - 2003-11-21 00:43:08
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv9545/F:/nice/src/bossa/syntax Modified Files: typecheck.nice Log Message: testcase and fix for some case of type checking in anonymous functions. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** typecheck.nice 20 Nov 2003 20:50:30 -0000 1.85 --- typecheck.nice 21 Nov 2003 00:43:05 -0000 1.86 *************** *** 96,107 **** } - boolean hasConditionalType(MonoSymbol v) - { - return conditionalTypes.has((MonoSymbol, mlsub.typing.Monotype) couple =>{ - (MonoSymbol other, mlsub.typing.Monotype t) = couple; - return v == other; - }); - } - void typecheckExps(?Expression[] exps) { --- 96,99 ---- *************** *** 391,396 **** Collects knowledge about more precise type in branches of conditionals. ! At the moments only tests agains null are considered. ! Later, instanceof tests will also be taken into account. */ --- 383,387 ---- Collects knowledge about more precise type in branches of conditionals. ! At the moments tests agains null and instanceof tests are considered. */ *************** *** 463,466 **** --- 454,458 ---- Set<MonoSymbol> done = new HashSet(); List<(MonoSymbol, mlsub.typing.Monotype)> replaced = new ArrayList(); + //set all for all variables the original type back and store it for (int i = 0; i < levels.size(); i++) { *************** *** 483,490 **** { List<(MonoSymbol, mlsub.typing.Monotype)> replaced = replacedTypes.pop(); for (int i = 0; i < replaced.size(); i++) { (MonoSymbol variable, mlsub.typing.Monotype type) = replaced.get(i); ! variable.type = type; } --- 475,484 ---- { List<(MonoSymbol, mlsub.typing.Monotype)> replaced = replacedTypes.pop(); + //set back the stored conditional types for (int i = 0; i < replaced.size(); i++) { (MonoSymbol variable, mlsub.typing.Monotype type) = replaced.get(i); ! if (!variable.captured) ! variable.type = type; } *************** *** 497,500 **** --- 491,495 ---- { variable.captured = true; + //set all conditional types back to the original type let origType = getOriginalType(variable) || variable.type; variable.type = origType; |