From 35dc1848a2b5ec58a7441be5d27fb960594d1581 Mon Sep 17 00:00:00 2001 From: Martin Huschenbett Date: Mon, 22 Jul 2019 21:18:14 +0200 Subject: [PATCH] Erase key lookup methods implemented using magic as well (#2252) * Erase key lookup methods implemented using magic as well We're already erasing `create`, `fetch` and `exercise` methods. I've missed the ones related to key lookups when I did that. This PR fixes my mishap. * Fix typo in docs. Co-Authored-By: Rohan Jacob-Rao --- .../damlc/daml-lf-conversion/src/DA/Daml/LFConversion.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion.hs b/compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion.hs index 0b1504d402..1f0e3fb7bb 100644 --- a/compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion.hs +++ b/compiler/damlc/daml-lf-conversion/src/DA/Daml/LFConversion.hs @@ -608,7 +608,8 @@ convertBind2 env (NonRec name x) , is name `elem` internals = pure [] -- NOTE(MH): Desugaring `template X` will result in a type class - -- `XInstance` which has methods `createX`, `fetchX` and `exerciseXY` + -- `XInstance` which has methods `_createX`, `_fetchX`, `_exerciseXY`, + -- `_fetchByKeyX` and `_lookupByKeyX` -- (among others). The implementations of these methods are replaced -- with DAML-LF primitives in `convertGenericChoice` below. As part of -- this rewriting we also need to erase the default implementations of @@ -616,7 +617,7 @@ convertBind2 env (NonRec name x) -- -- TODO(MH): The check is an approximation which will fail when users -- start the name of their own methods with, say, `_exercise`. - | any (`isPrefixOf` is name) [ "$"++prefix++"_"++method | prefix <- ["dm", "c"], method <- ["create", "fetch", "exercise"] ] + | any (`isPrefixOf` is name) [ "$"++prefix++"_"++method | prefix <- ["dm", "c"], method <- ["create", "fetch", "exercise", "fetchByKey", "lookupByKey"] ] = pure [] -- NOTE(MH): Our inline return type syntax produces a local letrec for -- recursive functions. We currently don't support local letrecs.