[Nice-commit] Nice/src/bossa/syntax CallExp.java,1.92,1.93
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-03-23 20:39:13
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24136/src/bossa/syntax Modified Files: CallExp.java Log Message: When doing overloading resolution in existential mode, backtrack when the symbol is not applicable. Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** CallExp.java 26 Feb 2004 22:17:39 -0000 1.92 --- CallExp.java 23 Mar 2004 20:28:43 -0000 1.93 *************** *** 107,111 **** { try{ ! Polytype t = getType(funt, parameters); return t; } --- 107,111 ---- { try{ ! Polytype t = getType(funt, parameters, true); return t; } *************** *** 124,128 **** try{ ! return getType(function.getType(), paramTypes); } catch(BadSizeEx e){ --- 124,128 ---- try{ ! return getType(function.getType(), paramTypes, false); } catch(BadSizeEx e){ *************** *** 167,172 **** } ! private static Polytype getType(Polytype type, ! Polytype[] parameters) throws TypingEx, BadSizeEx, ReportErrorEx { --- 167,176 ---- } ! /** ! @param tentative whether we only want to check if the call is valid ! (as during overloading resolution). ! */ ! private static Polytype getType(Polytype type, Polytype[] parameters, ! boolean tentative) throws TypingEx, BadSizeEx, ReportErrorEx { *************** *** 205,210 **** final boolean doEnter = true; //Constraint.hasBinders(cst); ! if(doEnter) Typing.enter(); ! try { --- 209,215 ---- final boolean doEnter = true; //Constraint.hasBinders(cst); ! if(doEnter) Typing.enter(tentative); ! ! boolean ok = false; try { *************** *** 224,231 **** Typing.in(parameters, dom); } finally{ if(doEnter) ! Typing.leave(); } --- 229,240 ---- Typing.in(parameters, dom); + ok = true; } finally{ if(doEnter) ! // If we are in tentative mode and the call is valid, then ! // we make the effects last (that's only important when there are ! // existential type variables in the context). ! Typing.leave(tentative, tentative && ok); } |