language: fix: missing template instances in package (#2884)

The package compiled via daml migrate was missing the actual
Upgrade/Rollback templates. This is because we used `type` instead of
`template instance` to define those templates. Also, apparently we need
to export UpgradeInstance/RollbackInstance from DA.Upgrade in the
standard library.
This commit is contained in:
Robin Krom 2019-09-11 16:05:46 +02:00 committed by GitHub
parent 01eccf2c64
commit 41aa03c711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 6 deletions

View File

@ -92,9 +92,10 @@ generateUpgradeModule templateNames modName qualA qualB =
upgradeTemplates :: String -> [String]
upgradeTemplates n =
[ "type " <> n <> "Upgrade = Upgrade A." <> n <> " B." <> n
, "type " <> n <> "Rollback = Rollback A." <> n <> " B." <> n
[ "template instance " <> n <> "Upgrade = Upgrade A." <> n <> " B." <> n
, "template instance " <> n <> "Rollback = Rollback A." <> n <> " B." <> n
, "instance Convertible A." <> n <> " B." <> n
, "instance Convertible B." <> n <> " A." <> n
]
-- | Generate the full source for a daml-lf package.

View File

@ -12,6 +12,8 @@ module DA.Upgrade
, Convertible(..)
, GenConvertible
, Upgrade(..)
, UpgradeInstance(..)
, RollbackInstance(..)
, Rollback(..)
)
where

View File

@ -8,7 +8,8 @@ import FooB qualified as B
import FooAInstances()
import FooBInstances()
import DA.Upgrade
type FooUpgrade = Upgrade A.Foo B.Foo
type FooRollback = Rollback A.Foo B.Foo
template instance FooUpgrade = Upgrade A.Foo B.Foo
template instance FooRollback = Rollback A.Foo B.Foo
instance Convertible A.Foo B.Foo
instance Convertible B.Foo A.Foo

View File

@ -8,8 +8,8 @@ import FooB qualified as B
import FooAInstances()
import FooBInstances()
import DA.Upgrade
type FooUpgrade = Upgrade A.Foo B.Foo
type FooRollback = Rollback A.Foo B.Foo
template instance FooUpgrade = Upgrade A.Foo B.Foo
template instance FooRollback = Rollback A.Foo B.Foo
instance Convertible A.Foo B.Foo where
convert d = B.Foo with a = d.a; p = d.p; t = "upgraded"