mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
LF: rename language Interface to PackageInterface (#10938)
To avoid confusion with the new Daml concept of Interface. CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
054c6abb63
commit
5dc15c6911
@ -227,7 +227,7 @@ class ReplService(
|
|||||||
val (pkgId, pkg) = archive.ArchiveDecoder.assertFromByteString(req.getPackage)
|
val (pkgId, pkg) = archive.ArchiveDecoder.assertFromByteString(req.getPackage)
|
||||||
val newSignatures = signatures.updated(pkgId, AstUtil.toSignature(pkg))
|
val newSignatures = signatures.updated(pkgId, AstUtil.toSignature(pkg))
|
||||||
val newCompiledDefinitions = compiledDefinitions ++
|
val newCompiledDefinitions = compiledDefinitions ++
|
||||||
new Compiler(new language.Interface(newSignatures), compilerConfig)
|
new Compiler(new language.PackageInterface(newSignatures), compilerConfig)
|
||||||
.unsafeCompilePackage(pkgId, pkg)
|
.unsafeCompilePackage(pkgId, pkg)
|
||||||
signatures = newSignatures
|
signatures = newSignatures
|
||||||
compiledDefinitions = newCompiledDefinitions
|
compiledDefinitions = newCompiledDefinitions
|
||||||
@ -257,7 +257,7 @@ class ReplService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val signatures = this.signatures.updated(homePackageId, AstUtil.toSignature(pkg))
|
val signatures = this.signatures.updated(homePackageId, AstUtil.toSignature(pkg))
|
||||||
val interface = new language.Interface(signatures)
|
val interface = new language.PackageInterface(signatures)
|
||||||
val defs =
|
val defs =
|
||||||
new Compiler(interface, compilerConfig).unsafeCompilePackage(homePackageId, pkg)
|
new Compiler(interface, compilerConfig).unsafeCompilePackage(homePackageId, pkg)
|
||||||
val compiledPackages =
|
val compiledPackages =
|
||||||
|
@ -99,7 +99,7 @@ class Context(val contextId: Context.ContextId, languageVersion: LanguageVersion
|
|||||||
if (unloadPackages.nonEmpty || newPackages.nonEmpty) {
|
if (unloadPackages.nonEmpty || newPackages.nonEmpty) {
|
||||||
val invalidPackages = unloadModules ++ newPackages.keys
|
val invalidPackages = unloadModules ++ newPackages.keys
|
||||||
val newExtSignature = extSignatures -- unloadPackages ++ AstUtil.toSignatures(newPackages)
|
val newExtSignature = extSignatures -- unloadPackages ++ AstUtil.toSignatures(newPackages)
|
||||||
val interface = new language.Interface(newExtSignature)
|
val interface = new language.PackageInterface(newExtSignature)
|
||||||
val newExtDefns = extDefns.view.filterKeys(sdef => !invalidPackages(sdef.packageId)) ++
|
val newExtDefns = extDefns.view.filterKeys(sdef => !invalidPackages(sdef.packageId)) ++
|
||||||
assertRight(Compiler.compilePackages(interface, newPackages, compilerConfig))
|
assertRight(Compiler.compilePackages(interface, newPackages, compilerConfig))
|
||||||
// we update only if we manage to compile the new packages
|
// we update only if we manage to compile the new packages
|
||||||
@ -112,7 +112,7 @@ class Context(val contextId: Context.ContextId, languageVersion: LanguageVersion
|
|||||||
newModules
|
newModules
|
||||||
}
|
}
|
||||||
|
|
||||||
val interface = new language.Interface(this.allSignatures)
|
val interface = new language.PackageInterface(this.allSignatures)
|
||||||
val compiler = new Compiler(interface, compilerConfig)
|
val compiler = new Compiler(interface, compilerConfig)
|
||||||
|
|
||||||
modulesToCompile.foreach { mod =>
|
modulesToCompile.foreach { mod =>
|
||||||
|
@ -9,7 +9,7 @@ import java.nio.file.Paths
|
|||||||
import com.daml.lf.archive.{Dar, DarWriter}
|
import com.daml.lf.archive.{Dar, DarWriter}
|
||||||
import com.daml.lf.data.Ref
|
import com.daml.lf.data.Ref
|
||||||
import com.daml.lf.data.Ref.PackageId
|
import com.daml.lf.data.Ref.PackageId
|
||||||
import com.daml.lf.language.{Ast, Interface, LanguageVersion}
|
import com.daml.lf.language.{Ast, PackageInterface, LanguageVersion}
|
||||||
import com.daml.lf.testing.parser.{ParserParameters, parseModules}
|
import com.daml.lf.testing.parser.{ParserParameters, parseModules}
|
||||||
import com.daml.lf.validation.Validation
|
import com.daml.lf.validation.Validation
|
||||||
import com.daml.SdkVersion
|
import com.daml.SdkVersion
|
||||||
@ -71,7 +71,7 @@ private[daml] object DamlLfEncoder extends App {
|
|||||||
|
|
||||||
val pkg =
|
val pkg =
|
||||||
Ast.Package(modules, Set.empty[PackageId], parserParameters.languageVersion, metadata)
|
Ast.Package(modules, Set.empty[PackageId], parserParameters.languageVersion, metadata)
|
||||||
val pkgs = Interface(Map(pkgId -> pkg))
|
val pkgs = PackageInterface(Map(pkgId -> pkg))
|
||||||
|
|
||||||
Validation.checkPackage(pkgs, pkgId, pkg).left.foreach(e => error(e.pretty))
|
Validation.checkPackage(pkgs, pkgId, pkg).left.foreach(e => error(e.pretty))
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ object EncodeV1Spec {
|
|||||||
|
|
||||||
private def validate(pkgId: PackageId, pkg: Package): Unit =
|
private def validate(pkgId: PackageId, pkg: Package): Unit =
|
||||||
Validation
|
Validation
|
||||||
.checkPackage(language.Interface(Map(pkgId -> pkg)), pkgId, pkg)
|
.checkPackage(language.PackageInterface(Map(pkgId -> pkg)), pkgId, pkg)
|
||||||
.left
|
.left
|
||||||
.foreach(e => sys.error(e.toString))
|
.foreach(e => sys.error(e.toString))
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap
|
|||||||
import com.daml.lf.data.Ref.PackageId
|
import com.daml.lf.data.Ref.PackageId
|
||||||
import com.daml.lf.engine.ConcurrentCompiledPackages.AddPackageState
|
import com.daml.lf.engine.ConcurrentCompiledPackages.AddPackageState
|
||||||
import com.daml.lf.language.Ast.{Package, PackageSignature}
|
import com.daml.lf.language.Ast.{Package, PackageSignature}
|
||||||
import com.daml.lf.language.{Interface, Util => AstUtil}
|
import com.daml.lf.language.{PackageInterface, Util => AstUtil}
|
||||||
import com.daml.lf.speedy.Compiler
|
import com.daml.lf.speedy.Compiler
|
||||||
import com.daml.nameof.NameOf
|
import com.daml.nameof.NameOf
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ private[lf] final class ConcurrentCompiledPackages(compilerConfig: Compiler.Conf
|
|||||||
new ConcurrentHashMap()
|
new ConcurrentHashMap()
|
||||||
|
|
||||||
override def packageIds: scala.collection.Set[PackageId] = signatures.keySet
|
override def packageIds: scala.collection.Set[PackageId] = signatures.keySet
|
||||||
override def interface: Interface = new Interface(signatures)
|
override def interface: PackageInterface = new PackageInterface(signatures)
|
||||||
override def getDefinition(dref: speedy.SExpr.SDefinitionRef): Option[speedy.SDefinition] =
|
override def getDefinition(dref: speedy.SExpr.SDefinitionRef): Option[speedy.SDefinition] =
|
||||||
Option(definitionsByReference.get(dref))
|
Option(definitionsByReference.get(dref))
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ private[lf] final class ConcurrentCompiledPackages(compilerConfig: Compiler.Conf
|
|||||||
if (!signatures.contains(pkgId)) {
|
if (!signatures.contains(pkgId)) {
|
||||||
val pkgSignature = AstUtil.toSignature(pkg)
|
val pkgSignature = AstUtil.toSignature(pkg)
|
||||||
val extendedSignatures =
|
val extendedSignatures =
|
||||||
new language.Interface(Map(pkgId -> pkgSignature) orElse signatures)
|
new language.PackageInterface(Map(pkgId -> pkgSignature) orElse signatures)
|
||||||
|
|
||||||
// Compile the speedy definitions for this package.
|
// Compile the speedy definitions for this package.
|
||||||
val defns =
|
val defns =
|
||||||
|
@ -15,7 +15,7 @@ import com.daml.lf.transaction.{SubmittedTransaction, Transaction => Tx}
|
|||||||
import com.daml.lf.transaction.Node._
|
import com.daml.lf.transaction.Node._
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
import com.daml.lf.language.{Interface, LanguageVersion, LookupError, StablePackages}
|
import com.daml.lf.language.{PackageInterface, LanguageVersion, LookupError, StablePackages}
|
||||||
import com.daml.lf.validation.Validation
|
import com.daml.lf.validation.Validation
|
||||||
import com.daml.nameof.NameOf
|
import com.daml.nameof.NameOf
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ class Engine(val config: EngineConfig = Engine.StableConfig) {
|
|||||||
pkgIds = pkgs.keySet
|
pkgIds = pkgs.keySet
|
||||||
missingDeps = pkgs.valuesIterator.flatMap(_.directDeps).toSet.filterNot(pkgIds)
|
missingDeps = pkgs.valuesIterator.flatMap(_.directDeps).toSet.filterNot(pkgIds)
|
||||||
_ <- Either.cond(missingDeps.isEmpty, (), Error.Package.SelfConsistency(pkgIds, missingDeps))
|
_ <- Either.cond(missingDeps.isEmpty, (), Error.Package.SelfConsistency(pkgIds, missingDeps))
|
||||||
interface = Interface(pkgs)
|
interface = PackageInterface(pkgs)
|
||||||
_ <- {
|
_ <- {
|
||||||
pkgs.iterator
|
pkgs.iterator
|
||||||
// we trust already loaded packages
|
// we trust already loaded packages
|
||||||
|
@ -12,7 +12,7 @@ import com.daml.lf.value.Value
|
|||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
|
|
||||||
private[lf] final class CommandPreprocessor(
|
private[lf] final class CommandPreprocessor(
|
||||||
interface: language.Interface,
|
interface: language.PackageInterface,
|
||||||
// See Preprocessor scala doc for more details about the following flags.
|
// See Preprocessor scala doc for more details about the following flags.
|
||||||
forbidV0ContractId: Boolean,
|
forbidV0ContractId: Boolean,
|
||||||
requireV1ContractIdSuffix: Boolean,
|
requireV1ContractIdSuffix: Boolean,
|
||||||
|
@ -15,7 +15,7 @@ import com.daml.lf.value.Value._
|
|||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
|
|
||||||
private[engine] final class ValueTranslator(
|
private[engine] final class ValueTranslator(
|
||||||
interface: language.Interface,
|
interface: language.PackageInterface,
|
||||||
// See Preprocessor scala doc for more details about the following flags.
|
// See Preprocessor scala doc for more details about the following flags.
|
||||||
forbidV0ContractId: Boolean,
|
forbidV0ContractId: Boolean,
|
||||||
requireV1ContractIdSuffix: Boolean,
|
requireV1ContractIdSuffix: Boolean,
|
||||||
|
@ -69,7 +69,7 @@ class EngineTest
|
|||||||
"daml-lf/tests/BasicTests.dar"
|
"daml-lf/tests/BasicTests.dar"
|
||||||
)
|
)
|
||||||
|
|
||||||
val basicTestsSignatures = language.Interface(Map(basicTestsPkgId -> basicTestsPkg))
|
val basicTestsSignatures = language.PackageInterface(Map(basicTestsPkgId -> basicTestsPkg))
|
||||||
|
|
||||||
val withKeyTemplate = "BasicTests:WithKey"
|
val withKeyTemplate = "BasicTests:WithKey"
|
||||||
val BasicTests_WithKey = Identifier(basicTestsPkgId, withKeyTemplate)
|
val BasicTests_WithKey = Identifier(basicTestsPkgId, withKeyTemplate)
|
||||||
@ -289,7 +289,7 @@ class EngineTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
val let = Time.Timestamp.now()
|
val let = Time.Timestamp.now()
|
||||||
val submissionSeed = hash("multi-party create command")
|
val submissionSeed = hash("multi-party create command2")
|
||||||
|
|
||||||
def interpretResult(
|
def interpretResult(
|
||||||
templateId: String,
|
templateId: String,
|
||||||
|
@ -5,7 +5,7 @@ package com.daml.lf
|
|||||||
package speedy
|
package speedy
|
||||||
package explore
|
package explore
|
||||||
|
|
||||||
import com.daml.lf.language.Interface
|
import com.daml.lf.language.PackageInterface
|
||||||
import com.daml.lf.speedy.SExpr._
|
import com.daml.lf.speedy.SExpr._
|
||||||
import com.daml.lf.speedy.SValue._
|
import com.daml.lf.speedy.SValue._
|
||||||
import com.daml.lf.speedy.SResult._
|
import com.daml.lf.speedy.SResult._
|
||||||
@ -25,7 +25,7 @@ object PlaySpeedy {
|
|||||||
|
|
||||||
def main(args0: List[String]) = {
|
def main(args0: List[String]) = {
|
||||||
val config: Config = parseArgs(args0)
|
val config: Config = parseArgs(args0)
|
||||||
val compiler: Compiler = new Compiler(Interface.Empty, compilerConfig)
|
val compiler: Compiler = new Compiler(PackageInterface.Empty, compilerConfig)
|
||||||
|
|
||||||
val names: List[String] = config.names match {
|
val names: List[String] = config.names match {
|
||||||
case Nil => examples.toList.map(_._1)
|
case Nil => examples.toList.map(_._1)
|
||||||
|
@ -5,7 +5,7 @@ package com.daml.lf
|
|||||||
|
|
||||||
import com.daml.lf.data.Ref.PackageId
|
import com.daml.lf.data.Ref.PackageId
|
||||||
import com.daml.lf.language.Ast.{Package, PackageSignature}
|
import com.daml.lf.language.Ast.{Package, PackageSignature}
|
||||||
import com.daml.lf.language.{Interface, Util}
|
import com.daml.lf.language.{PackageInterface, Util}
|
||||||
import com.daml.lf.speedy.SExpr.SDefinitionRef
|
import com.daml.lf.speedy.SExpr.SDefinitionRef
|
||||||
import com.daml.lf.speedy.{Compiler, SDefinition}
|
import com.daml.lf.speedy.{Compiler, SDefinition}
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ private[lf] abstract class CompiledPackages(
|
|||||||
) {
|
) {
|
||||||
def getDefinition(dref: SDefinitionRef): Option[SDefinition]
|
def getDefinition(dref: SDefinitionRef): Option[SDefinition]
|
||||||
def packageIds: scala.collection.Set[PackageId]
|
def packageIds: scala.collection.Set[PackageId]
|
||||||
def interface: Interface
|
def interface: PackageInterface
|
||||||
def definitions: PartialFunction[SDefinitionRef, SDefinition] =
|
def definitions: PartialFunction[SDefinitionRef, SDefinition] =
|
||||||
Function.unlift(this.getDefinition)
|
Function.unlift(this.getDefinition)
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ private[lf] abstract class CompiledPackages(
|
|||||||
*/
|
*/
|
||||||
private[lf] final class PureCompiledPackages(
|
private[lf] final class PureCompiledPackages(
|
||||||
val packageIds: Set[PackageId],
|
val packageIds: Set[PackageId],
|
||||||
val interface: Interface,
|
val interface: PackageInterface,
|
||||||
val defns: Map[SDefinitionRef, SDefinition],
|
val defns: Map[SDefinitionRef, SDefinition],
|
||||||
compilerConfig: Compiler.Config,
|
compilerConfig: Compiler.Config,
|
||||||
) extends CompiledPackages(compilerConfig) {
|
) extends CompiledPackages(compilerConfig) {
|
||||||
@ -46,14 +46,14 @@ private[lf] object PureCompiledPackages {
|
|||||||
defns: Map[SDefinitionRef, SDefinition],
|
defns: Map[SDefinitionRef, SDefinition],
|
||||||
compilerConfig: Compiler.Config,
|
compilerConfig: Compiler.Config,
|
||||||
): PureCompiledPackages =
|
): PureCompiledPackages =
|
||||||
new PureCompiledPackages(packages.keySet, new Interface(packages), defns, compilerConfig)
|
new PureCompiledPackages(packages.keySet, new PackageInterface(packages), defns, compilerConfig)
|
||||||
|
|
||||||
def build(
|
def build(
|
||||||
packages: Map[PackageId, Package],
|
packages: Map[PackageId, Package],
|
||||||
compilerConfig: Compiler.Config = Compiler.Config.Default,
|
compilerConfig: Compiler.Config = Compiler.Config.Default,
|
||||||
): Either[String, PureCompiledPackages] = {
|
): Either[String, PureCompiledPackages] = {
|
||||||
Compiler
|
Compiler
|
||||||
.compilePackages(Interface(packages), packages, compilerConfig)
|
.compilePackages(PackageInterface(packages), packages, compilerConfig)
|
||||||
.map(apply(Util.toSignatures(packages), _, compilerConfig))
|
.map(apply(Util.toSignatures(packages), _, compilerConfig))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import java.util
|
|||||||
import com.daml.lf.data.Ref._
|
import com.daml.lf.data.Ref._
|
||||||
import com.daml.lf.data.{ImmArray, Numeric, Ref, Struct, Time}
|
import com.daml.lf.data.{ImmArray, Numeric, Ref, Struct, Time}
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
import com.daml.lf.language.{LanguageVersion, LookupError, Interface, StablePackages}
|
import com.daml.lf.language.{LanguageVersion, LookupError, PackageInterface, StablePackages}
|
||||||
import com.daml.lf.speedy.Anf.flattenToAnf
|
import com.daml.lf.speedy.Anf.flattenToAnf
|
||||||
import com.daml.lf.speedy.Profile.LabelModule
|
import com.daml.lf.speedy.Profile.LabelModule
|
||||||
import com.daml.lf.speedy.SBuiltin._
|
import com.daml.lf.speedy.SBuiltin._
|
||||||
@ -105,7 +105,7 @@ private[lf] object Compiler {
|
|||||||
* they transitively reference are in the [[packages]] in the compiler.
|
* they transitively reference are in the [[packages]] in the compiler.
|
||||||
*/
|
*/
|
||||||
def compilePackages(
|
def compilePackages(
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
packages: Map[PackageId, Package],
|
packages: Map[PackageId, Package],
|
||||||
compilerConfig: Compiler.Config,
|
compilerConfig: Compiler.Config,
|
||||||
): Either[String, Map[SDefinitionRef, SDefinition]] = {
|
): Either[String, Map[SDefinitionRef, SDefinition]] = {
|
||||||
@ -136,7 +136,7 @@ private[lf] object Compiler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private[lf] final class Compiler(
|
private[lf] final class Compiler(
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
config: Compiler.Config,
|
config: Compiler.Config,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import com.daml.lf.data.Ref
|
|||||||
import com.daml.lf.data.Ref.{PackageId, Party}
|
import com.daml.lf.data.Ref.{PackageId, Party}
|
||||||
import com.daml.lf.interpretation.{Error => IE}
|
import com.daml.lf.interpretation.{Error => IE}
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
import com.daml.lf.language.{LanguageVersion, Interface}
|
import com.daml.lf.language.{LanguageVersion, PackageInterface}
|
||||||
import com.daml.lf.speedy.Compiler.FullStackTrace
|
import com.daml.lf.speedy.Compiler.FullStackTrace
|
||||||
import com.daml.lf.speedy.SResult.{SResultError, SResultFinalValue}
|
import com.daml.lf.speedy.SResult.{SResultError, SResultFinalValue}
|
||||||
import com.daml.lf.speedy.SError.SErrorDamlException
|
import com.daml.lf.speedy.SError.SErrorDamlException
|
||||||
@ -539,7 +539,7 @@ class ExceptionTest extends AnyWordSpec with Matchers with TableDrivenPropertyCh
|
|||||||
private def typeAndCompile(pkg: Package): PureCompiledPackages = {
|
private def typeAndCompile(pkg: Package): PureCompiledPackages = {
|
||||||
import defaultParserParameters.defaultPackageId
|
import defaultParserParameters.defaultPackageId
|
||||||
val rawPkgs = Map(defaultPackageId -> pkg)
|
val rawPkgs = Map(defaultPackageId -> pkg)
|
||||||
Validation.checkPackage(Interface(rawPkgs), defaultPackageId, pkg)
|
Validation.checkPackage(PackageInterface(rawPkgs), defaultPackageId, pkg)
|
||||||
val compilerConfig = Compiler.Config.Dev.copy(stacktracing = FullStackTrace)
|
val compilerConfig = Compiler.Config.Dev.copy(stacktracing = FullStackTrace)
|
||||||
PureCompiledPackages.assertBuild(rawPkgs, compilerConfig)
|
PureCompiledPackages.assertBuild(rawPkgs, compilerConfig)
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.daml.lf.data.ImmArray
|
|||||||
import com.daml.lf.data.Ref
|
import com.daml.lf.data.Ref
|
||||||
import com.daml.lf.data.Ref.Party
|
import com.daml.lf.data.Ref.Party
|
||||||
import com.daml.lf.language.Ast.{Package, Expr, PrimLit, PLParty, EPrimLit, EApp}
|
import com.daml.lf.language.Ast.{Package, Expr, PrimLit, PLParty, EPrimLit, EApp}
|
||||||
import com.daml.lf.language.{LanguageVersion, Interface}
|
import com.daml.lf.language.{LanguageVersion, PackageInterface}
|
||||||
import com.daml.lf.speedy.Compiler.FullStackTrace
|
import com.daml.lf.speedy.Compiler.FullStackTrace
|
||||||
import com.daml.lf.speedy.PartialTransaction.{CompleteTransaction, IncompleteTransaction, LeafNode}
|
import com.daml.lf.speedy.PartialTransaction.{CompleteTransaction, IncompleteTransaction, LeafNode}
|
||||||
import com.daml.lf.speedy.SResult.SResultFinalValue
|
import com.daml.lf.speedy.SResult.SResultFinalValue
|
||||||
@ -38,7 +38,7 @@ class ExceptionTest extends AnyWordSpec with Matchers with TableDrivenPropertyCh
|
|||||||
private def typeAndCompile(pkg: Package): PureCompiledPackages = {
|
private def typeAndCompile(pkg: Package): PureCompiledPackages = {
|
||||||
import defaultParserParameters.defaultPackageId
|
import defaultParserParameters.defaultPackageId
|
||||||
val rawPkgs = Map(defaultPackageId -> pkg)
|
val rawPkgs = Map(defaultPackageId -> pkg)
|
||||||
Validation.checkPackage(Interface(rawPkgs), defaultPackageId, pkg)
|
Validation.checkPackage(PackageInterface(rawPkgs), defaultPackageId, pkg)
|
||||||
val compilerConfig = Compiler.Config.Dev.copy(stacktracing = FullStackTrace)
|
val compilerConfig = Compiler.Config.Dev.copy(stacktracing = FullStackTrace)
|
||||||
PureCompiledPackages.assertBuild(rawPkgs, compilerConfig)
|
PureCompiledPackages.assertBuild(rawPkgs, compilerConfig)
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ object SpeedyTest {
|
|||||||
private def typeAndCompile(pkg: Package): PureCompiledPackages = {
|
private def typeAndCompile(pkg: Package): PureCompiledPackages = {
|
||||||
import defaultParserParameters.defaultPackageId
|
import defaultParserParameters.defaultPackageId
|
||||||
val rawPkgs = Map(defaultPackageId -> pkg)
|
val rawPkgs = Map(defaultPackageId -> pkg)
|
||||||
Validation.checkPackage(language.Interface(rawPkgs), defaultPackageId, pkg)
|
Validation.checkPackage(language.PackageInterface(rawPkgs), defaultPackageId, pkg)
|
||||||
val compilerConfig = Compiler.Config.Default.copy(stacktracing = FullStackTrace)
|
val compilerConfig = Compiler.Config.Default.copy(stacktracing = FullStackTrace)
|
||||||
PureCompiledPackages.assertBuild(rawPkgs, compilerConfig)
|
PureCompiledPackages.assertBuild(rawPkgs, compilerConfig)
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ class TailCallTest extends AnyWordSpec with Matchers with TableDrivenPropertyChe
|
|||||||
import defaultParserParameters.defaultPackageId
|
import defaultParserParameters.defaultPackageId
|
||||||
val rawPkgs = Map(defaultPackageId -> pkg)
|
val rawPkgs = Map(defaultPackageId -> pkg)
|
||||||
Validation.checkPackage(
|
Validation.checkPackage(
|
||||||
language.Interface(rawPkgs),
|
language.PackageInterface(rawPkgs),
|
||||||
defaultParserParameters.defaultPackageId,
|
defaultParserParameters.defaultPackageId,
|
||||||
pkg,
|
pkg,
|
||||||
)
|
)
|
||||||
|
@ -7,9 +7,9 @@ package language
|
|||||||
import com.daml.lf.data.Ref._
|
import com.daml.lf.data.Ref._
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
|
|
||||||
private[lf] class Interface(signatures: PartialFunction[PackageId, PackageSignature]) {
|
private[lf] class PackageInterface(signatures: PartialFunction[PackageId, PackageSignature]) {
|
||||||
|
|
||||||
import Interface._
|
import PackageInterface._
|
||||||
|
|
||||||
private[this] def lookupPackage(
|
private[this] def lookupPackage(
|
||||||
pkgId: PackageId,
|
pkgId: PackageId,
|
||||||
@ -263,12 +263,12 @@ private[lf] class Interface(signatures: PartialFunction[PackageId, PackageSignat
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object Interface {
|
object PackageInterface {
|
||||||
|
|
||||||
val Empty = new Interface(PartialFunction.empty)
|
val Empty = new PackageInterface(PartialFunction.empty)
|
||||||
|
|
||||||
def apply(packages: Map[PackageId, Package]): Interface =
|
def apply(packages: Map[PackageId, Package]): PackageInterface =
|
||||||
new Interface(Util.toSignatures(packages))
|
new PackageInterface(Util.toSignatures(packages))
|
||||||
|
|
||||||
case class DataRecordInfo(
|
case class DataRecordInfo(
|
||||||
dataType: DDataType,
|
dataType: DDataType,
|
@ -16,7 +16,7 @@ import com.daml.lf.speedy.SResult._
|
|||||||
import com.daml.lf.speedy.SExpr.LfDefRef
|
import com.daml.lf.speedy.SExpr.LfDefRef
|
||||||
import com.daml.lf.validation.Validation
|
import com.daml.lf.validation.Validation
|
||||||
import com.daml.lf.testing.parser
|
import com.daml.lf.testing.parser
|
||||||
import com.daml.lf.language.{Interface, LanguageVersion => LV}
|
import com.daml.lf.language.{PackageInterface, LanguageVersion => LV}
|
||||||
import java.io.{File, PrintWriter, StringWriter}
|
import java.io.{File, PrintWriter, StringWriter}
|
||||||
import java.nio.file.{Path, Paths}
|
import java.nio.file.{Path, Paths}
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
@ -156,7 +156,7 @@ object Repl {
|
|||||||
|
|
||||||
def cmdValidate(state: State): (Boolean, State) = {
|
def cmdValidate(state: State): (Boolean, State) = {
|
||||||
val (validationResults, validationTime) = time(state.packages.map { case (pkgId, pkg) =>
|
val (validationResults, validationTime) = time(state.packages.map { case (pkgId, pkg) =>
|
||||||
Validation.checkPackage(Interface(state.packages), pkgId, pkg)
|
Validation.checkPackage(PackageInterface(state.packages), pkgId, pkg)
|
||||||
})
|
})
|
||||||
System.err.println(s"${state.packages.size} package(s) validated in $validationTime ms.")
|
System.err.println(s"${state.packages.size} package(s) validated in $validationTime ms.")
|
||||||
validationResults collectFirst { case Left(e) =>
|
validationResults collectFirst { case Left(e) =>
|
||||||
@ -428,7 +428,7 @@ object Repl {
|
|||||||
def speedyCompile(state: State, args: Seq[String]): Unit = {
|
def speedyCompile(state: State, args: Seq[String]): Unit = {
|
||||||
val defs = assertRight(
|
val defs = assertRight(
|
||||||
Compiler.compilePackages(
|
Compiler.compilePackages(
|
||||||
Interface(state.packages),
|
PackageInterface(state.packages),
|
||||||
state.packages,
|
state.packages,
|
||||||
state.scenarioRunner.compilerConfig,
|
state.scenarioRunner.compilerConfig,
|
||||||
)
|
)
|
||||||
|
@ -12,7 +12,7 @@ import scala.Ordering.Implicits.infixOrderingOps
|
|||||||
private[validation] object DependencyVersion {
|
private[validation] object DependencyVersion {
|
||||||
|
|
||||||
@throws[ValidationError]
|
@throws[ValidationError]
|
||||||
def checkPackage(interface: language.Interface, pkgId: PackageId, pkg: Package): Unit =
|
def checkPackage(interface: language.PackageInterface, pkgId: PackageId, pkg: Package): Unit =
|
||||||
for {
|
for {
|
||||||
depPkgId <- pkg.directDeps
|
depPkgId <- pkg.directDeps
|
||||||
depPkg = Util.handleLookup(NoContext, interface.lookupPackage(depPkgId))
|
depPkg = Util.handleLookup(NoContext, interface.lookupPackage(depPkgId))
|
||||||
|
@ -5,7 +5,7 @@ package com.daml.lf.validation
|
|||||||
|
|
||||||
import com.daml.lf.data.Ref.PackageId
|
import com.daml.lf.data.Ref.PackageId
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
import com.daml.lf.language.Interface
|
import com.daml.lf.language.PackageInterface
|
||||||
import com.daml.lf.validation.iterable.ExprIterable
|
import com.daml.lf.validation.iterable.ExprIterable
|
||||||
|
|
||||||
private[validation] object PartyLiterals {
|
private[validation] object PartyLiterals {
|
||||||
@ -13,7 +13,7 @@ private[validation] object PartyLiterals {
|
|||||||
import Util.handleLookup
|
import Util.handleLookup
|
||||||
|
|
||||||
@throws[EForbiddenPartyLiterals]
|
@throws[EForbiddenPartyLiterals]
|
||||||
def checkModule(interface: Interface, pkgId: PackageId, module: Module): Unit = {
|
def checkModule(interface: PackageInterface, pkgId: PackageId, module: Module): Unit = {
|
||||||
module.definitions.foreach {
|
module.definitions.foreach {
|
||||||
case (defName, DValue(typ @ _, noPartyLiterals, body, isTest @ _)) =>
|
case (defName, DValue(typ @ _, noPartyLiterals, body, isTest @ _)) =>
|
||||||
def context = ContextDefValue(pkgId, module.name, defName)
|
def context = ContextDefValue(pkgId, module.name, defName)
|
||||||
@ -29,7 +29,7 @@ private[validation] object PartyLiterals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def checkExpr(interface: Interface, context: => Context, expr: Expr): Unit =
|
private def checkExpr(interface: PackageInterface, context: => Context, expr: Expr): Unit =
|
||||||
expr match {
|
expr match {
|
||||||
case EPrimLit(party: PLParty) =>
|
case EPrimLit(party: PLParty) =>
|
||||||
throw EForbiddenPartyLiterals(context, PartyLiteral(party.value))
|
throw EForbiddenPartyLiterals(context, PartyLiteral(party.value))
|
||||||
|
@ -6,7 +6,7 @@ package com.daml.lf.validation
|
|||||||
import com.daml.lf.data.ImmArray
|
import com.daml.lf.data.ImmArray
|
||||||
import com.daml.lf.data.Ref.{Identifier, PackageId, QualifiedName}
|
import com.daml.lf.data.Ref.{Identifier, PackageId, QualifiedName}
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
import com.daml.lf.language.{LanguageVersion, Interface}
|
import com.daml.lf.language.{LanguageVersion, PackageInterface}
|
||||||
|
|
||||||
private[validation] object Serializability {
|
private[validation] object Serializability {
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ private[validation] object Serializability {
|
|||||||
|
|
||||||
case class Env(
|
case class Env(
|
||||||
languageVersion: LanguageVersion,
|
languageVersion: LanguageVersion,
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
requirement: SerializabilityRequirement,
|
requirement: SerializabilityRequirement,
|
||||||
typeToSerialize: Type,
|
typeToSerialize: Type,
|
||||||
@ -99,7 +99,7 @@ private[validation] object Serializability {
|
|||||||
|
|
||||||
def checkDataType(
|
def checkDataType(
|
||||||
version: LanguageVersion,
|
version: LanguageVersion,
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
tyCon: TTyCon,
|
tyCon: TTyCon,
|
||||||
params: ImmArray[(TypeVarName, Kind)],
|
params: ImmArray[(TypeVarName, Kind)],
|
||||||
dataCons: DataCons,
|
dataCons: DataCons,
|
||||||
@ -126,7 +126,7 @@ private[validation] object Serializability {
|
|||||||
// in particular choice argument types and choice return types are of kind KStar
|
// in particular choice argument types and choice return types are of kind KStar
|
||||||
def checkTemplate(
|
def checkTemplate(
|
||||||
version: LanguageVersion,
|
version: LanguageVersion,
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
tyCon: TTyCon,
|
tyCon: TTyCon,
|
||||||
template: Template,
|
template: Template,
|
||||||
): Unit = {
|
): Unit = {
|
||||||
@ -141,14 +141,14 @@ private[validation] object Serializability {
|
|||||||
|
|
||||||
def checkException(
|
def checkException(
|
||||||
version: LanguageVersion,
|
version: LanguageVersion,
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
tyCon: TTyCon,
|
tyCon: TTyCon,
|
||||||
): Unit = {
|
): Unit = {
|
||||||
val context = ContextDefException(tyCon.tycon)
|
val context = ContextDefException(tyCon.tycon)
|
||||||
Env(version, interface, context, SRExceptionArg, tyCon).checkType()
|
Env(version, interface, context, SRExceptionArg, tyCon).checkType()
|
||||||
}
|
}
|
||||||
|
|
||||||
def checkModule(interface: Interface, pkgId: PackageId, module: Module): Unit = {
|
def checkModule(interface: PackageInterface, pkgId: PackageId, module: Module): Unit = {
|
||||||
val version = handleLookup(NoContext, interface.lookupPackage(pkgId)).languageVersion
|
val version = handleLookup(NoContext, interface.lookupPackage(pkgId)).languageVersion
|
||||||
module.definitions.foreach {
|
module.definitions.foreach {
|
||||||
case (defName, DDataType(serializable, params, dataCons)) =>
|
case (defName, DDataType(serializable, params, dataCons)) =>
|
||||||
|
@ -7,7 +7,7 @@ import com.daml.lf.data.{ImmArray, Numeric, Struct}
|
|||||||
import com.daml.lf.data.Ref._
|
import com.daml.lf.data.Ref._
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
import com.daml.lf.language.Util._
|
import com.daml.lf.language.Util._
|
||||||
import com.daml.lf.language.{LanguageVersion, Interface}
|
import com.daml.lf.language.{LanguageVersion, PackageInterface}
|
||||||
import com.daml.lf.validation.AlphaEquiv._
|
import com.daml.lf.validation.AlphaEquiv._
|
||||||
import com.daml.lf.validation.Util._
|
import com.daml.lf.validation.Util._
|
||||||
import com.daml.lf.validation.iterable.TypeIterable
|
import com.daml.lf.validation.iterable.TypeIterable
|
||||||
@ -256,7 +256,7 @@ private[validation] object Typing {
|
|||||||
case PCUnit => TUnit
|
case PCUnit => TUnit
|
||||||
}
|
}
|
||||||
|
|
||||||
def checkModule(interface: Interface, pkgId: PackageId, mod: Module): Unit = {
|
def checkModule(interface: PackageInterface, pkgId: PackageId, mod: Module): Unit = {
|
||||||
val langVersion = handleLookup(NoContext, interface.lookupPackage(pkgId)).languageVersion
|
val langVersion = handleLookup(NoContext, interface.lookupPackage(pkgId)).languageVersion
|
||||||
mod.definitions.foreach {
|
mod.definitions.foreach {
|
||||||
case (dfnName, DDataType(_, params, cons)) =>
|
case (dfnName, DDataType(_, params, cons)) =>
|
||||||
@ -314,7 +314,7 @@ private[validation] object Typing {
|
|||||||
|
|
||||||
case class Env(
|
case class Env(
|
||||||
languageVersion: LanguageVersion,
|
languageVersion: LanguageVersion,
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
tVars: Map[TypeVarName, Kind] = Map.empty,
|
tVars: Map[TypeVarName, Kind] = Map.empty,
|
||||||
eVars: Map[ExprVarName, Type] = Map.empty,
|
eVars: Map[ExprVarName, Type] = Map.empty,
|
||||||
|
@ -6,7 +6,7 @@ package validation
|
|||||||
|
|
||||||
import com.daml.lf.data.Ref.PackageId
|
import com.daml.lf.data.Ref.PackageId
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
import com.daml.lf.language.Interface
|
import com.daml.lf.language.PackageInterface
|
||||||
|
|
||||||
object Validation {
|
object Validation {
|
||||||
|
|
||||||
@ -19,19 +19,19 @@ object Validation {
|
|||||||
|
|
||||||
def checkPackages(pkgs: Map[PackageId, Package]): Either[ValidationError, Unit] =
|
def checkPackages(pkgs: Map[PackageId, Package]): Either[ValidationError, Unit] =
|
||||||
runSafely {
|
runSafely {
|
||||||
val interface = Interface(pkgs)
|
val interface = PackageInterface(pkgs)
|
||||||
pkgs.foreach { case (pkgId, pkg) => unsafeCheckPackage(interface, pkgId, pkg) }
|
pkgs.foreach { case (pkgId, pkg) => unsafeCheckPackage(interface, pkgId, pkg) }
|
||||||
}
|
}
|
||||||
|
|
||||||
def checkPackage(
|
def checkPackage(
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
pkgId: PackageId,
|
pkgId: PackageId,
|
||||||
pkg: Package,
|
pkg: Package,
|
||||||
): Either[ValidationError, Unit] =
|
): Either[ValidationError, Unit] =
|
||||||
runSafely(unsafeCheckPackage(interface, pkgId, pkg))
|
runSafely(unsafeCheckPackage(interface, pkgId, pkg))
|
||||||
|
|
||||||
private def unsafeCheckPackage(
|
private def unsafeCheckPackage(
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
pkgId: PackageId,
|
pkgId: PackageId,
|
||||||
pkg: Package,
|
pkg: Package,
|
||||||
): Unit = {
|
): Unit = {
|
||||||
@ -42,14 +42,14 @@ object Validation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private[lf] def checkModule(
|
private[lf] def checkModule(
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
pkgId: PackageId,
|
pkgId: PackageId,
|
||||||
module: Module,
|
module: Module,
|
||||||
): Either[ValidationError, Unit] =
|
): Either[ValidationError, Unit] =
|
||||||
runSafely(unsafeCheckModule(interface, pkgId, module))
|
runSafely(unsafeCheckModule(interface, pkgId, module))
|
||||||
|
|
||||||
private def unsafeCheckModule(
|
private def unsafeCheckModule(
|
||||||
interface: Interface,
|
interface: PackageInterface,
|
||||||
pkgId: PackageId,
|
pkgId: PackageId,
|
||||||
mod: Module,
|
mod: Module,
|
||||||
): Unit = {
|
): Unit = {
|
||||||
|
@ -71,13 +71,13 @@ class DependencyVersionSpec extends AnyWordSpec with TableDrivenPropertyChecks w
|
|||||||
|
|
||||||
forEvery(negativeTestCases) { pkgs =>
|
forEvery(negativeTestCases) { pkgs =>
|
||||||
pkgs.foreach { case (pkgId, pkg) =>
|
pkgs.foreach { case (pkgId, pkg) =>
|
||||||
DependencyVersion.checkPackage(language.Interface(pkgs), pkgId, pkg)
|
DependencyVersion.checkPackage(language.PackageInterface(pkgs), pkgId, pkg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forEvery(postiveTestCase) { case ((pkgdId, _), pkgs) =>
|
forEvery(postiveTestCase) { case ((pkgdId, _), pkgs) =>
|
||||||
an[EModuleVersionDependencies] should be thrownBy
|
an[EModuleVersionDependencies] should be thrownBy
|
||||||
DependencyVersion.checkPackage(language.Interface(pkgs), pkgdId, pkgs(pkgdId))
|
DependencyVersion.checkPackage(language.PackageInterface(pkgs), pkgdId, pkgs(pkgdId))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class PartyLiteralsSpec extends AnyWordSpec with TableDrivenPropertyChecks with
|
|||||||
"PositiveTestCase8",
|
"PositiveTestCase8",
|
||||||
)
|
)
|
||||||
|
|
||||||
val interface = language.Interface(Map(defaultPackageId -> pkg))
|
val interface = language.PackageInterface(Map(defaultPackageId -> pkg))
|
||||||
|
|
||||||
checkModule(
|
checkModule(
|
||||||
interface,
|
interface,
|
||||||
|
@ -348,7 +348,7 @@ class SerializabilitySpec extends AnyWordSpec with TableDrivenPropertyChecks wit
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
private val defaultInterface = interface(defaultPkg)
|
private val defaultInterface = interface(defaultPkg)
|
||||||
private def interface(pkg: Package) = language.Interface(Map(defaultPackageId -> pkg))
|
private def interface(pkg: Package) = language.PackageInterface(Map(defaultPackageId -> pkg))
|
||||||
|
|
||||||
private def check(pkg: Package, modName: String): Unit = {
|
private def check(pkg: Package, modName: String): Unit = {
|
||||||
val w = interface(pkg)
|
val w = interface(pkg)
|
||||||
|
@ -5,7 +5,7 @@ package com.daml.lf.validation
|
|||||||
|
|
||||||
import com.daml.lf.data.Ref.DottedName
|
import com.daml.lf.data.Ref.DottedName
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
import com.daml.lf.language.{Interface, LookupError, Reference, LanguageVersion => LV}
|
import com.daml.lf.language.{PackageInterface, LookupError, Reference, LanguageVersion => LV}
|
||||||
import com.daml.lf.testing.parser.Implicits._
|
import com.daml.lf.testing.parser.Implicits._
|
||||||
import com.daml.lf.testing.parser.{defaultLanguageVersion, defaultPackageId}
|
import com.daml.lf.testing.parser.{defaultLanguageVersion, defaultPackageId}
|
||||||
import com.daml.lf.validation.SpecUtil._
|
import com.daml.lf.validation.SpecUtil._
|
||||||
@ -1045,7 +1045,7 @@ class TypingSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matcher
|
|||||||
)
|
)
|
||||||
|
|
||||||
def checkModule(pkg: Package, modName: String) = Typing.checkModule(
|
def checkModule(pkg: Package, modName: String) = Typing.checkModule(
|
||||||
Interface(Map(defaultPackageId -> pkg)),
|
PackageInterface(Map(defaultPackageId -> pkg)),
|
||||||
defaultPackageId,
|
defaultPackageId,
|
||||||
pkg.modules(DottedName.assertFromString(modName)),
|
pkg.modules(DottedName.assertFromString(modName)),
|
||||||
)
|
)
|
||||||
@ -1115,7 +1115,7 @@ class TypingSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matcher
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def checkModule(pkg: Package, modName: String) = Typing.checkModule(
|
def checkModule(pkg: Package, modName: String) = Typing.checkModule(
|
||||||
Interface(Map(defaultPackageId -> pkg)),
|
PackageInterface(Map(defaultPackageId -> pkg)),
|
||||||
defaultPackageId,
|
defaultPackageId,
|
||||||
pkg.modules(DottedName.assertFromString(modName)),
|
pkg.modules(DottedName.assertFromString(modName)),
|
||||||
)
|
)
|
||||||
@ -1144,7 +1144,7 @@ class TypingSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matcher
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
val mod = pkg.modules(DottedName.assertFromString("TypeVarShadowing2"))
|
val mod = pkg.modules(DottedName.assertFromString("TypeVarShadowing2"))
|
||||||
Typing.checkModule(Interface(Map(defaultPackageId -> pkg)), defaultPackageId, mod)
|
Typing.checkModule(PackageInterface(Map(defaultPackageId -> pkg)), defaultPackageId, mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
"expand type synonyms correctly" in {
|
"expand type synonyms correctly" in {
|
||||||
@ -1208,7 +1208,7 @@ class TypingSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matcher
|
|||||||
|
|
||||||
def checkModule(mod: Module) = {
|
def checkModule(mod: Module) = {
|
||||||
val pkg = Package.apply(List(mod), List.empty, defaultLanguageVersion, None)
|
val pkg = Package.apply(List(mod), List.empty, defaultLanguageVersion, None)
|
||||||
Typing.checkModule(Interface(Map(defaultPackageId -> pkg)), defaultPackageId, mod)
|
Typing.checkModule(PackageInterface(Map(defaultPackageId -> pkg)), defaultPackageId, mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
val negativeTestCases = Table(
|
val negativeTestCases = Table(
|
||||||
@ -1230,7 +1230,7 @@ class TypingSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matcher
|
|||||||
|
|
||||||
def checkModule(mod: Module) = {
|
def checkModule(mod: Module) = {
|
||||||
val pkg = Package.apply(List(mod), List.empty, defaultLanguageVersion, None)
|
val pkg = Package.apply(List(mod), List.empty, defaultLanguageVersion, None)
|
||||||
Typing.checkModule(Interface(Map(defaultPackageId -> pkg)), defaultPackageId, mod)
|
Typing.checkModule(PackageInterface(Map(defaultPackageId -> pkg)), defaultPackageId, mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
val negativeTestCases = Table(
|
val negativeTestCases = Table(
|
||||||
@ -1252,7 +1252,7 @@ class TypingSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matcher
|
|||||||
|
|
||||||
def checkModule(mod: Module) = {
|
def checkModule(mod: Module) = {
|
||||||
val pkg = Package.apply(List(mod), List.empty, defaultLanguageVersion, None)
|
val pkg = Package.apply(List(mod), List.empty, defaultLanguageVersion, None)
|
||||||
Typing.checkModule(Interface(Map(defaultPackageId -> pkg)), defaultPackageId, mod)
|
Typing.checkModule(PackageInterface(Map(defaultPackageId -> pkg)), defaultPackageId, mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
val negativeTestCases = Table(
|
val negativeTestCases = Table(
|
||||||
@ -1324,6 +1324,6 @@ class TypingSpec extends AnyWordSpec with TableDrivenPropertyChecks with Matcher
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
private val env =
|
private val env =
|
||||||
Typing.Env(LV.default, Interface(Map(defaultPackageId -> pkg)), NoContext)
|
Typing.Env(LV.default, PackageInterface(Map(defaultPackageId -> pkg)), NoContext)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import com.daml.lf.engine.script.ledgerinteraction.{
|
|||||||
import com.daml.lf.iface.EnvironmentInterface
|
import com.daml.lf.iface.EnvironmentInterface
|
||||||
import com.daml.lf.iface.reader.InterfaceReader
|
import com.daml.lf.iface.reader.InterfaceReader
|
||||||
import com.daml.lf.language.Ast._
|
import com.daml.lf.language.Ast._
|
||||||
import com.daml.lf.language.{Interface, LanguageVersion}
|
import com.daml.lf.language.{PackageInterface, LanguageVersion}
|
||||||
import com.daml.lf.interpretation.{Error => IE}
|
import com.daml.lf.interpretation.{Error => IE}
|
||||||
import com.daml.lf.speedy.SBuiltin.SBToAny
|
import com.daml.lf.speedy.SBuiltin.SBToAny
|
||||||
import com.daml.lf.speedy.SExpr._
|
import com.daml.lf.speedy.SExpr._
|
||||||
@ -352,7 +352,7 @@ private[lf] class Runner(
|
|||||||
override def getDefinition(dref: SDefinitionRef): Option[SDefinition] =
|
override def getDefinition(dref: SDefinitionRef): Option[SDefinition] =
|
||||||
fromLedgerValue.andThen(Some(_)).applyOrElse(dref, compiledPackages.getDefinition)
|
fromLedgerValue.andThen(Some(_)).applyOrElse(dref, compiledPackages.getDefinition)
|
||||||
// FIXME: avoid override of non abstract method
|
// FIXME: avoid override of non abstract method
|
||||||
override def interface: Interface = compiledPackages.interface
|
override def interface: PackageInterface = compiledPackages.interface
|
||||||
override def packageIds: collection.Set[PackageId] = compiledPackages.packageIds
|
override def packageIds: collection.Set[PackageId] = compiledPackages.packageIds
|
||||||
// FIXME: avoid override of non abstract method
|
// FIXME: avoid override of non abstract method
|
||||||
override def definitions: PartialFunction[SDefinitionRef, SDefinition] =
|
override def definitions: PartialFunction[SDefinitionRef, SDefinition] =
|
||||||
|
@ -13,7 +13,7 @@ import com.google.protobuf.ByteString
|
|||||||
import scala.jdk.CollectionConverters._
|
import scala.jdk.CollectionConverters._
|
||||||
import scala.Ordering.Implicits._
|
import scala.Ordering.Implicits._
|
||||||
|
|
||||||
final class TypedValueExtractor(interface: language.Interface) {
|
final class TypedValueExtractor(interface: language.PackageInterface) {
|
||||||
|
|
||||||
private[this] def handleLookup[X](lookup: => Either[language.LookupError, X]) =
|
private[this] def handleLookup[X](lookup: => Either[language.LookupError, X]) =
|
||||||
lookup match {
|
lookup match {
|
||||||
|
@ -16,7 +16,7 @@ private[replay] final class Adapter(
|
|||||||
pkgLangVersion: Ref.PackageId => LanguageVersion,
|
pkgLangVersion: Ref.PackageId => LanguageVersion,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val interface = com.daml.lf.language.Interface(packages)
|
private val interface = com.daml.lf.language.PackageInterface(packages)
|
||||||
|
|
||||||
def adapt(tx: Tx.Transaction): SubmittedTransaction =
|
def adapt(tx: Tx.Transaction): SubmittedTransaction =
|
||||||
tx.foldWithPathState(TxBuilder(pkgLangVersion), Option.empty[NodeId])(
|
tx.foldWithPathState(TxBuilder(pkgLangVersion), Option.empty[NodeId])(
|
||||||
|
Loading…
Reference in New Issue
Block a user