From 724a2c18360626b29c99a274c2aa0c59caafeeb6 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 21 Apr 2012 14:06:03 -0400 Subject: Add another rule to simplify record concatenations for pretty-printing --- src/elab_ops.sml | 3 ++- tests/simplify.ur | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 tests/simplify.ur diff --git a/src/elab_ops.sml b/src/elab_ops.sml index dbefbe7d..1546feef 100644 --- a/src/elab_ops.sml +++ b/src/elab_ops.sml @@ -1,4 +1,4 @@ -(* Copyright (c) 2008, Adam Chlipala +(* Copyright (c) 2008, 2012, Adam Chlipala * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -482,6 +482,7 @@ fun reduceCon env (cAll as (c, loc)) = | ((CRecord (_, []), _), _) => c2 | ((CConcat (c11, c12), loc), _) => reduceCon env (CConcat (c11, (CConcat (c12, c2), loc)), loc) | (_, (CRecord (_, []), _)) => c1 + | ((CRecord (k, xcs1), loc), (CConcat ((CRecord (_, xcs2), _), c2'), _)) => (CConcat ((CRecord (k, xcs1 @ xcs2), loc), c2'), loc) | _ => (CConcat (c1, c2), loc) end | CMap _ => cAll diff --git a/tests/simplify.ur b/tests/simplify.ur new file mode 100644 index 00000000..11e002eb --- /dev/null +++ b/tests/simplify.ur @@ -0,0 +1 @@ +fun main [r] (r : $([A = int] ++ ([B = float] ++ r))) : $([A = float] ++ ([B = int] ++ r)) = r -- cgit v1.2.3