CVS: sml-dist/src/compiler/Elaborator/modules sigmatch.sml, 1.6.8.6, 1.6.8.7

David MacQueen <[email protected]> Fri, 07 Jul 2006 14:06:12 -0700
Newsgroups gmane.comp.lang.sml.smlnj.commits
Message-ID <[email protected]>
Update of /cvsroot/smlnj/sml-dist/src/compiler/Elaborator/modules
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv1837/compiler/Elaborator/modules

Modified Files:
      Tag: primop-branch-2
	sigmatch.sml 
Log Message:
fixup matchTypes in sigmatch, VALvar in many files

Index: sigmatch.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/compiler/Elaborator/modules/sigmatch.sml,v
retrieving revision 1.6.8.6
retrieving revision 1.6.8.7
diff -C2 -d -r1.6.8.6 -r1.6.8.7
*** sigmatch.sml	6 Jul 2006 03:07:18 -0000	1.6.8.6
--- sigmatch.sml	7 Jul 2006 21:06:09 -0000	1.6.8.7
***************
*** 287,305 ****
            end
  
! (* dbm: we want matchTypes to produce:
!  (1) the actual type generic instantiation metavariables,
!  (2) the spec type generic instantiation metavariables,
! So that matchTypes products can be used where matchTypes1 is called below.
! It should prune (if necessary).
! Test for whether actual type was a polytype reduces to testing whether 
! actual type produces and generic instantiation metavariables (i.e. null test).
! 
!   gk: compareTypes does pruning. 
! *)
! 
!   fun matchTypes (spec, actual, dinfo, name) : bool =
!       TU.compareTypes(spec, actual)
! (*    if TU.compareTypes(spec, actual) then eqvTnspTy(spec, actual, dinfo) *)
!     else (err EM.COMPLAIN 
                "value type in structure doesn't match signature spec"
                (fn ppstrm =>
--- 287,308 ----
            end
  
!   (* matchTypes checks whether the spec type is a generic instance of
!    * the actual type, and if so it returns two lists of type metavariables (tyvars):
!    *  (1) the spec type generic instantiation metavariables (btvs),
!    *  (2) the actual type generic instantiation metavariables (ptvs).
!    * In the matching, the btvs variables are not instantiated, while the
!    * ptvs are always instantiated, and their instantiations constitute the
!    * "parameters of instantiatiation" that make the actual type agree with
!    * the (generic instance of the) spec. The parameter instantiations will
!    * contain types containing occurrences of the bound tyvars.
!    * If the actual is not a polytype, the ptvs list is nil. Similarly for
!    * the spec type and btvs. If both spec and actual are monotypes, the
!    * matching is equivalent to equalTypes(spec,actual). [dbm: 7/7/06]
!    *)
!   fun matchTypes (spec, actual, name) : T.tyvar list * T.tyvar list =
!       case TU.matchInstTypes(spec, actual)
!        of SOME(btvs,ptvs) => (btvs,ptvs)
!         | NONE =>
!           (err EM.COMPLAIN 
                "value type in structure doesn't match signature spec"
                (fn ppstrm =>
***************
*** 858,892 ****
                           val acttyp = typeInOriginal("$actty(val/val)", acttyp)
                           val dacc = DA.selAcc(rootAcc, actslot)
!                          val dinfo = II.selStrInfo(rootInfo, actslot)
!                          val _ = 
!                            matchTypes(spectyp, acttyp, (* dinfo, dbm *) sym)
  
                           val spath = SP.SPATH[sym]
                           val actvar = VALvar{path=spath, typ=ref acttyp,
!                                              access=dacc, info=dinfo}
  
                           val (decs', nv) = 
!                            case TU.prune(TU.headReduceType acttyp)
!                              of POLYty _ =>
!                                 let val (actinst, actParamTvs) =
!                                         TU.instantiatePoly actual
!                                     val (specinst, specGenericTvs) =
!                                         TU.instantiatePoly spec
!                                     val _ = matchTypes1(actinst,specinst)
!                                     (* dbm: this is a variation on what the
!                                             original matchTypes does, so it
!                                             should be folded into that function *)
!                                     val acc = DA.namedAcc(sym, mkv)
!                                     val specvar = 
!                                       VALvar{path=spath, typ=ref spectyp,
!                                              access=acc, info=dinfo}
!                                     val vb = 
!                                       A.VB {pat=A.VARpat specvar,
!                                             exp=A.VARexp(ref actvar, actParamTvs),
!                                             boundtvs=specGenericTvs, tyvars=ref []}
! 
!                                  in ((A.VALdec [vb])::decs, specvar)
!                                 end
!                              | _ => (decs, actvar)
  
                           val bindings' = (B.VALbind nv)::bindings
--- 861,885 ----
                           val acttyp = typeInOriginal("$actty(val/val)", acttyp)
                           val dacc = DA.selAcc(rootAcc, actslot)
!                          val prim = PrimOpId.selStrPrimId(rootInfo, actslot)
!                          val (btvs,ptvs) = matchTypes(spectyp, acttyp, sym)
  
                           val spath = SP.SPATH[sym]
                           val actvar = VALvar{path=spath, typ=ref acttyp,
!                                              access=dacc, prim=prim}
  
                           val (decs', nv) = 
!                              case ptvs
!                                of [] => (decs, actvar) (* acttyp is mono *)
!                                 | _ =>
!                                   let val acc = DA.namedAcc(sym, mkv)
!                                       val specvar = 
!                                         VALvar{path=spath, typ=ref spectyp,
!                                                access=acc, prim=prim}
!                                       val vb = 
!                                         A.VB {pat=A.VARpat specvar,
!                                               exp=A.VARexp(ref actvar, ptvs),
!                                               boundtvs=btvs, tyvars=ref []}
!                                    in ((A.VALdec [vb])::decs, specvar)
!                                   end
  
                           val bindings' = (B.VALbind nv)::bindings
***************
*** 899,904 ****
                       let val spectyp = typeInMatched("$specty(val/con)", spectyp)
                           val acttyp = typeInOriginal("$actty(val/con)", acttyp)
!                          val (instys, btvs) = 
!                            matchTypes(spectyp, acttyp, II.Null, name)
  
                           val nrep = 
--- 892,897 ----
                       let val spectyp = typeInMatched("$specty(val/con)", spectyp)
                           val acttyp = typeInOriginal("$actty(val/con)", acttyp)
!                          val (boundtvs,paramtvs) = 
!                              matchTypes(spectyp, acttyp, name)
  
                           val nrep = 
***************
*** 914,923 ****
                                 val specvar = 
                                   VALvar{path=SP.SPATH[name], access=acc,
!                                         info=II.Null,
                                          typ=ref spectyp}
                                 val vb = 
                                   A.VB {pat=A.VARpat specvar,
!                                        exp=A.CONexp(con, instys),
!                                        boundtvs=btvs, tyvars=ref []}
                              in ((A.VALdec [vb])::decs, 
                                  (B.VALbind specvar)::bindings)
--- 907,916 ----
                                 val specvar = 
                                   VALvar{path=SP.SPATH[name], access=acc,
!                                         prim=PrimOpId.NonPrim,
                                          typ=ref spectyp}
                                 val vb = 
                                   A.VB {pat=A.VARpat specvar,
!                                        exp=A.CONexp(con, paramtvs),
!                                        boundtvs=boundtvs, tyvars=ref []}
                              in ((A.VALdec [vb])::decs, 
                                  (B.VALbind specvar)::bindings)
***************
*** 938,942 ****
                       let val spectyp = typeInMatched("$specty(con/con)", spectyp)
                           val acttyp = typeInOriginal("$actty(con/con)", acttyp)
!                          val _ = matchTypes(spectyp, acttyp, II.Null, name)
  
                           val bindings' =
--- 931,935 ----
                       let val spectyp = typeInMatched("$specty(con/con)", spectyp)
                           val acttyp = typeInOriginal("$actty(con/con)", acttyp)
!                          val _ = matchTypes(spectyp, acttyp, name)
  
                           val bindings' =
***************
*** 1301,1305 ****
                     val srctyp = typeInSrc("$spec-srcty(packStr-val)", spectyp)
                     val dacc = DA.selAcc(rootAcc, s)
!                    val dinfo = II.sel(rootInfo, s)
                     val (instys, btvs, resinst, eqflag) = 
                       absEqvTy(restyp, srctyp, dinfo)
--- 1294,1298 ----
                     val srctyp = typeInSrc("$spec-srcty(packStr-val)", spectyp)
                     val dacc = DA.selAcc(rootAcc, s)
!                    val dinfo = PrimOpId.selStrPrimId(rootInfo, s)
                     val (instys, btvs, resinst, eqflag) = 
                       absEqvTy(restyp, srctyp, dinfo)
***************
*** 1307,1311 ****
                     val spath = SP.SPATH[sym]
                     val srcvar = VALvar{path=spath, typ=ref srctyp,
!                                        access=dacc, info=dinfo}
  
                     val (decs', nv) =
--- 1300,1304 ----
                     val spath = SP.SPATH[sym]
                     val srcvar = VALvar{path=spath, typ=ref srctyp,
!                                        access=dacc, prim=dinfo}
  
                     val (decs', nv) =
***************
*** 1314,1318 ****
                                 val resvar = 
                                   VALvar{path=spath, typ=ref restyp,
!                                         access=acc, info=II.Null}
  
                                 val ntycs = TU.filterSet(resinst, abstycs)
--- 1307,1311 ----
                                 val resvar = 
                                   VALvar{path=spath, typ=ref restyp,
!                                         access=acc, prim=PrimOpId.NonPrim}
  
                                 val ntycs = TU.filterSet(resinst, abstycs)


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642