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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/typechecker/check-expr.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/typechecker/check-expr.sml

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

revision 3431, Sat Nov 14 14:03:58 2015 UTC revision 3433, Sun Nov 15 15:40:14 2015 UTC
# Line 95  Line 95 
95            end            end
96    
97    (* check the type of a literal *)    (* check the type of a literal *)
98      fun checkLit lit = (case lit      fun checkLit lit = (AST.E_Lit lit, TypeOf.literal lit)
            of (L.Int _) => (AST.E_Lit lit, Ty.T_Int)  
             | (L.Real _) => (AST.E_Lit lit, Ty.realTy)  
             | (L.String s) => (AST.E_Lit lit, Ty.T_String)  
             | (L.Bool _) => (AST.E_Lit lit, Ty.T_Bool)  
           (* end case *))  
99    
100    (* type check a dot product, which has the constraint:    (* type check a dot product, which has the constraint:
101     *     ALL[sigma1, d1, sigma2] . tensor[sigma1, d1] * tensor[d1, sigma2] -> tensor[sigma1, sigma2]     *     ALL[sigma1, d1, sigma2] . tensor[sigma1, d1] * tensor[d1, sigma2] -> tensor[sigma1, sigma2]
# Line 719  Line 714 
714      and chkStringConstExpr (env, cxt, PT.E_Mark m) =      and chkStringConstExpr (env, cxt, PT.E_Mark m) =
715            chkStringConstExpr (E.withEnvAndContext (env, cxt, m))            chkStringConstExpr (E.withEnvAndContext (env, cxt, m))
716        | chkStringConstExpr (env, cxt, e) = (case checkAndPrune (env, cxt, e)        | chkStringConstExpr (env, cxt, e) = (case checkAndPrune (env, cxt, e)
717             of (e', Ty.T_String) => (case ConstExpr.eval (cxt, e')             of (e', Ty.T_String) => (case ConstExpr.eval (cxt, false, e')
718                   of SOME(ConstExpr.String s) => SOME s                   of SOME(ConstExpr.String s) => SOME s
719                    | SOME(ConstExpr.Expr e) => raise Fail "FIXME"                    | SOME(ConstExpr.Expr e) => raise Fail "FIXME"
720                    | NONE => NONE                    | NONE => NONE
# Line 736  Line 731 
731    
732    (* check a dimension that is given by a constant expression *)    (* check a dimension that is given by a constant expression *)
733      and checkDim (env, cxt, dim) = (case checkAndPrune (env, cxt, dim)      and checkDim (env, cxt, dim) = (case checkAndPrune (env, cxt, dim)
734             of (e', Ty.T_Int) => (case ConstExpr.eval (cxt, e')             of (e', Ty.T_Int) => (case ConstExpr.eval (cxt, false, e')
735                   of SOME(ConstExpr.Int d) => SOME d                   of SOME(ConstExpr.Int d) => SOME d
736                    | SOME(ConstExpr.Expr e) => (                    | SOME(ConstExpr.Expr e) => (
737                        TypeError.error (cxt, [S "unable to evaluate constant dimension expression"]);                        TypeError.error (cxt, [S "unable to evaluate constant dimension expression"]);

Legend:
Removed from v.3431  
changed lines
  Added in v.3433

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