From 3d3f7af1776c8ddf1ddfad0e53d2ea0ae770f592 Mon Sep 17 00:00:00 2001 From: Johan Nordlander Date: Fri, 22 Sep 2023 15:27:17 +0200 Subject: [PATCH] Added necessary cast when selecting from the completely generic tuple representation. --- compiler/Acton/CodeGen.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/Acton/CodeGen.hs b/compiler/Acton/CodeGen.hs index 34b2fa10d..f7c1d1e9d 100644 --- a/compiler/Acton/CodeGen.hs +++ b/compiler/Acton/CodeGen.hs @@ -755,7 +755,8 @@ instance Gen Expr where gen env (TApp _ e ts) = genInst env ts e gen env (IsInstance _ e c) = gen env primISINSTANCE <> parens (gen env e <> comma <+> genQName env c) gen env (Dot _ e n) = genDot env [] e n - gen env (DotI _ e i) = gen env e <> text "->" <> gen env componentsKW <> brackets (pretty i) + gen env e0@(DotI _ e i) = parens $ parens (gen env t) <> gen env e <> text "->" <> gen env componentsKW <> brackets (pretty i) + where t = typeOf env e0 gen env (RestI _ e i) = gen env eNone <> semi <+> text "// CodeGen for tuple tail not implemented" gen env (Tuple _ p KwdNil) | n == 0 = gen env primNEWTUPLE0