Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/compiler/typechecker/typechecker.sml
ViewVC logotype

Diff of /trunk/src/compiler/typechecker/typechecker.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 235, Thu Aug 5 21:57:46 2010 UTC revision 370, Sat Oct 2 17:19:14 2010 UTC
# Line 164  Line 164 
164                      | _ => err (cxt, [S "arguments to \"&&\" must have bool type"])                      | _ => err (cxt, [S "arguments to \"&&\" must have bool type"])
165                    (* end case *)                    (* end case *)
166                  end                  end
167                | PT.E_Cond(e1, cond, e2) => let
168                    val (e1', ty1) = checkExpr(env, cxt, e1)
169                    val (e2', ty2) = checkExpr(env, cxt, e2)
170                    in
171                      case checkExpr(env, cxt, cond)
172                       of (cond', Ty.T_Bool) =>
173                            if U.matchType(ty1, ty2)
174                              then (AST.E_Cond(cond', e1', e2'), ty1)
175                              else err (cxt, [
176                                  S "type do not match in conditional expression\n",
177                                  S "  true branch:  ", TY ty1,
178                                  S "  false branch: ", TY ty2
179                                ])
180                        | (_, ty') => err (cxt, [S "expected bool type, but found ", TY ty'])
181                      (* end case *)
182                    end
183              | PT.E_BinOp(e1, rator, e2) => let              | PT.E_BinOp(e1, rator, e2) => let
184                  val (e1', ty1) = checkExpr(env, cxt, e1)                  val (e1', ty1) = checkExpr(env, cxt, e1)
185                  val (e2', ty2) = checkExpr(env, cxt, e2)                  val (e2', ty2) = checkExpr(env, cxt, e2)

Legend:
Removed from v.235  
changed lines
  Added in v.370

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0