Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAML-LF: restrict value versions #6109

Merged
merged 2 commits into from
May 27, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
cosmetic
  • Loading branch information
remyhaemmerle-da committed May 27, 2020
commit 98bc15e276f754d43181bb268ad9c33bf1ad60ca
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ object SBuiltin {
def execute(args: util.ArrayList[SValue], machine: Machine): Unit = {
checkToken(args.get(1))
val keyWithMaintainers =
extractKeyWithMaintainers(machine.supportedValueVersions, args.get(0))
extractKeyWithMaintainers(args.get(0), machine.supportedValueVersions)
val gkey = GlobalKey(templateId, keyWithMaintainers.key.value)
// check if we find it locally
machine.ptx.keys.get(gkey) match {
Expand Down Expand Up @@ -1013,7 +1013,7 @@ object SBuiltin {
def execute(args: util.ArrayList[SValue], machine: Machine): Unit = {
checkToken(args.get(2))
val keyWithMaintainers =
extractKeyWithMaintainers(machine.supportedValueVersions, args.get(0))
extractKeyWithMaintainers(args.get(0), machine.supportedValueVersions)
val mbCoid = args.get(1) match {
case SOptional(mb) =>
mb.map {
Expand Down Expand Up @@ -1045,7 +1045,7 @@ object SBuiltin {
def execute(args: util.ArrayList[SValue], machine: Machine): Unit = {
checkToken(args.get(1))
val keyWithMaintainers =
extractKeyWithMaintainers(machine.supportedValueVersions, args.get(0))
extractKeyWithMaintainers(args.get(0), machine.supportedValueVersions)
val gkey = GlobalKey(templateId, keyWithMaintainers.key.value)
// check if we find it locally
machine.ptx.keys.get(gkey) match {
Expand Down Expand Up @@ -1462,8 +1462,8 @@ object SBuiltin {
}

private def extractKeyWithMaintainers(
supportedValueVersions: VersionRange[value.ValueVersion],
v: SValue,
supportedValueVersions: VersionRange[value.ValueVersion],
): KeyWithMaintainers[Tx.Value[Nothing]] =
v match {
case SStruct(flds, vals)
Expand All @@ -1490,7 +1490,7 @@ object SBuiltin {
supportedValueVersions: VersionRange[value.ValueVersion],
): Option[KeyWithMaintainers[Tx.Value[Nothing]]] =
optKey match {
case SOptional(mbKey) => mbKey.map(extractKeyWithMaintainers(supportedValueVersions, _))
case SOptional(mbKey) => mbKey.map(extractKeyWithMaintainers(_, supportedValueVersions))
case v => crash(s"Expected optional key with maintainers, got: $v")
}

Expand Down