]> matita.cs.unibo.it Git - helm.git/commitdiff
Almost ready to implement coercion declaration for record fields. But how?
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 22 Jul 2009 09:24:55 +0000 (09:24 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 22 Jul 2009 09:24:55 +0000 (09:24 +0000)
helm/software/components/grafite_engine/grafiteEngine.ml

index 99414f63c917ce11e6e1a0b0e28261adb20e0714..5d1b81d7442605411098412ab3f332ab332e3966 100644 (file)
@@ -981,22 +981,40 @@ let rec eval_ncommand opts status (text,prefix_len,cmd) =
 *)
            let status = status#set_ng_mode `CommandMode in
            let status = LexiconSync.add_aliases_for_objs status (`New [uri]) in
-           List.fold_left
-            (fun (status,uris) boxml ->
-              try
-               let status,nuris =
-                eval_ncommand opts status
-                 ("",0,GrafiteAst.NObj (HExtlib.dummy_floc,boxml))
-               in
-                match uris,nuris with
-                   `New uris, `New nuris -> status,`New (nuris@uris)
-                 | _ -> assert false
-              with
-               NCicTypeChecker.TypeCheckerFailure msg
-                when Lazy.force msg =
-                "Sort elimination not allowed" ->
-                 status,uris
-            ) (status,`New [] (* uris *)) boxml
+           let status,uris =
+            List.fold_left
+             (fun (status,uris) boxml ->
+               try
+                let status,nuris =
+                 eval_ncommand opts status
+                  ("",0,GrafiteAst.NObj (HExtlib.dummy_floc,boxml))
+                in
+                 match uris,nuris with
+                    `New uris, `New nuris -> status,`New (nuris@uris)
+                  | _ -> assert false
+               with
+                NCicTypeChecker.TypeCheckerFailure msg
+                 when Lazy.force msg =
+                 "Sort elimination not allowed" ->
+                  status,uris
+             ) (status,`New [] (* uris *)) boxml in
+           let coercions =
+            match obj with
+              _,_,_,_,NCic.Inductive
+               (true,leftno,[_,_,_,[_,_,_]],(_,`Record fields))
+               ->
+                HExtlib.filter_map
+                 (fun (name,is_coercion,arity) ->
+                   if is_coercion then Some(name,leftno,arity) else None) fields
+            | _ -> [] in
+           let status =
+            List.fold_left
+             (fun status (name,cpos,arity) ->
+                (*CSC: COME DICHIARO LA COERCION??? *)
+                status
+             ) status coercions
+           in
+            status,uris
           with
            exn ->
             NCicLibrary.time_travel old_status;