# HG changeset patch # User Adam Chlipala # Date 1335035940 14400 # Node ID 5df85275c0d42b67df8c6cb48b11011f37c7376c # Parent 30c0ca20bf595d9144c12e60f3cab2425ace71e3 Omit 'Basis.' in pretty-printing constructors, where this is unambiguous diff -r 30c0ca20bf59 -r 5df85275c0d4 src/elab_print.sml --- a/src/elab_print.sml Sat Apr 21 15:09:02 2012 -0400 +++ b/src/elab_print.sml Sat Apr 21 15:19:00 2012 -0400 @@ -165,7 +165,20 @@ else m1x in - p_list_sep (string ".") string (m1x :: ms @ [x]) + if m1x = "Basis" andalso (case E.lookupC env x of + E.Named (n, _) => + let + val (_, _, co) = E.lookupCNamed env n + in + case co of + SOME (CModProj (m1', [], x'), _) => m1' = m1 andalso x' = x + | _ => false + end + | E.NotBound => true + | _ => false) then + string x + else + p_list_sep (string ".") string (m1s :: ms @ [x]) end | CApp (c1, c2) => parenIf par (box [p_con env c1, diff -r 30c0ca20bf59 -r 5df85275c0d4 tests/ambig.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/ambig.ur Sat Apr 21 15:19:00 2012 -0400 @@ -0,0 +1,4 @@ +type r = {A : int, B : int, C : float} +type string = int + +val x : r = {A = 1, B = "hi", C = 2.3}