Skip to content

Commit

Permalink
Merge pull request #126 from MatthewFluet/signature-withtype-updates
Browse files Browse the repository at this point in the history
Fix elaboration of withtype in signatures
  • Loading branch information
MatthewFluet committed Oct 20, 2015
2 parents adfd227 + ac35f60 commit 22f61a4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
7 changes: 6 additions & 1 deletion mlton/atoms/generic-scheme.fun
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
(* Copyright (C) 2015 Matthew Fluet.
* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
Expand Down Expand Up @@ -43,4 +44,8 @@ fun apply (T {tyvars, ty}, args) =
*)
else Type.substitute (ty, Vector.zip (tyvars, args))

val apply =
Trace.trace ("GenericScheme.apply", Layout.tuple2 (layout, Vector.layout Type.layout), Type.layout)
apply

end
16 changes: 6 additions & 10 deletions mlton/elaborate/elaborate-sigexp.fun
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Copyright (C) 2010,2012 Matthew Fluet.
(* Copyright (C) 2010,2012,2015 Matthew Fluet.
* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
Expand Down Expand Up @@ -204,18 +204,14 @@ fun elaborateTypedescs (typedescs: {tycon: Ast.Tycon.t,
fun elabTypBind (typBind: TypBind.t, E) =
let
val TypBind.T types = TypBind.node typBind
val () = (if (Vector.length (types) > 0)
then (check (Control.Elaborate.allowSigWithtype, "allowSigWithtype", TypBind.region typBind))
else ())
val () = if Vector.length types > 0
then check (Control.Elaborate.allowSigWithtype, "allowSigWithtype", TypBind.region typBind)
else ()
val strs =
Vector.map
(types, fn {def, tyvars, ...} =>
(let
val (_, ty) = elaborateType (def, E)
val scheme = Scheme.make (tyvars, ty)
in
TypeStr.def (scheme, Kind.Arity (Vector.length tyvars))
end))
TypeStr.def (elaborateScheme (tyvars, def, E),
Kind.Arity (Vector.length tyvars)))
in
Vector.foreach2
(types, strs, fn ({tycon, ...}, str) =>
Expand Down
6 changes: 5 additions & 1 deletion mlton/elaborate/interface.fun
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Copyright (C) 2009 Matthew Fluet.
(* Copyright (C) 2009,2015 Matthew Fluet.
* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
Expand Down Expand Up @@ -359,6 +359,10 @@ structure TypeStr =
| Scheme s => Scheme.apply (s, tys)
| Tycon t => Type.con (t, tys)

val apply =
Trace.trace ("Interface.TypeStr.apply", Layout.tuple2 (layout, Vector.layout Type.layout), Type.layout)
apply

fun cons t =
case node t of
Datatype {cons, ...} => cons
Expand Down

0 comments on commit 22f61a4

Please sign in to comment.