summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-01-11 11:42:39 +0000
committeraarne <aarne@cs.chalmers.se>2007-01-11 11:42:39 +0000
commit6c9ddcda8bf23c968e3a56667f41b1f398ac3422 (patch)
tree2651046d42243becb8131b7b85ee58406180a022
parent46994dec589a339a2f29cf4adca57bf1e57608b6 (diff)
fix in etaexpand optimization
-rw-r--r--src/GF/Compile/Optimize.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/GF/Compile/Optimize.hs b/src/GF/Compile/Optimize.hs
index 6cbd302f5..61e1615f0 100644
--- a/src/GF/Compile/Optimize.hs
+++ b/src/GF/Compile/Optimize.hs
@@ -167,8 +167,12 @@ partEval opts gr (context, val) trm = errIn ("parteval" +++ prt_ trm) $ do
etaExpand su t = do
t' <- comp su t
case t' of
- R _ -> comp su t' --- return t' wo noexpand...
+ R _ | rightType t' -> comp su t' --- return t' wo noexpand...
_ -> recordExpand val t' >>= comp su
+ -- don't eta expand records of right length (correct by type checking)
+ rightType t = case (t,val) of
+ (R rs, RecType ts) -> length rs == length ts
+ _ -> False
outCase subst t = do
pts <- getParams context