PackageName format starts with # (#18274) (#18306)

run-all-tests: true
This commit is contained in:
tudor-da 2024-01-29 09:16:40 +01:00 committed by GitHub
parent a9dc2d63d2
commit 3e666850dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -292,7 +292,7 @@ object Ref {
sealed abstract class PackageRef extends Product with Serializable
object PackageRef {
final case class Name(name: PackageName) extends PackageRef {
override def toString: String = "n#" + name
override def toString: String = "#" + name
}
final case class Id(id: PackageId) extends PackageRef {
@ -300,8 +300,8 @@ object Ref {
}
def fromString(s: String): Either[String, PackageRef] =
if (s.startsWith("n#"))
PackageName.fromString(s.drop(2)).map(Name)
if (s.startsWith("#"))
PackageName.fromString(s.drop(1)).map(Name)
else
PackageId.fromString(s).map(Id)

View File

@ -77,7 +77,7 @@ class GrpcLedgerClient(
.getPackageName(compiledPackages, identifier.packageId)
.getOrElse(throw new IllegalArgumentException("Couldn't get package name"))
if (explicitPackageId || !enableContractUpgrading) converted
else converted.copy(packageId = "n#" + pkgName)
else converted.copy(packageId = "#" + pkgName)
}
// TODO[SW]: Currently do not support querying with explicit package id, interface for this yet to be determined