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 3426, Fri Nov 13 16:49:21 2015 UTC revision 3427, Fri Nov 13 17:07:04 2015 UTC
# Line 452  Line 452 
452                          end                          end
453                      | ((e', ty as Ty.T_Sequence _), [NONE]) => expectedTensor ty                      | ((e', ty as Ty.T_Sequence _), [NONE]) => expectedTensor ty
454                      | ((e', ty as Ty.T_Sequence _), _) => expectedTensor ty                      | ((e', ty as Ty.T_Sequence _), _) => expectedTensor ty
455                      | ((e', Ty.T_Tensor shape), _) => raise Fail "FIXME: tensor slicing"                      | ((e', ty as Ty.T_Tensor shape), _) => let
456                            val indices' = List.map (Option.map (#1 o chkIndex)) indices
457                            val order = List.length indices'
458                            val expectedTy = TU.mkTensorTy order
459                            val resultTy = TU.slice(expectedTy, List.map Option.isSome indices')
460                            in
461                              if Unify.equalType(ty, expectedTy)
462                                then (AST.E_Slice(e', indices', resultTy), resultTy)
463                                else err (cxt, [
464                                    S "type error in slice operation\n",
465                                    S "  expected:  ", S(Int.toString order), S "-order tensor\n",
466                                    S "  but found: ", TY ty
467                                  ])
468                            end
469                      | ((_, ty), _) => expectedTensor ty                      | ((_, ty), _) => expectedTensor ty
470                    (* end case *)                    (* end case *)
471                  end                  end

Legend:
Removed from v.3426  
changed lines
  Added in v.3427

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