mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
replace custom toOptional in interface library with scala-library method (#14487)
CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
8d93efdd12
commit
67b47c6dff
@ -31,6 +31,7 @@ import com.daml.lf.data.Ref
|
||||
import com.daml.nonempty.NonEmpty
|
||||
|
||||
import scala.jdk.CollectionConverters._
|
||||
import scala.jdk.OptionConverters._
|
||||
|
||||
case class DefDataType[+RF, +VF](typeVars: ImmArraySeq[Ref.Name], dataType: DataType[RF, VF]) {
|
||||
def bimap[C, D](f: RF => C, g: VF => D): DefDataType[C, D] =
|
||||
@ -211,7 +212,7 @@ final case class DefTemplate[+Ty](
|
||||
copy(tChoices = r))
|
||||
}
|
||||
|
||||
def getKey: j.Optional[_ <: Ty] = toOptional(key)
|
||||
def getKey: j.Optional[_ <: Ty] = key.toJava
|
||||
|
||||
private[iface] def extendWithInterface[OTy >: Ty](
|
||||
ifaceName: Ref.TypeConName,
|
||||
@ -304,7 +305,7 @@ sealed abstract class TemplateChoices[+Ty] extends Product with Serializable {
|
||||
|
||||
final def getResolvedChoices
|
||||
: j.Map[Ref.ChoiceName, _ <: j.Map[j.Optional[Ref.TypeConName], _ <: TemplateChoice[Ty]]] =
|
||||
resolvedChoices.transform((_, m) => m.forgetNE.mapKeys(toOptional).asJava).asJava
|
||||
resolvedChoices.transform((_, m) => m.forgetNE.mapKeys(_.toJava).asJava).asJava
|
||||
|
||||
/** Coerce to [[Resolved]] based on the environment `astInterfaces`, or fail
|
||||
* with the choices that could not be resolved.
|
||||
|
@ -3,9 +3,7 @@
|
||||
|
||||
package com.daml.lf
|
||||
|
||||
import java.{util => j}
|
||||
|
||||
import com.daml.lf.data.Ref
|
||||
import data.Ref
|
||||
|
||||
// Types to be used internally
|
||||
package object iface {
|
||||
@ -19,7 +17,4 @@ package object iface {
|
||||
private[iface] def lfprintln(
|
||||
@deprecated("shut up unused arguments warning", "") s: => String
|
||||
): Unit = ()
|
||||
|
||||
private[iface] def toOptional[A](o: Option[A]): j.Optional[A] =
|
||||
o.fold(j.Optional.empty[A])(j.Optional.of)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user