[MLton-commit] r4274
Stephen Weeks
MLton@mlton.org
Thu, 1 Dec 2005 22:42:18 -0800
Changed explanation of "not equality" to use brackets to indicate the
problematic part(s) of the type.
----------------------------------------------------------------------
U mlton/trunk/mlton/elaborate/elaborate-env.fun
----------------------------------------------------------------------
Modified: mlton/trunk/mlton/elaborate/elaborate-env.fun
===================================================================
--- mlton/trunk/mlton/elaborate/elaborate-env.fun 2005-12-02 04:39:34 UTC (rev 4273)
+++ mlton/trunk/mlton/elaborate/elaborate-env.fun 2005-12-02 06:42:14 UTC (rev 4274)
@@ -78,7 +78,9 @@
structure Type =
struct
open Type
-
+
+ fun bracket l = let open Layout in seq [str "[", l, str "]"] end
+
fun explainDoesNotAdmitEquality (t: t): Layout.t =
let
open Layout
@@ -98,7 +100,8 @@
in
case ! (Tycon.admitsEquality c) of
Always => NONE
- | Never => SOME (keep {showInside = false})
+ | Never => SOME (bracket (#1 (keep {showInside = false})),
+ {isChar = false, needsParen = false})
| Sometimes =>
if Vector.exists (ts, Option.isSome)
then SOME (keep {showInside = true})
@@ -113,6 +116,11 @@
NONE =>
let
val v = SortedRecord.toVector r
+ val ending =
+ if SortedRecord.exists (r, Option.isNone) then
+ ", ...}"
+ else
+ "}"
in
(seq
[str "{",
@@ -125,7 +133,7 @@
| SOME (z, _) =>
seq [Field.layout f, str ": ", z] :: ac),
",")),
- str "}"],
+ str ending],
{isChar = false, needsParen = false})
end
| SOME v =>