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 <rohanjr@gmail.com>
This commit is contained in:
Martin Huschenbett 2019-07-22 21:18:14 +02:00 committed by mergify[bot]
parent a35af9697f
commit 35dc1848a2

View File

@ -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.