mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
Write template locations when converting to DAML-LF (#2575)
Until now we've omitted them for no good reason. Choice locations will follow in a separate PR.
This commit is contained in:
parent
6920a6be11
commit
4ae8cfd940
@ -276,6 +276,7 @@ convertGenericTemplate env x
|
||||
, Just (polyType, _) <- splitFunTy_maybe (varType create)
|
||||
, Just (monoTyCon, unwrapCo) <- findMonoTyp polyType
|
||||
= do
|
||||
let tplLocation = convNameLoc monoTyCon
|
||||
polyType <- convertType env polyType
|
||||
monoType@(TCon monoTyCon) <- convertTyCon env monoTyCon
|
||||
(unwrapTpl, wrapTpl) <- convertCoercion env unwrapCo
|
||||
@ -285,7 +286,6 @@ convertGenericTemplate env x
|
||||
( ETmApp $ mkETyApps (EBuiltin BECoerceContractId) [monoType, polyType]
|
||||
, ETmApp $ mkETyApps (EBuiltin BECoerceContractId) [polyType, monoType]
|
||||
)
|
||||
let tplLocation = Nothing
|
||||
let tplTypeCon = qualObject monoTyCon
|
||||
let tplParam = this
|
||||
let applyThis e = ETmApp e $ unwrapTpl $ EVar this
|
||||
|
17
compiler/damlc/tests/daml-test-files/Locations.daml
Normal file
17
compiler/damlc/tests/daml-test-files/Locations.daml
Normal file
@ -0,0 +1,17 @@
|
||||
-- @QUERY-LF .modules[] | .templates[] | select(.tycon.segments == ["A"]) | .location.range | (.start_line == "5.0" and .start_col == "9.0")
|
||||
-- @QUERY-LF .modules[] | .templates[] | select(.tycon.segments == ["TA"]) | .location.range | (.start_line == "16.0" and .start_col == "18.0")
|
||||
daml 1.2
|
||||
module Locations where
|
||||
|
||||
template A with
|
||||
p : Party
|
||||
where
|
||||
signatory p
|
||||
|
||||
template T a with
|
||||
p : Party
|
||||
x : a
|
||||
where
|
||||
signatory p
|
||||
|
||||
template instance TA = T A
|
Loading…
Reference in New Issue
Block a user