rename interface library to api-type-signature; alias symbols (#14783)

* move interface directory to api-type-signature; change bazel target; move scala files

* rename iface package to typesig; rename EnvironmentInterface to EnvironmentSignature

* rename Interface to PackageSignature

* rename fromReaderInterfaces to fromPackageSignatures

* rename InterfaceReader to SignatureReader

* rename InterfaceReader to SignatureReader in deprecation note

* rename readInterface to readPackageSignature

* rename InterfaceReaderError to Error

* rename InterfaceReaderMain to SignatureReaderMain

* rename InterfaceType to PackageSignature.TypeDecl

* rename astInterfaces to interfaces

* rename astInterfaces to interfaces in PackageSignature

* rename findAstInterface to findInterface

* rename a couple arguments

CHANGELOG_BEGIN
- [Scala API] The "quasi-public" API in ``com.daml.lf.iface`` has moved
  to the new ``com.daml.lf.typesig`` package, with many accompanying
  name changes as documented in `issue #13669
  <https://github.com/digital-asset/daml/issues/13669>`__.

  Daml 2.5.0 or later will remove the old names, and also rename the
  Maven artifact from ``daml-lf-interface`` to
  ``daml-lf-api-type-signature``.  We recommend that users of this API
  use the deprecation guidance in 2.4.0 to port their applications
  before this happens.
CHANGELOG_END
This commit is contained in:
Stephen Compall 2022-08-23 11:21:45 -04:00 committed by GitHub
parent 2f90845cc2
commit f85f7816c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 553 additions and 328 deletions

View File

@ -24,11 +24,11 @@ Components
the LF specification, changes to the Protobuf definition are governed
by the [Daml-LF Governance process][].
- `interface` is an ADT of the "public interface" of a given LF package,
meaning its templates, their choices, and serializable data types in
the package. The ADT does *not* include `def`s or expressions. A
reader from the raw protobuf is included. The ADT is usable from
Java.
- `api-type-signature` is an ADT of the "public interface" of a given LF
package, meaning its templates, their choices, and serializable data
types in the package. The ADT does *not* include `def`s or
expressions. A reader from the raw protobuf is included. The ADT is
usable from Java.
- `lfpackage` is the canonical LF ADT, containing all information about
an LF package. Its main consumer is the `interpreter`, which compiles

View File

@ -12,7 +12,7 @@ load("//rules_daml:daml.bzl", "daml_compile")
load("//daml-lf/language:daml-lf.bzl", "lf_version_configuration")
da_scala_library(
name = "interface",
name = "api-type-signature",
srcs = glob(["src/main/**/*.scala"]),
scala_deps = [
"@maven//:com_typesafe_scala_logging_scala_logging",
@ -58,7 +58,7 @@ da_scala_test(
],
scalacopts = lf_scalacopts,
deps = [
":interface",
":api-type-signature",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",

View File

@ -0,0 +1,135 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf
package object iface {
// @deprecated("renamed to typesig.EnvironmentSignature", since = "2.4.0")
type EnvironmentInterface = typesig.EnvironmentSignature
// @deprecated("renamed to typesig.EnvironmentSignature", since = "2.4.0")
final val EnvironmentInterface = typesig.EnvironmentSignature
// @deprecated("renamed to typesig.FieldWithType", since = "2.4.0")
type FieldWithType = typesig.FieldWithType
// @deprecated("moved to typesig.DefDataType", since = "2.4.0")
type DefDataType[+RF, +VF] = typesig.DefDataType[RF, VF]
// @deprecated("moved to typesig.DefDataType", since = "2.4.0")
final val DefDataType = typesig.DefDataType
// @deprecated("moved to typesig.DataType", since = "2.4.0")
type DataType[+RT, +VT] = typesig.DataType[RT, VT]
// @deprecated("moved to typesig.DataType", since = "2.4.0")
final val DataType = typesig.DataType
// @deprecated("moved to typesig.Record", since = "2.4.0")
type Record[+RT] = typesig.Record[RT]
// @deprecated("moved to typesig.Record", since = "2.4.0")
final val Record = typesig.Record
// @deprecated("moved to typesig.Variant", since = "2.4.0")
type Variant[+VT] = typesig.Variant[VT]
// @deprecated("moved to typesig.Variant", since = "2.4.0")
final val Variant = typesig.Variant
// @deprecated("moved to typesig.Enum", since = "2.4.0")
type Enum = typesig.Enum
// @deprecated("moved to typesig.Enum", since = "2.4.0")
final val Enum = typesig.Enum
// @deprecated("moved to typesig.DefTemplate", since = "2.4.0")
type DefTemplate[+Ty] = typesig.DefTemplate[Ty]
// @deprecated("moved to typesig.DefTemplate", since = "2.4.0")
final val DefTemplate = typesig.DefTemplate
// @deprecated("moved to typesig.TemplateChoices", since = "2.4.0")
type TemplateChoices[+Ty] = typesig.TemplateChoices[Ty]
// @deprecated("moved to typesig.TemplateChoices", since = "2.4.0")
final val TemplateChoices = typesig.TemplateChoices
// @deprecated("moved to typesig.TemplateChoice", since = "2.4.0")
type TemplateChoice[+Ty] = typesig.TemplateChoice[Ty]
// @deprecated("moved to typesig.TemplateChoice", since = "2.4.0")
final val TemplateChoice = typesig.TemplateChoice
// @deprecated("moved to typesig.DefInterface", since = "2.4.0")
type DefInterface[+Ty] = typesig.DefInterface[Ty]
// @deprecated("moved to typesig.DefInterface", since = "2.4.0")
final val DefInterface = typesig.DefInterface
// @deprecated("renamed to typesig.PackageSignature.TypeDecl", since = "2.4.0")
type InterfaceType = typesig.PackageSignature.TypeDecl
// @deprecated("renamed to typesig.PackageSignature.TypeDecl", since = "2.4.0")
final val InterfaceType = typesig.PackageSignature.TypeDecl
// @deprecated("moved to typesig.PackageMetadata", since = "2.4.0")
type PackageMetadata = typesig.PackageMetadata
// @deprecated("moved to typesig.PackageMetadata", since = "2.4.0")
final val PackageMetadata = typesig.PackageMetadata
// @deprecated("renamed to typesig.PackageSignature", since = "2.4.0")
type Interface = typesig.PackageSignature
// @deprecated("renamed to typesig.PackageSignature", since = "2.4.0")
final val Interface = typesig.PackageSignature
// @deprecated("moved to typesig.Type", since = "2.4.0")
type Type = typesig.Type
// @deprecated("moved to typesig.Type", since = "2.4.0")
final val Type = typesig.Type
// @deprecated("moved to typesig.TypeCon", since = "2.4.0")
type TypeCon = typesig.TypeCon
// @deprecated("moved to typesig.TypeCon", since = "2.4.0")
final val TypeCon = typesig.TypeCon
// @deprecated("moved to typesig.TypeNumeric", since = "2.4.0")
type TypeNumeric = typesig.TypeNumeric
// @deprecated("moved to typesig.TypeNumeric", since = "2.4.0")
final val TypeNumeric = typesig.TypeNumeric
// @deprecated("moved to typesig.TypePrim", since = "2.4.0")
type TypePrim = typesig.TypePrim
// @deprecated("moved to typesig.TypePrim", since = "2.4.0")
final val TypePrim = typesig.TypePrim
// @deprecated("moved to typesig.TypeVar", since = "2.4.0")
type TypeVar = typesig.TypeVar
// @deprecated("moved to typesig.TypeVar", since = "2.4.0")
final val TypeVar = typesig.TypeVar
// @deprecated("moved to typesig.TypeConNameOrPrimType", since = "2.4.0")
type TypeConNameOrPrimType = typesig.TypeConNameOrPrimType
// @deprecated("moved to typesig.TypeConName", since = "2.4.0")
type TypeConName = typesig.TypeConName
// @deprecated("moved to typesig.TypeConName", since = "2.4.0")
final val TypeConName = typesig.TypeConName
// @deprecated("moved to typesig.PrimType", since = "2.4.0")
type PrimType = typesig.PrimType
// @deprecated("moved to typesig.PrimType", since = "2.4.0")
final val PrimType = typesig.PrimType
// @deprecated("moved to typesig.PrimTypeBool", since = "2.4.0")
final val PrimTypeBool = typesig.PrimTypeBool
// @deprecated("moved to typesig.PrimTypeInt", since = "2.4.0")
final val PrimTypeInt64 = typesig.PrimTypeInt64
// @deprecated("moved to typesig.PrimTypeText", since = "2.4.0")
final val PrimTypeText = typesig.PrimTypeText
// @deprecated("moved to typesig.PrimTypeDate", since = "2.4.0")
final val PrimTypeDate = typesig.PrimTypeDate
// @deprecated("moved to typesig.PrimTypeTimestamp", since = "2.4.0")
final val PrimTypeTimestamp = typesig.PrimTypeTimestamp
// @deprecated("moved to typesig.PrimTypeParty", since = "2.4.0")
final val PrimTypeParty = typesig.PrimTypeParty
// @deprecated("moved to typesig.PrimTypeContractId", since = "2.4.0")
final val PrimTypeContractId = typesig.PrimTypeContractId
// @deprecated("moved to typesig.PrimTypeList", since = "2.4.0")
final val PrimTypeList = typesig.PrimTypeList
// @deprecated("moved to typesig.PrimTypeUnit", since = "2.4.0")
final val PrimTypeUnit = typesig.PrimTypeUnit
// @deprecated("moved to typesig.PrimTypeOptional", since = "2.4.0")
final val PrimTypeOptional = typesig.PrimTypeOptional
// @deprecated("moved to typesig.PrimTypeTextMap", since = "2.4.0")
final val PrimTypeTextMap = typesig.PrimTypeTextMap
// @deprecated("moved to typesig.PrimTypeGenMap", since = "2.4.0")
final val PrimTypeGenMap = typesig.PrimTypeGenMap
// @deprecated("moved to typesig.PrimTypeVisitor", since = "2.4.0")
type PrimTypeVisitor[+Z] = typesig.PrimTypeVisitor[Z]
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.iface
import com.daml.lf.typesig.{reader => tsr}
package object reader {
// @deprecated("moved to typesig.reader.DamlLfArchiveReader", since = "2.4.0")
final val DamlLfArchiveReader = tsr.DamlLfArchiveReader
// @deprecated("moved to typesig.reader.Errors", since = "2.4.0")
type Errors[K, A] = tsr.Errors[K, A]
// @deprecated("moved to typesig.reader.Errors", since = "2.4.0")
final val Errors = tsr.Errors
// @deprecated("renamed to typesig.reader.SignatureReader", since = "2.4.0")
final val InterfaceReader = tsr.SignatureReader
// @deprecated("renamed to typesig.reader.SignatureReaderMain", since = "2.4.0")
final val InterfaceReaderMain = tsr.SignatureReaderMain
}

View File

@ -1,7 +1,7 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.iface
package com.daml.lf.typesig
import scalaz.std.map._
import scalaz.std.option._
@ -214,7 +214,7 @@ final case class DefTemplate[+Ty](
def getKey: j.Optional[_ <: Ty] = key.toJava
private[iface] def extendWithInterface[OTy >: Ty](
private[typesig] def extendWithInterface[OTy >: Ty](
ifaceName: Ref.TypeConName,
ifc: DefInterface[OTy],
): DefTemplate[OTy] = {
@ -310,7 +310,7 @@ sealed abstract class TemplateChoices[+Ty] extends Product with Serializable {
/** Coerce to [[Resolved]] based on the environment `astInterfaces`, or fail
* with the choices that could not be resolved.
*/
private[iface] def resolveChoices[O >: Ty](
private[typesig] def resolveChoices[O >: Ty](
astInterfaces: PartialFunction[Ref.TypeConName, DefInterface[O]]
): Either[ResolveError[Resolved[O]], Resolved[O]] = this match {
case Unresolved(direct, unresolved) =>
@ -348,14 +348,14 @@ object TemplateChoices {
missingInterfaces: NonEmpty[Set[Ref.TypeConName]],
partialResolution: Partial,
) {
private[iface] def describeError: String =
private[typesig] def describeError: String =
missingInterfaces.mkString(", ")
private[iface] def map[B](f: Partial => B): ResolveError[B] =
private[typesig] def map[B](f: Partial => B): ResolveError[B] =
copy(partialResolution = f(partialResolution))
}
private[iface] final case class Unresolved[+Ty](
private[typesig] final case class Unresolved[+Ty](
directChoices: Map[Ref.ChoiceName, TemplateChoice[Ty]],
unresolvedChoiceSources: NonEmpty[Set[Ref.TypeConName]],
) extends TemplateChoices[Ty] {
@ -368,7 +368,7 @@ object TemplateChoices {
) =
directChoices transform ((_, c) => NonEmpty(Map, (none[Ref.TypeConName], c)))
private[iface] final case class Resolved[+Ty](
private[typesig] final case class Resolved[+Ty](
resolvedChoices: Map[Ref.ChoiceName, NonEmpty[
Map[Option[Ref.TypeConName], TemplateChoice[Ty]]
]]
@ -384,7 +384,8 @@ object TemplateChoices {
// choice type abstracted over the TemplateChoice, for specifying
// aggregation of choices (typically with tags, foldMap, semigroup)
private[iface] type Choices[C] = Map[Ref.ChoiceName, NonEmpty[Map[Option[Ref.TypeConName], C]]]
private[typesig] type Choices[C] =
Map[Ref.ChoiceName, NonEmpty[Map[Option[Ref.TypeConName], C]]]
}
implicit val `TemplateChoices traverse`: Traverse[TemplateChoices] = new Traverse[TemplateChoices]
@ -436,12 +437,12 @@ final case class DefInterface[+Ty](
// Restructure `choices` in the resolved-choices data structure format,
// for aggregation with [[TemplateChoices.Resolved]].
private[iface] def choicesAsResolved[Name](
private[typesig] def choicesAsResolved[Name](
selfName: Name
): Map[Ref.ChoiceName, NonEmpty[Map[Option[Name], TemplateChoice[Ty]]]] =
choices transform ((_, tc) => NonEmpty(Map, some(selfName) -> tc))
private[iface] def resolveRetroImplements[S, OTy >: Ty](selfName: Ref.TypeConName, s: S)(
private[typesig] def resolveRetroImplements[S, OTy >: Ty](selfName: Ref.TypeConName, s: S)(
setTemplate: SetterAt[Ref.TypeConName, S, DefTemplate[OTy]]
): (S, DefInterface[OTy]) = {
def addMySelf(dt: DefTemplate[OTy]) =

View File

@ -0,0 +1,113 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf
package typesig
import com.daml.lf.archive.Dar
import data.Ref, Ref.{Identifier, PackageId}
import scala.collection.immutable.Map
import scalaz.std.tuple._
import scalaz.syntax.functor._
import scalaz.syntax.std.map._
import scalaz.Semigroup
/** The combination of multiple [[PackageSignature]]s, such as from a dar. */
final case class EnvironmentSignature(
metadata: Map[PackageId, PackageMetadata],
typeDecls: Map[Identifier, PackageSignature.TypeDecl],
interfaces: Map[Ref.TypeConName, DefInterface.FWT],
) {
import PackageSignature.TypeDecl
// @deprecated("renamed to interfaces", since = "2.4.0")
def astInterfaces: interfaces.type = interfaces
/** Replace all resolvable `inheritedChoices` in `typeDecls` with concrete
* choices copied from `astInterfaces`. If a template has any missing choices,
* none of its inherited choices are resolved. Idempotent.
*
* This is not distributive because we delay resolution, because successful
* lookup can require the presence of another DAR. In other words,
*
* {{{
* l.resolveChoices |+| r.resolveChoices
* // is possibly less well-resolved than
* (l |+| r).resolveChoices
* }}}
*
* Therefore there is no reason to bother with `resolveChoices` until you've
* accumulated an `EnvironmentSignature` representing the whole environment.
*/
def resolveChoices: EnvironmentSignature =
copy(typeDecls = typeDecls.transform { (_, it) =>
it match {
case itpl: TypeDecl.Template =>
val errOrTpl2 = itpl.template resolveChoices interfaces
errOrTpl2.fold(_ => itpl, tpl2 => itpl.copy(template = tpl2))
case z: TypeDecl.Normal => z
}
})
def resolveRetroImplements: EnvironmentSignature = {
import PackageSignature.findTemplate
val (newTypeDecls, newInterfaces) = interfaces.foldLeft((typeDecls, interfaces)) {
case ((typeDecls, interfaces), (ifTc, defIf)) =>
defIf
.resolveRetroImplements(ifTc, typeDecls) { case (typeDecls, tplName) =>
findTemplate(typeDecls, tplName) map { itt => f =>
typeDecls.updated(tplName, itt.copy(template = f(itt.template)))
}
}
.map(defIf => interfaces.updated(ifTc, defIf))
}
copy(typeDecls = newTypeDecls, interfaces = newInterfaces)
}
def resolveInterfaceViewType(tcn: Ref.TypeConName): Option[DefInterface.ViewTypeFWT] =
typeDecls get tcn flatMap (_.asInterfaceViewType)
}
object EnvironmentSignature {
// @deprecated("renamed to fromPackageSignatures", since = "2.4.0")
def fromReaderInterfaces(i: PackageSignature, o: PackageSignature*): EnvironmentSignature =
fromPackageSignatures(i, o: _*)
def fromPackageSignatures(i: PackageSignature, o: PackageSignature*): EnvironmentSignature =
fromPackageSignatures(i +: o)
// @deprecated("renamed to fromPackageSignatures", since = "2.4.0")
def fromReaderInterfaces(dar: Dar[PackageSignature]): EnvironmentSignature =
fromPackageSignatures(dar)
def fromPackageSignatures(dar: Dar[PackageSignature]): EnvironmentSignature =
fromPackageSignatures(dar.main, dar.dependencies: _*)
// @deprecated("renamed to fromPackageSignatures", since = "2.4.0")
def fromReaderInterfaces(all: Iterable[PackageSignature]): EnvironmentSignature =
fromPackageSignatures(all)
def fromPackageSignatures(all: Iterable[PackageSignature]): EnvironmentSignature = {
val typeDecls = all.iterator.flatMap { case PackageSignature(packageId, _, typeDecls, _) =>
typeDecls mapKeys (Identifier(packageId, _))
}.toMap
val astInterfaces = all.iterator.flatMap {
case PackageSignature(packageId, _, _, astInterfaces) =>
astInterfaces mapKeys (Identifier(packageId, _))
}.toMap
val metadata = all.iterator.flatMap { case PackageSignature(packageId, metadata, _, _) =>
metadata.iterator.map(md => packageId -> md)
}.toMap
EnvironmentSignature(metadata, typeDecls, astInterfaces)
}
implicit val environmentInterfaceSemigroup: Semigroup[EnvironmentSignature] = Semigroup instance {
(f1, f2) =>
EnvironmentSignature(
f1.metadata ++ f2.metadata,
f1.typeDecls ++ f2.typeDecls,
f1.interfaces ++ f2.interfaces,
)
}
}

View File

@ -1,13 +1,13 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.iface
package com.daml.lf.typesig
import java.{util => j}
import com.daml.lf.data.ImmArray.ImmArraySeq
import com.daml.lf.data.Ref, Ref.{Identifier, PackageId, PackageName, PackageVersion, QualifiedName}
import com.daml.lf.iface.reader.Errors
import reader.Errors
import com.daml.daml_lf_dev.DamlLf
import com.daml.lf.archive.ArchivePayload
@ -19,43 +19,6 @@ import scalaz.syntax.std.boolean._
import scala.collection.immutable.{Map, SeqOps}
import scala.jdk.CollectionConverters._
sealed abstract class InterfaceType extends Product with Serializable {
def `type`: DefDataType.FWT
def fold[Z](normal: DefDataType.FWT => Z, template: (Record.FWT, DefTemplate[Type]) => Z): Z =
this match {
case InterfaceType.Normal(typ) => normal(typ)
case InterfaceType.Template(typ, tpl) => template(typ, tpl)
}
/** Alias for `type`. */
def getType: DefDataType.FWT = `type`
def getTemplate: j.Optional[_ <: DefTemplate.FWT] =
fold(
{ _ =>
j.Optional.empty()
},
{ (_, tpl) =>
j.Optional.of(tpl)
},
)
private[iface] def asInterfaceViewType: Option[DefInterface.ViewTypeFWT] = this match {
case InterfaceType.Template(r, _) => Some(r)
case InterfaceType.Normal(DefDataType(_, dt)) =>
dt match {
case r @ Record(_) => Some(r)
case Variant(_) | Enum(_) => None
}
}
}
object InterfaceType {
final case class Normal(`type`: DefDataType.FWT) extends InterfaceType
final case class Template(rec: Record.FWT, template: DefTemplate[Type]) extends InterfaceType {
def `type`: DefDataType.FWT = DefDataType(ImmArraySeq.empty, rec)
}
}
// Duplicate of the one in com.daml.lf.language to separate Ast and Iface
final case class PackageMetadata(
name: PackageName,
@ -67,25 +30,32 @@ final case class PackageMetadata(
* with separate package IDs and overlapping [[QualifiedName]]s; for a
* dar use [[EnvironmentInterface]] instead.
*/
final case class Interface(
final case class PackageSignature(
packageId: PackageId,
metadata: Option[PackageMetadata],
typeDecls: Map[QualifiedName, InterfaceType],
astInterfaces: Map[QualifiedName, DefInterface.FWT],
typeDecls: Map[QualifiedName, PackageSignature.TypeDecl],
@deprecatedName("astInterfaces", "2.4.0") interfaces: Map[QualifiedName, DefInterface.FWT],
) {
def getTypeDecls: j.Map[QualifiedName, InterfaceType] = typeDecls.asJava
def getAstInterfaces: j.Map[QualifiedName, DefInterface.FWT] = astInterfaces.asJava
import PackageSignature.TypeDecl
// @deprecated("renamed to interfaces", since = "2.4.0")
def astInterfaces: interfaces.type = interfaces
// @deprecated("renamed to getInterfaces", since = "2.4.0")
def getAstInterfaces: j.Map[QualifiedName, DefInterface.FWT] = getInterfaces
def getTypeDecls: j.Map[QualifiedName, TypeDecl] = typeDecls.asJava
def getInterfaces: j.Map[QualifiedName, DefInterface.FWT] = interfaces.asJava
private def resolveChoices(
findInterface: PartialFunction[Ref.TypeConName, DefInterface.FWT],
failIfUnresolvedChoicesLeft: Boolean,
): Interface = {
): PackageSignature = {
val outside = findInterface.lift
def findIface(id: Identifier) =
if (id.packageId == packageId) astInterfaces get id.qualifiedName
if (id.packageId == packageId) interfaces get id.qualifiedName
else outside(id)
val tplFindIface = Function unlift findIface
def transformTemplate(ift: InterfaceType.Template) = {
def transformTemplate(ift: TypeDecl.Template) = {
val errOrItt = (ift.template resolveChoices tplFindIface)
.bimap(
_.map(partial => ift.copy(template = partial)),
@ -103,19 +73,19 @@ final case class Interface(
}
copy(typeDecls = typeDecls transform { (_, ift) =>
ift match {
case ift: InterfaceType.Template => transformTemplate(ift)
case n: InterfaceType.Normal => n
case ift: TypeDecl.Template => transformTemplate(ift)
case n: TypeDecl.Normal => n
}
})
}
/** Like [[EnvironmentInterface#resolveChoices]], but permits incremental
/** Like [[EnvironmentSignature#resolveChoices]], but permits incremental
* resolution of newly-loaded interfaces, such as json-api does.
*
* {{{
* // suppose
* i: Interface; ei: EnvironmentInterface
* val eidelta = EnvironmentInterface.fromReaderInterfaces(i)
* i: PackageSignature; ei: EnvironmentSignature
* val eidelta = EnvironmentSignature.fromReaderInterfaces(i)
* // such that
* ei |+| eidelta
* // contains the whole environment of i. Then
@ -126,7 +96,7 @@ final case class Interface(
*/
def resolveChoicesAndFailOnUnresolvableChoices(
findInterface: PartialFunction[Ref.TypeConName, DefInterface.FWT]
): Interface = resolveChoices(findInterface, failIfUnresolvedChoicesLeft = true)
): PackageSignature = resolveChoices(findInterface, failIfUnresolvedChoicesLeft = true)
/** Like resolveChoicesAndFailOnUnresolvableChoices, but simply discard
* unresolved choices from the structure. Not wise to use on a receiver
@ -134,7 +104,7 @@ final case class Interface(
*/
def resolveChoicesAndIgnoreUnresolvedChoices(
findInterface: PartialFunction[Ref.TypeConName, DefInterface.FWT]
): Interface = resolveChoices(findInterface, failIfUnresolvedChoicesLeft = false)
): PackageSignature = resolveChoices(findInterface, failIfUnresolvedChoicesLeft = false)
/** Update internal templates, as well as external templates via `setTemplates`,
* with retroactive interface implementations.
@ -144,55 +114,93 @@ final case class Interface(
*/
private def resolveRetroImplements[S](
s: S
)(setTemplate: SetterAt[Ref.TypeConName, S, DefTemplate.FWT]): (S, Interface) = {
type SandTpls = (S, Map[QualifiedName, InterfaceType.Template])
)(setTemplate: SetterAt[Ref.TypeConName, S, DefTemplate.FWT]): (S, PackageSignature) = {
type SandTpls = (S, Map[QualifiedName, TypeDecl.Template])
def setTpl(
sm: SandTpls,
tcn: Ref.TypeConName,
): Option[(DefTemplate.FWT => DefTemplate.FWT) => SandTpls] = {
import Interface.findTemplate
import PackageSignature.findTemplate
val (s, tplsM) = sm
if (tcn.packageId == packageId)
findTemplate(tplsM, tcn.qualifiedName).map { case itt @ InterfaceType.Template(_, dt) =>
findTemplate(tplsM, tcn.qualifiedName).map { case itt @ TypeDecl.Template(_, dt) =>
f => (s, tplsM.updated(tcn.qualifiedName, itt.copy(template = f(dt))))
}
else setTemplate(s, tcn) map (_ andThen ((_, tplsM)))
}
val ((sEnd, newTpls), newIfcs) = astInterfaces.foldLeft(
val ((sEnd, newTpls), newIfcs) = interfaces.foldLeft(
((s, Map.empty): SandTpls, Map.empty[QualifiedName, DefInterface.FWT])
) { case ((s, astIfs), (ifcName, astIf)) =>
astIf
.resolveRetroImplements(Ref.TypeConName(packageId, ifcName), s)(setTpl)
.rightMap(newIf => astIfs.updated(ifcName, newIf))
}
(sEnd, copy(typeDecls = typeDecls ++ newTpls, astInterfaces = newIfcs))
(sEnd, copy(typeDecls = typeDecls ++ newTpls, interfaces = newIfcs))
}
private def resolveInterfaceViewType(n: Ref.QualifiedName): Option[Record.FWT] =
typeDecls get n flatMap (_.asInterfaceViewType)
}
object Interface {
object PackageSignature {
import Errors._
import reader.InterfaceReader._
import reader.SignatureReader._
def read(lf: DamlLf.Archive): (Errors[ErrorLoc, InvalidDataTypeDefinition], Interface) =
readInterface(lf)
sealed abstract class TypeDecl extends Product with Serializable {
def `type`: DefDataType.FWT
def read(lf: ArchivePayload): (Errors[ErrorLoc, InvalidDataTypeDefinition], Interface) =
readInterface(lf)
def fold[Z](normal: DefDataType.FWT => Z, template: (Record.FWT, DefTemplate[Type]) => Z): Z =
this match {
case TypeDecl.Normal(typ) => normal(typ)
case TypeDecl.Template(typ, tpl) => template(typ, tpl)
}
private[iface] def findTemplate[K](
m: Map[K, InterfaceType],
/** Alias for `type`. */
def getType: DefDataType.FWT = `type`
def getTemplate: j.Optional[_ <: DefTemplate.FWT] =
fold(
{ _ =>
j.Optional.empty()
},
{ (_, tpl) =>
j.Optional.of(tpl)
},
)
private[typesig] def asInterfaceViewType: Option[DefInterface.ViewTypeFWT] = this match {
case TypeDecl.Template(r, _) => Some(r)
case TypeDecl.Normal(DefDataType(_, dt)) =>
dt match {
case r @ Record(_) => Some(r)
case Variant(_) | Enum(_) => None
}
}
}
object TypeDecl {
final case class Normal(`type`: DefDataType.FWT) extends TypeDecl
final case class Template(rec: Record.FWT, template: DefTemplate[Type]) extends TypeDecl {
def `type`: DefDataType.FWT = DefDataType(ImmArraySeq.empty, rec)
}
}
def read(lf: DamlLf.Archive): (Errors[ErrorLoc, InvalidDataTypeDefinition], PackageSignature) =
readPackageSignature(lf)
def read(lf: ArchivePayload): (Errors[ErrorLoc, InvalidDataTypeDefinition], PackageSignature) =
readPackageSignature(lf)
private[typesig] def findTemplate[K](
m: Map[K, TypeDecl],
k: K,
): Option[InterfaceType.Template] =
m get k collect { case itt: InterfaceType.Template => itt }
): Option[TypeDecl.Template] =
m get k collect { case itt: TypeDecl.Template => itt }
// Given a lookup function for package state setters, produce a lookup function
// for setters on specific templates in that set of packages.
private[this] def setPackageTemplates[S](
findPackage: GetterSetterAt[PackageId, S, Interface]
findPackage: GetterSetterAt[PackageId, S, PackageSignature]
): SetterAt[Ref.TypeConName, S, DefTemplate.FWT] = {
def go(s: S, tcn: Ref.TypeConName): Option[(DefTemplate.FWT => DefTemplate.FWT) => S] = for {
foundPkg <- findPackage(s, tcn.packageId)
@ -208,44 +216,50 @@ object Interface {
}
/** Extend the set of interfaces represented by `s` and `findPackage` with
* `newInterfaces`. Produce the resulting `S` and a replacement copy of
* `newInterfaces` with templates and interfaces therein resolved.
* `newSignatures`. Produce the resulting `S` and a replacement copy of
* `newSignatures` with templates and interfaces therein resolved.
*
* Does not search members of `s` for fresh interfaces.
*/
def resolveRetroImplements[S, CC[B] <: Seq[B] with SeqOps[B, CC, CC[B]]](
s: S,
newInterfaces: CC[Interface],
@deprecatedName("newInterfaces", "2.4.0") newSignatures: CC[PackageSignature],
)(
findPackage: GetterSetterAt[PackageId, S, Interface]
): (S, CC[Interface]) = {
type St = (S, CC[Interface])
val findTpl = setPackageTemplates[St] { case ((s, newInterfaces), pkgId) =>
findPackage(s, pkgId).map(_.rightMap(_ andThen ((_, newInterfaces)))).orElse {
val ix = newInterfaces indexWhere (_.packageId == pkgId)
(ix >= 0) option ((newInterfaces(ix), newSig => (s, newInterfaces.updated(ix, newSig))))
findPackage: GetterSetterAt[PackageId, S, PackageSignature]
): (S, CC[PackageSignature]) = {
type St = (S, CC[PackageSignature])
val findTpl = setPackageTemplates[St] { case ((s, newSignatures), pkgId) =>
findPackage(s, pkgId).map(_.rightMap(_ andThen ((_, newSignatures)))).orElse {
val ix = newSignatures indexWhere (_.packageId == pkgId)
(ix >= 0) option ((newSignatures(ix), newSig => (s, newSignatures.updated(ix, newSig))))
}
}
(0 until newInterfaces.size).foldLeft((s, newInterfaces)) {
case (st @ (_, newInterfaces), ifcK) =>
val ((s2, newInterfaces2), newAtIfcK) =
newInterfaces(ifcK).resolveRetroImplements(st)(findTpl)
// the tricky part here: newInterfaces2 is guaranteed not to have altered
(0 until newSignatures.size).foldLeft((s, newSignatures)) {
case (st @ (_, newSignatures), ifcK) =>
val ((s2, newSignatures2), newAtIfcK) =
newSignatures(ifcK).resolveRetroImplements(st)(findTpl)
// the tricky part here: newSignatures2 is guaranteed not to have altered
// the value at ifcK, and to have made all "self" changes in newAtIfcK.
// So there is no conflict, we can discard the value in the seq
(s2, newInterfaces2.updated(ifcK, newAtIfcK))
(s2, newSignatures2.updated(ifcK, newAtIfcK))
}
}
/** An argument for `Interface#resolveChoices` given a package database,
// @deprecated("renamed to findInterface", since = "2.4.0")
def findAstInterface(
findPackage: PartialFunction[PackageId, PackageSignature]
): PartialFunction[Ref.TypeConName, DefInterface.FWT] =
findInterface(findPackage)
/** An argument for [[PackageSignature#resolveChoices]] given a package database,
* such as json-api's `LedgerReader.PackageStore`.
*/
def findAstInterface(
findPackage: PartialFunction[PackageId, Interface]
def findInterface(
findPackage: PartialFunction[PackageId, PackageSignature]
): PartialFunction[Ref.TypeConName, DefInterface.FWT] = {
val pkg = findPackage.lift
def go(id: Identifier) = pkg(id.packageId).flatMap(_.astInterfaces get id.qualifiedName)
def go(id: Identifier) = pkg(id.packageId).flatMap(_.interfaces get id.qualifiedName)
Function unlift go
}
@ -254,10 +268,13 @@ object Interface {
* The function will not match if the definition is missing or is not a record.
*/
def resolveInterfaceViewType(
findInterface: PartialFunction[PackageId, Interface]
@deprecatedName("findInterface", "2.4.0") findPackage: PartialFunction[
PackageId,
PackageSignature,
]
): PartialFunction[Ref.TypeConName, DefInterface.ViewTypeFWT] =
Function unlift { tcn =>
findInterface.lift(tcn.packageId) flatMap (_ resolveInterfaceViewType tcn.qualifiedName)
findPackage.lift(tcn.packageId) flatMap (_ resolveInterfaceViewType tcn.qualifiedName)
}
}

View File

@ -1,7 +1,7 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.iface
package com.daml.lf.typesig
import java.{util => j}

View File

@ -6,15 +6,15 @@ package com.daml.lf
import data.Ref
// Types to be used internally
package object iface {
package object typesig {
type FieldWithType = (Ref.Name, Type)
private[iface] type GetterSetterAt[-I, S, A] = (S, I) => Option[(A, A => S)]
private[typesig] type GetterSetterAt[-I, S, A] = (S, I) => Option[(A, A => S)]
private[iface] type SetterAt[-I, S, A] = (S, I) => Option[(A => A) => S]
private[typesig] type SetterAt[-I, S, A] = (S, I) => Option[(A => A) => S]
private[iface] def lfprintln(
private[typesig] def lfprintln(
@deprecated("shut up unused arguments warning", "") s: => String
): Unit = ()
}

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf
package iface
package typesig
package reader
import com.daml.lf.data.Ref
@ -24,7 +24,7 @@ object DamlLfArchiveReader {
): String \/ (Ref.PackageId, Ast.Package) =
fromEither(archive.Reader.readArchivePayload(packageId, lf)) flatMap readPackage
private[iface] def readPackage(
private[typesig] def readPackage(
payLoad: archive.ArchivePayload
): String \/ (Ref.PackageId, Ast.Package) =
fromEither(archive.Decode.decodeArchivePayload(payLoad, onlySerializableDataDefs = true))

View File

@ -1,7 +1,7 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.iface
package com.daml.lf.typesig
package reader
import com.daml.lf.data.Ref.{DottedName, Name}

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf
package iface
package typesig
package reader
import com.daml.daml_lf_dev.DamlLf
@ -21,12 +21,18 @@ import com.daml.nonempty.NonEmpty
import scala.collection.immutable.Map
object InterfaceReader {
object SignatureReader {
import Errors._
import PackageSignature.TypeDecl
sealed abstract class InterfaceReaderError extends Product with Serializable
final case class UnserializableDataType(error: String) extends InterfaceReaderError
final case class InvalidDataTypeDefinition(error: String) extends InterfaceReaderError
// @deprecated("renamed to SignatureReader.Error", since = "2.4.0")
type InterfaceReaderError = Error
// @deprecated("renamed to SignatureReader.Error", since = "2.4.0")
final val InterfaceReaderError = Error
sealed abstract class Error extends Product with Serializable
final case class UnserializableDataType(error: String) extends Error
final case class InvalidDataTypeDefinition(error: String) extends Error
private def errorMessage(ctx: QualifiedName, reason: String): String =
s"Invalid data definition: $ctx, reason: $reason"
@ -34,20 +40,20 @@ object InterfaceReader {
private def invalidDataTypeDefinition[Bot](
ctx: QualifiedName,
reason: String,
): InterfaceReaderError \/ Bot = -\/(InvalidDataTypeDefinition(errorMessage(ctx, reason)))
): Error \/ Bot = -\/(InvalidDataTypeDefinition(errorMessage(ctx, reason)))
private def unserializableDataType[Bot](
ctx: QualifiedName,
reason: String,
): InterfaceReaderError \/ Bot = -\/(UnserializableDataType(errorMessage(ctx, reason)))
): Error \/ Bot = -\/(UnserializableDataType(errorMessage(ctx, reason)))
object InterfaceReaderError {
type Tree = Errors[ErrorLoc, InterfaceReaderError]
object Error {
type Tree = Errors[ErrorLoc, Error]
implicit def `IRE semigroup`: Semigroup[InterfaceReaderError] =
implicit def `IRE semigroup`: Semigroup[Error] =
Semigroup.firstSemigroup
def treeReport(errors: Errors[ErrorLoc, InterfaceReader.InvalidDataTypeDefinition]): Cord =
def treeReport(errors: Errors[ErrorLoc, SignatureReader.InvalidDataTypeDefinition]): Cord =
stringReport(errors)(
_.fold(prop => Cord(s".${prop.name}"), ixName => Cord(s"'$ixName'")),
e => Cord(e.error),
@ -55,12 +61,12 @@ object InterfaceReader {
}
private[reader] final case class State(
typeDecls: Map[QualifiedName, iface.InterfaceType] = Map.empty,
astInterfaces: Map[QualifiedName, iface.DefInterface.FWT] = Map.empty,
errors: InterfaceReaderError.Tree = mzero[InterfaceReaderError.Tree],
typeDecls: Map[QualifiedName, TypeDecl] = Map.empty,
interfaces: Map[QualifiedName, typesig.DefInterface.FWT] = Map.empty,
errors: Error.Tree = mzero[Error.Tree],
) {
def asOut(packageId: PackageId, metadata: Option[PackageMetadata]): iface.Interface =
iface.Interface(packageId, metadata, typeDecls, astInterfaces)
def asOut(packageId: PackageId, metadata: Option[PackageMetadata]): typesig.PackageSignature =
typesig.PackageSignature(packageId, metadata, typeDecls, interfaces)
}
private[reader] object State {
@ -69,36 +75,61 @@ object InterfaceReader {
(l, r) =>
State(
l.typeDecls ++ r.typeDecls,
l.astInterfaces ++ r.astInterfaces,
l.interfaces ++ r.interfaces,
l.errors |+| r.errors,
),
State(),
)
}
// @deprecated("renamed to readPackageSignature", since = "2.4.0")
def readInterface(
lf: DamlLf.Archive
): (Errors[ErrorLoc, InvalidDataTypeDefinition], iface.Interface) =
readInterface(() => DamlLfArchiveReader.readPackage(lf))
): (Errors[ErrorLoc, InvalidDataTypeDefinition], typesig.PackageSignature) =
readPackageSignature(lf)
// @deprecated("renamed to readPackageSignature", since = "2.4.0")
def readInterface(
packageId: Ref.PackageId,
damlLf: DamlLf.ArchivePayload,
): (Errors[ErrorLoc, InvalidDataTypeDefinition], iface.Interface) =
readInterface(() => DamlLfArchiveReader.readPackage(packageId, damlLf))
): (Errors[ErrorLoc, InvalidDataTypeDefinition], typesig.PackageSignature) =
readPackageSignature(packageId, damlLf)
// @deprecated("renamed to readPackageSignature", since = "2.4.0")
def readInterface(
payload: ArchivePayload
): (Errors[ErrorLoc, InvalidDataTypeDefinition], iface.Interface) =
readInterface(() => DamlLfArchiveReader.readPackage(payload))
): (Errors[ErrorLoc, InvalidDataTypeDefinition], typesig.PackageSignature) =
readPackageSignature(payload)
def readPackageSignature(
lf: DamlLf.Archive
): (Errors[ErrorLoc, InvalidDataTypeDefinition], typesig.PackageSignature) =
readPackageSignature(() => DamlLfArchiveReader.readPackage(lf))
def readPackageSignature(
packageId: Ref.PackageId,
damlLf: DamlLf.ArchivePayload,
): (Errors[ErrorLoc, InvalidDataTypeDefinition], typesig.PackageSignature) =
readPackageSignature(() => DamlLfArchiveReader.readPackage(packageId, damlLf))
def readPackageSignature(
payload: ArchivePayload
): (Errors[ErrorLoc, InvalidDataTypeDefinition], typesig.PackageSignature) =
readPackageSignature(() => DamlLfArchiveReader.readPackage(payload))
private val dummyPkgId = PackageId.assertFromString("-dummyPkg-")
private val dummyInterface = iface.Interface(dummyPkgId, None, Map.empty, Map.empty)
private val dummyInterface = typesig.PackageSignature(dummyPkgId, None, Map.empty, Map.empty)
// @deprecated("renamed to readPackageSignature", since = "2.4.0")
def readInterface(
f: () => String \/ (PackageId, Ast.Package)
): (Errors[ErrorLoc, InvalidDataTypeDefinition], iface.Interface) =
): (Errors[ErrorLoc, InvalidDataTypeDefinition], typesig.PackageSignature) =
readPackageSignature(f)
def readPackageSignature(
f: () => String \/ (PackageId, Ast.Package)
): (Errors[ErrorLoc, InvalidDataTypeDefinition], typesig.PackageSignature) =
f() match {
case -\/(e) =>
(point(InvalidDataTypeDefinition(e)), dummyInterface)
@ -121,7 +152,7 @@ object InterfaceReader {
PackageMetadata(metadata.name, metadata.version)
private def filterOutUnserializableErrors(
es: InterfaceReaderError.Tree
es: Error.Tree
): Errors[ErrorLoc, InvalidDataTypeDefinition] =
es.collectAndPrune { case x: InvalidDataTypeDefinition => x }
@ -131,7 +162,7 @@ object InterfaceReader {
val fullName = QualifiedName(module.name, name)
val tyVars: ImmArraySeq[Ast.TypeVarName] = params.map(_._1).toSeq
val result: InterfaceReaderError \/ Option[(QualifiedName, iface.InterfaceType)] =
val result: Error \/ Option[(QualifiedName, TypeDecl)] =
dataType match {
case dfn: Ast.DataRecord =>
val it = module.templates.get(name) match {
@ -152,26 +183,26 @@ object InterfaceReader {
.partitionMap(identity)
val ddts = dataTypes.view.collect { case Some(x) => x }.toMap
val (ierrors, astIfs) = module.interfaces.partitionMap { case (name, interface) =>
val (ierrors, astIfs) = module.interfaces.partitionMap { case (name, astIf) =>
val fullName = QualifiedName(module.name, name)
val result = astInterface(fullName, interface)
val result = interface(fullName, astIf)
locate(Symbol("name"), rootErrOf[ErrorLoc](result)).toEither
}
import scalaz.std.iterable._
State(typeDecls = ddts, astInterfaces = astIfs.toMap, errors = (derrors ++ ierrors).suml)
State(typeDecls = ddts, interfaces = astIfs.toMap, errors = (derrors ++ ierrors).suml)
}
private[reader] def record[T >: iface.InterfaceType.Normal](
private[reader] def record[T >: TypeDecl.Normal](
name: QualifiedName,
tyVars: ImmArraySeq[Ast.TypeVarName],
record: Ast.DataRecord,
) =
for {
fields <- fieldsOrCons(name, record.fields)
} yield name -> (iface.InterfaceType.Normal(DefDataType(tyVars, Record(fields))): T)
} yield name -> (TypeDecl.Normal(DefDataType(tyVars, Record(fields))): T)
private[reader] def template[T >: iface.InterfaceType.Template](
private[reader] def template[T >: TypeDecl.Template](
name: QualifiedName,
record: Ast.DataRecord,
dfn: Ast.Template,
@ -180,7 +211,7 @@ object InterfaceReader {
fields <- fieldsOrCons(name, record.fields)
choices <- dfn.choices traverse (visitChoice(name, _))
key <- dfn.key traverse (k => toIfaceType(name, k.typ))
} yield name -> (iface.InterfaceType.Template(
} yield name -> (TypeDecl.Template(
Record(fields),
DefTemplate(visitChoices(choices, dfn.implements), key, dfn.implements.keys),
): T)
@ -198,7 +229,7 @@ object InterfaceReader {
private def visitChoice(
ctx: QualifiedName,
choice: Ast.TemplateChoice,
): InterfaceReaderError \/ TemplateChoice[Type] =
): Error \/ TemplateChoice[Type] =
for {
tParam <- toIfaceType(ctx, choice.argBinder._2)
tReturn <- toIfaceType(ctx, choice.returnType)
@ -208,24 +239,24 @@ object InterfaceReader {
returnType = tReturn,
)
private[reader] def variant[T >: iface.InterfaceType.Normal](
private[reader] def variant[T >: TypeDecl.Normal](
name: QualifiedName,
tyVars: ImmArraySeq[Ast.TypeVarName],
variant: Ast.DataVariant,
) = {
for {
cons <- fieldsOrCons(name, variant.variants)
} yield name -> (iface.InterfaceType.Normal(DefDataType(tyVars, Variant(cons))): T)
} yield name -> (TypeDecl.Normal(DefDataType(tyVars, Variant(cons))): T)
}
private[reader] def enumeration[T >: iface.InterfaceType.Normal](
private[reader] def enumeration[T >: TypeDecl.Normal](
name: QualifiedName,
tyVars: ImmArraySeq[Ast.TypeVarName],
enumeration: Ast.DataEnum,
): InterfaceReaderError \/ (QualifiedName, T) =
): Error \/ (QualifiedName, T) =
if (tyVars.isEmpty)
\/-(
name -> iface.InterfaceType.Normal(
name -> TypeDecl.Normal(
DefDataType(ImmArraySeq.empty, Enum(enumeration.constructors.toSeq))
)
)
@ -235,15 +266,15 @@ object InterfaceReader {
private[reader] def fieldsOrCons(
ctx: QualifiedName,
fields: ImmArray[(Ref.Name, Ast.Type)],
): InterfaceReaderError \/ ImmArraySeq[(Ref.Name, Type)] =
): Error \/ ImmArraySeq[(Ref.Name, Type)] =
fields.toSeq traverse { case (fieldName, typ) =>
toIfaceType(ctx, typ).map(x => fieldName -> x)
}
private[this] def astInterface(
private[this] def interface(
name: QualifiedName,
astIf: Ast.DefInterface,
): InterfaceReaderError \/ (QualifiedName, DefInterface.FWT) = for {
): Error \/ (QualifiedName, DefInterface.FWT) = for {
choices <- astIf.choices.traverse(visitChoice(name, _))
rawViewType <- toIfaceType(name, astIf.view)
viewType <- rawViewType match {
@ -256,13 +287,13 @@ object InterfaceReader {
)
}
// TODO #14081 pass actual retroactive implements instead of empty
} yield name -> iface.DefInterface(choices, Set.empty, viewType)
} yield name -> typesig.DefInterface(choices, Set.empty, viewType)
private[lf] def toIfaceType(
ctx: QualifiedName,
a: Ast.Type,
args: FrontStack[Type] = FrontStack.empty,
): InterfaceReaderError \/ Type =
): Error \/ Type =
a match {
case Ast.TVar(x) =>
if (args.isEmpty)
@ -287,8 +318,8 @@ object InterfaceReader {
ctx: QualifiedName,
a: Ast.BuiltinType,
args: ImmArraySeq[Type],
): InterfaceReaderError \/ T = {
type Eo[A] = InterfaceReaderError \/ A
): Error \/ T = {
type Eo[A] = Error \/ A
for {
ab <- (a match {
case Ast.BTUnit => \/-((0, PrimType.Unit))

View File

@ -1,14 +1,14 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.iface.reader
package com.daml.lf.typesig.reader
import java.io.BufferedInputStream
import java.nio.file.Files
import com.daml.daml_lf_dev.DamlLf
object InterfaceReaderMain extends App {
object SignatureReaderMain extends App {
val lfFile = new java.io.File(args.apply(0))
@ -16,7 +16,7 @@ object InterfaceReaderMain extends App {
try {
val bis = new BufferedInputStream(is)
val archive = DamlLf.Archive.parser().parseFrom(bis)
val out = InterfaceReader.readInterface(archive)
val out = SignatureReader.readPackageSignature(archive)
println(s"out: $out")
} finally {
is.close()

View File

@ -1,7 +1,7 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.iface
package com.daml.lf.typesig
import com.daml.nonempty.NonEmpty
import com.daml.scalatest.WordSpecCheckLaws

View File

@ -1,7 +1,7 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.iface
package com.daml.lf.typesig
import com.daml.lf.data.ImmArray.ImmArraySeq
import com.daml.lf.data.Ref.{Identifier, PackageId, QualifiedName}

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf
package iface
package typesig
package reader
import com.daml.bazeltools.BazelRunfiles.requiredResource
@ -20,7 +20,8 @@ import scalaz.syntax.functor._
import scala.language.implicitConversions
class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
class SignatureReaderSpec extends AnyWordSpec with Matchers with Inside {
import PackageSignature.TypeDecl
private def dnfs(args: String*): Ref.DottedName = Ref.DottedName.assertFromSegments(args)
private val moduleName: Ref.ModuleName = dnfs("Main")
@ -36,11 +37,11 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
cons = Ast.DataVariant(ImmArray(varField("Call", "call"), varField("Put", "put"))),
)
val actual = InterfaceReader.foldModule(wrappInModule(dataName, variantDataType))
val actual = SignatureReader.foldModule(wrappInModule(dataName, variantDataType))
val expectedResult = Map(
qualifiedName ->
iface.InterfaceType.Normal(
TypeDecl.Normal(
DefDataType(
ImmArray[Ref.Name]("call", "put").toSeq,
Variant(ImmArray(name("Call") -> TypeVar("call"), name("Put") -> TypeVar("put")).toSeq),
@ -78,10 +79,10 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
)
val actual =
InterfaceReader.foldModule(wrappInModule(dnfs("NameClashRecordVariant"), variantDataType))
SignatureReader.foldModule(wrappInModule(dnfs("NameClashRecordVariant"), variantDataType))
val expectedResult = Map(
Ref.QualifiedName(moduleName, dnfs("NameClashRecordVariant")) ->
iface.InterfaceType.Normal(
TypeDecl.Normal(
DefDataType(
ImmArraySeq.Empty,
Variant(
@ -116,11 +117,11 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
),
)
val actual = InterfaceReader.foldModule(wrappInModule(dnfs("Record"), dataType))
val actual = SignatureReader.foldModule(wrappInModule(dnfs("Record"), dataType))
val expectedResult = Map(
Ref.QualifiedName(moduleName, dnfs("Record")) ->
iface.InterfaceType.Normal(
TypeDecl.Normal(
DefDataType(
ImmArraySeq.Empty,
Record(
@ -148,10 +149,10 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
),
)
val actual = InterfaceReader.foldModule(wrappInModule(dnfs("MapRecord"), dataType))
val actual = SignatureReader.foldModule(wrappInModule(dnfs("MapRecord"), dataType))
val expectedResult = Map(
Ref.QualifiedName(moduleName, dnfs("MapRecord")) ->
iface.InterfaceType.Normal(
TypeDecl.Normal(
DefDataType(
ImmArraySeq.Empty,
Record(
@ -181,8 +182,11 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
val name = Ref.PackageName.assertFromString("my-package")
val version = Ref.PackageVersion.assertFromString("1.2.3")
val present = pkg(Some(Ast.PackageMetadata(name, version)))
InterfaceReader.readInterface(() => \/-((packageId, notPresent)))._2.metadata shouldBe None
InterfaceReader.readInterface(() => \/-((packageId, present)))._2.metadata shouldBe Some(
SignatureReader
.readPackageSignature(() => \/-((packageId, notPresent)))
._2
.metadata shouldBe None
SignatureReader.readPackageSignature(() => \/-((packageId, present)))._2.metadata shouldBe Some(
PackageMetadata(name, version)
)
}
@ -191,16 +195,16 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
import archive.DarReader.readArchiveFromFile
lazy val itp = {
val file = requiredResource("daml-lf/interface/InterfaceTestPackage.dar")
val file = requiredResource("daml-lf/api-type-signature/InterfaceTestPackage.dar")
inside(readArchiveFromFile(file)) { case Right(dar) =>
dar.map { payload =>
val (errors, ii) = iface.Interface.read(payload)
val (errors, ii) = typesig.PackageSignature.read(payload)
errors should ===(Errors.zeroErrors)
ii
}
}
}
lazy val itpEI = EnvironmentInterface.fromReaderInterfaces(itp).resolveChoices
lazy val itpES = EnvironmentSignature.fromPackageSignatures(itp).resolveChoices
"load without errors" in {
itp shouldBe itp
@ -219,7 +223,7 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
import itp.main.{packageId => itpPid}
"exclude interface choices with template choices" in {
inside(itp.main.typeDecls get Foo) { case Some(InterfaceType.Template(_, tpl)) =>
inside(itp.main.typeDecls get Foo) { case Some(TypeDecl.Template(_, tpl)) =>
tpl.tChoices.directChoices.keySet should ===(Set("Bar", "Archive"))
}
}
@ -227,7 +231,7 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
"include interface choices in separate inheritedChoices" in {
inside(itp.main.typeDecls get Foo) {
case Some(
InterfaceType.Template(_, DefTemplate(TemplateChoices.Unresolved(_, inherited), _, _))
TypeDecl.Template(_, DefTemplate(TemplateChoices.Unresolved(_, inherited), _, _))
) =>
inherited.map(_.qualifiedName) should ===(Set(TIf, LibTIf))
}
@ -252,15 +256,15 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
}
"have interfaces with choices" in {
itp.main.astInterfaces.keySet should ===(Set(LibTIf, TIf))
inside(itp.main.astInterfaces(TIf).choices get Useless) {
itp.main.interfaces.keySet should ===(Set(LibTIf, TIf))
inside(itp.main.interfaces(TIf).choices get Useless) {
case Some(TheUselessChoice(UselessTy, TIf)) =>
}
}
// TODO SC #14067 depends on #14112
"identify a record interface view" ignore {
inside(itp.main.astInterfaces(LibTIf).viewType) { case Some(Ref.TypeConName(_, LibTIfView)) =>
inside(itp.main.interfaces(LibTIf).viewType) { case Some(Ref.TypeConName(_, LibTIfView)) =>
}
}
@ -268,29 +272,29 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
(
// TODO SC #14067 use the LibTIf DefInterface's view instead, requires #14112
Ref.TypeConName(itp.main.packageId, LibTIfView),
inside(itp.main.typeDecls(LibTIfView)) { case InterfaceType.Normal(DefDataType(_, rec)) =>
inside(itp.main.typeDecls(LibTIfView)) { case TypeDecl.Normal(DefDataType(_, rec)) =>
rec
},
)
"finds an interface view from Interface sets" in {
val (viewName, expectedRec) = viewNameExpectsRec
Interface.resolveInterfaceViewType {
PackageSignature.resolveInterfaceViewType {
case id if id == itp.main.packageId => itp.main
}(viewName) should ===(expectedRec)
}
"finds an interface view from EnvironmentInterface" in {
val (viewName, expectedRec) = viewNameExpectsRec
itpEI.resolveInterfaceViewType(viewName) should ===(Some(expectedRec))
itpES.resolveInterfaceViewType(viewName) should ===(Some(expectedRec))
}
def foundResolvedChoices(foo: Option[InterfaceType]) = inside(foo) {
case Some(InterfaceType.Template(_, DefTemplate(TemplateChoices.Resolved(resolved), _, _))) =>
def foundResolvedChoices(foo: Option[TypeDecl]) = inside(foo) {
case Some(TypeDecl.Template(_, DefTemplate(TemplateChoices.Resolved(resolved), _, _))) =>
resolved
}
def foundUselessChoice(foo: Option[InterfaceType]) =
def foundUselessChoice(foo: Option[TypeDecl]) =
inside(foundResolvedChoices(foo).get(Useless).map(_.forgetNE.toSeq)) {
case Some(Seq((Some(origin1), choice1), (Some(origin2), choice2))) =>
Seq(origin1, origin2) should contain theSameElementsAs Seq(
@ -302,7 +306,7 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
}
"resolve inherited choices" in {
foundUselessChoice(itpEI.typeDecls get Ref.Identifier(itpPid, Foo))
foundUselessChoice(itpES.typeDecls get Ref.Identifier(itpPid, Foo))
}
"resolve choices internally" in {
@ -312,7 +316,7 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
}
"collect direct and resolved choices in one map" in {
foundResolvedChoices(itpEI.typeDecls get Ref.Identifier(itpPid, Foo))
foundResolvedChoices(itpES.typeDecls get Ref.Identifier(itpPid, Foo))
.transform((_, cs) => cs.keySet) should contain theSameElementsAs Map(
Useless -> Set(Some(Ref.Identifier(itpPid, TIf)), Some(Ref.Identifier(itpPid, LibTIf))),
Bar -> Set(None),
@ -321,8 +325,8 @@ class InterfaceReaderSpec extends AnyWordSpec with Matchers with Inside {
}
"resolve retro implements harmlessly when there are none" in {
Interface.resolveRetroImplements((), itp.all)((_, _) => None) should ===((), itp.all)
itpEI.resolveRetroImplements should ===(itpEI)
PackageSignature.resolveRetroImplements((), itp.all)((_, _) => None) should ===((), itp.all)
itpES.resolveRetroImplements should ===(itpES)
}
}

View File

@ -1,96 +0,0 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf
package iface
import com.daml.lf.archive.Dar
import data.Ref, Ref.{Identifier, PackageId}
import scala.collection.immutable.Map
import scalaz.std.tuple._
import scalaz.syntax.functor._
import scalaz.syntax.std.map._
import scalaz.Semigroup
/** The combination of multiple [[Interface]]s, such as from a dar. */
final case class EnvironmentInterface(
metadata: Map[PackageId, PackageMetadata],
typeDecls: Map[Identifier, InterfaceType],
astInterfaces: Map[Ref.TypeConName, DefInterface.FWT],
) {
/** Replace all resolvable `inheritedChoices` in `typeDecls` with concrete
* choices copied from `astInterfaces`. If a template has any missing choices,
* none of its inherited choices are resolved. Idempotent.
*
* This is not distributive because we delay resolution, because successful
* lookup can require the presence of another DAR. In other words,
*
* {{{
* l.resolveChoices |+| r.resolveChoices
* // is possibly less well-resolved than
* (l |+| r).resolveChoices
* }}}
*
* Therefore there is no reason to bother with `resolveChoices` until you've
* accumulated an `EnvironmentInterface` representing the whole environment.
*/
def resolveChoices: EnvironmentInterface =
copy(typeDecls = typeDecls.transform { (_, it) =>
it match {
case itpl: InterfaceType.Template =>
val errOrTpl2 = itpl.template resolveChoices astInterfaces
errOrTpl2.fold(_ => itpl, tpl2 => itpl.copy(template = tpl2))
case z: InterfaceType.Normal => z
}
})
def resolveRetroImplements: EnvironmentInterface = {
import Interface.findTemplate
val (newTypeDecls, newAstInterfaces) = astInterfaces.foldLeft((typeDecls, astInterfaces)) {
case ((typeDecls, astInterfaces), (ifTc, defIf)) =>
defIf
.resolveRetroImplements(ifTc, typeDecls) { case (typeDecls, tplName) =>
findTemplate(typeDecls, tplName) map { itt => f =>
typeDecls.updated(tplName, itt.copy(template = f(itt.template)))
}
}
.map(defIf => astInterfaces.updated(ifTc, defIf))
}
copy(typeDecls = newTypeDecls, astInterfaces = newAstInterfaces)
}
def resolveInterfaceViewType(tcn: Ref.TypeConName): Option[DefInterface.ViewTypeFWT] =
typeDecls get tcn flatMap (_.asInterfaceViewType)
}
object EnvironmentInterface {
def fromReaderInterfaces(i: Interface, o: Interface*): EnvironmentInterface =
fromReaderInterfaces(i +: o)
def fromReaderInterfaces(dar: Dar[Interface]): EnvironmentInterface =
fromReaderInterfaces(dar.main, dar.dependencies: _*)
def fromReaderInterfaces(all: Iterable[Interface]): EnvironmentInterface = {
val typeDecls = all.iterator.flatMap { case Interface(packageId, _, typeDecls, _) =>
typeDecls mapKeys (Identifier(packageId, _))
}.toMap
val astInterfaces = all.iterator.flatMap { case Interface(packageId, _, _, astInterfaces) =>
astInterfaces mapKeys (Identifier(packageId, _))
}.toMap
val metadata = all.iterator.flatMap { case Interface(packageId, metadata, _, _) =>
metadata.iterator.map(md => packageId -> md)
}.toMap
EnvironmentInterface(metadata, typeDecls, astInterfaces)
}
implicit val environmentInterfaceSemigroup: Semigroup[EnvironmentInterface] = Semigroup instance {
(f1, f2) =>
EnvironmentInterface(
f1.metadata ++ f2.metadata,
f1.typeDecls ++ f2.typeDecls,
f1.astInterfaces ++ f2.astInterfaces,
)
}
}

View File

@ -87,8 +87,8 @@ da_scala_test_suite(
deps = [
":interpreter",
":interpreter-test-lib",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/language",
"//daml-lf/parser",
"//daml-lf/transaction",

View File

@ -24,9 +24,9 @@ da_scala_library(
tags = ["maven_coordinates=com.daml:daml-lf-transaction-test-lib:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/data-scalacheck",
"//daml-lf/interface",
"//daml-lf/language",
"//daml-lf/transaction",
"@maven//:com_google_protobuf_protobuf_java",

View File

@ -83,8 +83,8 @@ da_scala_test(
deps = [
":transaction",
":value_proto_java",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction-test-lib",
"@maven//:com_google_protobuf_protobuf_java",
],
@ -109,8 +109,8 @@ da_scala_test(
":transaction",
":transaction_proto_java",
":value_proto_java",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/language",
"//daml-lf/transaction-test-lib",
"@maven//:com_google_protobuf_protobuf_java",

View File

@ -36,11 +36,11 @@ da_scala_library(
tags = ["maven_coordinates=com.daml:daml-script-runner:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/interface",
"//daml-lf/interpreter",
"//daml-lf/language",
"//daml-lf/scenario-interpreter",

View File

@ -135,11 +135,11 @@ da_scala_library(
visibility = ["//visibility:public"],
deps = [
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/interface",
"//daml-lf/interpreter",
"//daml-lf/language",
"//daml-lf/transaction",
@ -192,11 +192,11 @@ da_scala_test_suite(
deps = [
":test-utils",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/interface",
"//daml-lf/interpreter",
"//daml-lf/language",
"//daml-lf/transaction",
@ -255,9 +255,9 @@ da_scala_test(
deps = [
":test-utils",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/interpreter",
"//daml-lf/language",
"//daml-script/runner:script-runner-lib",

View File

@ -20,8 +20,8 @@ da_scala_library(
visibility = ["//visibility:public"],
deps = [
"//daml-assistant/scala-daml-project-config",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//libs-scala/build-info",
"@maven//:ch_qos_logback_logback_classic",
],
@ -39,8 +39,8 @@ da_scala_test(
deps = [
":codegen-common",
"//daml-assistant/scala-daml-project-config",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction-test-lib",
"//libs-scala/nonempty",
"@maven//:ch_qos_logback_logback_classic",

View File

@ -52,10 +52,10 @@ da_scala_library(
tags = ["maven_coordinates=com.daml:codegen-java-lib:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/interface",
"//language-support/codegen-common",
"//language-support/java/bindings:bindings-java",
"@maven//:ch_qos_logback_logback_classic",
@ -88,9 +88,9 @@ da_scala_test(
":lib",
":test-daml-java.jar",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/interface",
"//language-support/codegen-common",
"//language-support/java/bindings:bindings-java",
"@maven//:com_squareup_javapoet",

View File

@ -43,10 +43,10 @@ da_scala_library(
"@maven//:ch_qos_logback_logback_classic",
],
deps = [
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/interface",
"//language-support/codegen-common",
"@maven//:org_slf4j_slf4j_api",
],
@ -95,9 +95,9 @@ da_scala_test_suite(
scalacopts = common_scalacopts,
deps = [
":codegen",
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction-test-lib",
"//libs-scala/logging-entries",
"@maven//:org_scalatest_scalatest_compatible",

View File

@ -22,7 +22,7 @@ class UtilTest extends UtilTestHelpers with ScalaCheckDrivenPropertyChecks {
packageId = PackageId.assertFromString("abcdef"),
metadata = None,
typeDecls = Map.empty,
astInterfaces = Map.empty,
interfaces = Map.empty,
)
val scalaPackageParts = Array("com", "digitalasset")
val scalaPackage: String = scalaPackageParts.mkString(".")

View File

@ -37,8 +37,8 @@ da_scala_library(
"@maven//:com_oracle_database_jdbc_ojdbc8",
],
deps = [
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//language-support/scala/bindings-akka",
"//ledger-api/rs-grpc-bridge",
@ -96,8 +96,8 @@ da_scala_test_suite(
],
deps = [
":integration-tests-lib",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//daml-lf/transaction-test-lib",
"//language-support/scala/bindings-akka",

View File

@ -52,8 +52,8 @@ hj_scalacopts = lf_scalacopts + [
],
deps = [
"//runtime-components/jdbc-drivers:jdbc-drivers-{}".format(edition),
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//language-support/scala/bindings-akka",
"//ledger-api/rs-grpc-bridge",
@ -114,8 +114,8 @@ json_scala_deps = [
]
json_deps_shared = [
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//language-support/scala/bindings-akka",
"//ledger/metrics",
@ -241,8 +241,8 @@ daml_compile(
deps = [
":http-json-{}".format(edition),
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//daml-lf/transaction-test-lib",
"//language-support/scala/bindings-akka",
@ -306,8 +306,8 @@ alias(
deps = [
":http-json-{}".format(edition),
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//daml-lf/transaction-test-lib",
"//language-support/scala/bindings-akka",
@ -380,8 +380,8 @@ alias(
deps = [
":http-json-{}".format(edition),
":integration-tests-lib-{}".format(edition),
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//daml-lf/transaction-test-lib",
"//language-support/scala/bindings-akka",
@ -460,8 +460,8 @@ alias(
":integration-tests-lib-{}".format(edition),
":integration-tests-lib-postgres-{}".format(edition),
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//daml-lf/transaction-test-lib",
"//language-support/scala/bindings-akka",
@ -661,7 +661,7 @@ da_scala_benchmark_jmh(
],
deps = [
":http-json",
"//daml-lf/interface",
"//daml-lf/api-type-signature",
"//language-support/scala/bindings",
"//ledger-service/db-backend",
"//ledger-service/fetch-contracts",

View File

@ -25,8 +25,8 @@ da_scala_library(
"//visibility:public",
],
deps = [
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
],
)
@ -58,8 +58,8 @@ da_scala_test(
deps = [
":lf-value-json",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//daml-lf/transaction-test-lib",
"//ledger-service/utils",

View File

@ -18,10 +18,10 @@ da_scala_library(
tags = ["maven_coordinates=com.daml:http-json-utils:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/language",
"//language-support/scala/bindings-akka",
"//libs-scala/contextualized-logging",

View File

@ -70,10 +70,10 @@ da_scala_library(
],
deps = [
"//daml-assistant/scala-daml-project-config",
"//daml-lf/api-type-signature",
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/language",
"//daml-lf/transaction",
"//language-support/scala/bindings",
@ -117,8 +117,8 @@ da_scala_library(
],
deps = [
":navigator-library",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger-service/lf-value-json",
@ -180,8 +180,8 @@ da_scala_test_suite(
":navigator-library",
":navigator-tests-library",
":test-resources",
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",

View File

@ -3,6 +3,8 @@
- target: //daml-assistant/scala-daml-project-config:scala-daml-project-config
type: jar-scala
- target: //daml-lf/api-type-signature:api-type-signature
type: jar-scala
- target: //daml-lf/archive:daml_lf_1.14_archive_proto_jar
type: jar-lib
- target: //daml-lf/archive:daml_lf_1.14_archive_proto_java
@ -21,8 +23,6 @@
type: jar-scala
- target: //daml-lf/engine:engine
type: jar-scala
- target: //daml-lf/interface:interface
type: jar-scala
- target: //daml-lf/interpreter:interpreter
type: jar-scala
- target: //daml-lf/kv-support:kv-support