diff --git a/daml-lf/archive/src/main/scala/com/digitalasset/daml/lf/archive/DecodeV1.scala b/daml-lf/archive/src/main/scala/com/digitalasset/daml/lf/archive/DecodeV1.scala index 2f5318e3908c..03d7798a4058 100644 --- a/daml-lf/archive/src/main/scala/com/digitalasset/daml/lf/archive/DecodeV1.scala +++ b/daml-lf/archive/src/main/scala/com/digitalasset/daml/lf/archive/DecodeV1.scala @@ -1708,34 +1708,34 @@ private[lf] object DecodeV1 { maxVersion = Some(genComparison), implicitParameters = List(TParty), ), - BuiltinFunctionInfo(INT64_TO_TEXT, BToTextInt64), + BuiltinFunctionInfo(INT64_TO_TEXT, BInt64ToText), BuiltinFunctionInfo( DECIMAL_TO_TEXT, - BToTextNumeric, + BNumericToText, maxVersion = Some(numeric), implicitParameters = List(TNat.Decimal), ), - BuiltinFunctionInfo(NUMERIC_TO_TEXT, BToTextNumeric, minVersion = numeric), - BuiltinFunctionInfo(TIMESTAMP_TO_TEXT, BToTextTimestamp), - BuiltinFunctionInfo(PARTY_TO_TEXT, BToTextParty), - BuiltinFunctionInfo(TEXT_TO_TEXT, BToTextText), + BuiltinFunctionInfo(NUMERIC_TO_TEXT, BNumericToText, minVersion = numeric), + BuiltinFunctionInfo(TIMESTAMP_TO_TEXT, BTimestampToText), + BuiltinFunctionInfo(PARTY_TO_TEXT, BPartyToText), + BuiltinFunctionInfo(TEXT_TO_TEXT, BTextToText), BuiltinFunctionInfo( CONTRACT_ID_TO_TEXT, - BToTextContractId, + BContractIdToText, minVersion = contractIdTextConversions, ), - BuiltinFunctionInfo(PARTY_TO_QUOTED_TEXT, BToQuotedTextParty, maxVersion = Some(exceptions)), - BuiltinFunctionInfo(CODE_POINTS_TO_TEXT, BToTextCodePoints, minVersion = textPacking), - BuiltinFunctionInfo(TEXT_TO_PARTY, BFromTextParty), - BuiltinFunctionInfo(TEXT_TO_INT64, BFromTextInt64), + BuiltinFunctionInfo(PARTY_TO_QUOTED_TEXT, BPartyToQuotedText, maxVersion = Some(exceptions)), + BuiltinFunctionInfo(CODE_POINTS_TO_TEXT, BCodePointsToText, minVersion = textPacking), + BuiltinFunctionInfo(TEXT_TO_PARTY, BTextToParty), + BuiltinFunctionInfo(TEXT_TO_INT64, BTextToInt64), BuiltinFunctionInfo( TEXT_TO_DECIMAL, - BFromTextNumeric, + BTextToNumeric, implicitParameters = List(TNat.Decimal), maxVersion = Some(numeric), ), - BuiltinFunctionInfo(TEXT_TO_NUMERIC, BFromTextNumeric, minVersion = numeric), - BuiltinFunctionInfo(TEXT_POINTS_TO_CODE, BFromTextCodePoints, minVersion = textPacking), + BuiltinFunctionInfo(TEXT_TO_NUMERIC, BTextToNumeric, minVersion = numeric), + BuiltinFunctionInfo(TEXT_POINTS_TO_CODE, BTextToCodePoints, minVersion = textPacking), BuiltinFunctionInfo(SHA256_TEXT, BSHA256Text), BuiltinFunctionInfo(DATE_TO_UNIX_DAYS, BDateToUnixDays), BuiltinFunctionInfo(EXPLODE_TEXT, BExplodeText), @@ -1759,7 +1759,7 @@ private[lf] object DecodeV1 { maxVersion = Some(genComparison), ), BuiltinFunctionInfo(TIMESTAMP_TO_UNIX_MICROSECONDS, BTimestampToUnixMicroseconds), - BuiltinFunctionInfo(DATE_TO_TEXT, BToTextDate), + BuiltinFunctionInfo(DATE_TO_TEXT, BDateToText), BuiltinFunctionInfo(UNIX_DAYS_TO_DATE, BUnixDaysToDate), BuiltinFunctionInfo(UNIX_MICROSECONDS_TO_TIMESTAMP, BUnixMicrosecondsToTimestamp), BuiltinFunctionInfo( @@ -1839,9 +1839,9 @@ private[lf] object DecodeV1 { BuiltinFunctionInfo(MUL_BIGNUMERIC, BMulBigNumeric, minVersion = bigNumeric), BuiltinFunctionInfo(DIV_BIGNUMERIC, BDivBigNumeric, minVersion = bigNumeric), BuiltinFunctionInfo(SHIFT_RIGHT_BIGNUMERIC, BShiftRightBigNumeric, minVersion = bigNumeric), - BuiltinFunctionInfo(BIGNUMERIC_TO_NUMERIC, BToNumericBigNumeric, minVersion = bigNumeric), - BuiltinFunctionInfo(NUMERIC_TO_BIGNUMERIC, BToBigNumericNumeric, minVersion = bigNumeric), - BuiltinFunctionInfo(BIGNUMERIC_TO_TEXT, BToTextBigNumeric, minVersion = bigNumeric), + BuiltinFunctionInfo(BIGNUMERIC_TO_NUMERIC, BBigNumericToNumeric, minVersion = bigNumeric), + BuiltinFunctionInfo(NUMERIC_TO_BIGNUMERIC, BNumericToBigNumeric, minVersion = bigNumeric), + BuiltinFunctionInfo(BIGNUMERIC_TO_TEXT, BBigNumericToText, minVersion = bigNumeric), BuiltinFunctionInfo(ANY_EXCEPTION_MESSAGE, BAnyExceptionMessage, minVersion = exceptions), BuiltinFunctionInfo( ANY_EXCEPTION_IS_ARITHMETIC_ERROR, diff --git a/daml-lf/archive/src/test/scala/com/digitalasset/daml/lf/archive/DecodeV1Spec.scala b/daml-lf/archive/src/test/scala/com/digitalasset/daml/lf/archive/DecodeV1Spec.scala index 7b88f475dd60..b1090ba31ae1 100644 --- a/daml-lf/archive/src/test/scala/com/digitalasset/daml/lf/archive/DecodeV1Spec.scala +++ b/daml-lf/archive/src/test/scala/com/digitalasset/daml/lf/archive/DecodeV1Spec.scala @@ -435,12 +435,12 @@ class DecodeV1Spec ( DamlLf1.BuiltinFunction.DECIMAL_TO_TEXT, "6", - Ast.ETyApp(Ast.EBuiltin(Ast.BToTextNumeric), TDecimalScale), + Ast.ETyApp(Ast.EBuiltin(Ast.BNumericToText), TDecimalScale), ), ( DamlLf1.BuiltinFunction.TEXT_TO_DECIMAL, "6", - Ast.ETyApp(Ast.EBuiltin(Ast.BFromTextNumeric), TDecimalScale), + Ast.ETyApp(Ast.EBuiltin(Ast.BTextToNumeric), TDecimalScale), ), ( DamlLf1.BuiltinFunction.INT64_TO_DECIMAL, @@ -462,8 +462,8 @@ class DecodeV1Spec DamlLf1.BuiltinFunction.MUL_NUMERIC -> Ast.EBuiltin(Ast.BMulNumeric), DamlLf1.BuiltinFunction.DIV_NUMERIC -> Ast.EBuiltin(Ast.BDivNumeric), DamlLf1.BuiltinFunction.ROUND_NUMERIC -> Ast.EBuiltin(Ast.BRoundNumeric), - DamlLf1.BuiltinFunction.NUMERIC_TO_TEXT -> Ast.EBuiltin(Ast.BToTextNumeric), - DamlLf1.BuiltinFunction.TEXT_TO_NUMERIC -> Ast.EBuiltin(Ast.BFromTextNumeric), + DamlLf1.BuiltinFunction.NUMERIC_TO_TEXT -> Ast.EBuiltin(Ast.BNumericToText), + DamlLf1.BuiltinFunction.TEXT_TO_NUMERIC -> Ast.EBuiltin(Ast.BTextToNumeric), DamlLf1.BuiltinFunction.INT64_TO_NUMERIC -> Ast.EBuiltin(Ast.BInt64ToNumeric), DamlLf1.BuiltinFunction.NUMERIC_TO_INT64 -> Ast.EBuiltin(Ast.BNumericToInt64), ) @@ -525,7 +525,7 @@ class DecodeV1Spec val contractIdTextConversionCases = Table( "builtin" -> "expected output", - DamlLf1.BuiltinFunction.CONTRACT_ID_TO_TEXT -> Ast.EBuiltin(Ast.BToTextContractId), + DamlLf1.BuiltinFunction.CONTRACT_ID_TO_TEXT -> Ast.EBuiltin(Ast.BContractIdToText), ) "translate non numeric/decimal builtin as is for any version" in { @@ -788,11 +788,11 @@ class DecodeV1Spec DamlLf1.BuiltinFunction.DIV_BIGNUMERIC -> Ast.EBuiltin(Ast.BDivBigNumeric), DamlLf1.BuiltinFunction.NUMERIC_TO_BIGNUMERIC -> - Ast.EBuiltin(Ast.BToBigNumericNumeric), + Ast.EBuiltin(Ast.BNumericToBigNumeric), DamlLf1.BuiltinFunction.BIGNUMERIC_TO_NUMERIC -> - Ast.EBuiltin(Ast.BToNumericBigNumeric), + Ast.EBuiltin(Ast.BBigNumericToNumeric), DamlLf1.BuiltinFunction.BIGNUMERIC_TO_TEXT -> - Ast.EBuiltin(Ast.BToTextBigNumeric), + Ast.EBuiltin(Ast.BBigNumericToText), ) forEveryVersion { version => diff --git a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Compiler.scala b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Compiler.scala index 7ff13e0a00fd..38d10f478e11 100644 --- a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Compiler.scala +++ b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Compiler.scala @@ -478,7 +478,7 @@ private[lf] final class Compiler( case BGreaterNumeric => SBGreaterNumeric case BGreaterEqNumeric => SBGreaterEqNumeric case BEqualNumeric => SBEqualNumeric - case BToTextNumeric => SBEToTextNumeric + case BNumericToText => SBEToTextNumeric case BTextMapEmpty => SEValue.EmptyTextMap case BGenMapEmpty => SEValue.EmptyGenMap @@ -516,18 +516,18 @@ private[lf] final class Compiler( case BImplodeText => SBImplodeText case BAppendText => SBAppendText - case BToTextInt64 => SBToText - case BToTextText => SBToText - case BToTextTimestamp => SBToText - case BToTextParty => SBToText - case BToTextDate => SBToText - case BToTextContractId => SBToTextContractId - case BToQuotedTextParty => SBToQuotedTextParty - case BToTextCodePoints => SBToTextCodePoints - case BFromTextParty => SBFromTextParty - case BFromTextInt64 => SBFromTextInt64 - case BFromTextNumeric => SBFromTextNumeric - case BFromTextCodePoints => SBFromTextCodePoints + case BInt64ToText => SBToText + case BTextToText => SBToText + case BTimestampToText => SBToText + case BPartyToText => SBToText + case BDateToText => SBToText + case BContractIdToText => SBContractIdToText + case BPartyToQuotedText => SBPartyToQuotedText + case BCodePointsToText => SBCodePointsToText + case BTextToParty => SBTextToParty + case BTextToInt64 => SBTextToInt64 + case BTextToNumeric => SBTextToNumeric + case BTextToCodePoints => SBTextToCodePoints case BSHA256Text => SBSHA256Text @@ -570,9 +570,9 @@ private[lf] final class Compiler( case BDivBigNumeric => SBDivBigNumeric case BMulBigNumeric => SBMulBigNumeric case BShiftRightBigNumeric => SBShiftRightBigNumeric - case BToBigNumericNumeric => SBToBigNumericNumeric - case BToNumericBigNumeric => SBToNumericBigNumeric - case BToTextBigNumeric => SBToText + case BNumericToBigNumeric => SBNumericToBigNumeric + case BBigNumericToNumeric => SBBigNumericToNumeric + case BBigNumericToText => SBToText // Unstable Text Primitives case BTextToUpper => SBTextToUpper @@ -587,7 +587,7 @@ private[lf] final class Compiler( // Implemented using normal SExpr case BFoldl | BFoldr | BCoerceContractId | BEqual | BEqualList | BLessEq | BLess | BGreaterEq | BGreater | BLessNumeric | BLessEqNumeric | BGreaterNumeric | - BGreaterEqNumeric | BEqualNumeric | BToTextNumeric | BTextMapEmpty | BGenMapEmpty => + BGreaterEqNumeric | BEqualNumeric | BNumericToText | BTextMapEmpty | BGenMapEmpty => throw CompilationError(s"unexpected $bf") case BAnyExceptionMessage => SBAnyExceptionMessage diff --git a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SBuiltin.scala b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SBuiltin.scala index 4e98c86535f1..dad751766209 100644 --- a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SBuiltin.scala +++ b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SBuiltin.scala @@ -424,7 +424,7 @@ private[lf] object SBuiltin { SText(litToText(args.get(0))) } - final case object SBToTextContractId extends SBuiltin(1) { + final case object SBContractIdToText extends SBuiltin(1) { override private[speedy] final def execute( args: util.ArrayList[SValue], machine: Machine, @@ -439,19 +439,19 @@ private[lf] object SBuiltin { } } - final case object SBToQuotedTextParty extends SBuiltinPure(1) { + final case object SBPartyToQuotedText extends SBuiltinPure(1) { override private[speedy] final def executePure(args: util.ArrayList[SValue]): SValue = SText(s"'${getSParty(args, 0): String}'") } - final case object SBToTextCodePoints extends SBuiltinPure(1) { + final case object SBCodePointsToText extends SBuiltinPure(1) { override private[speedy] final def executePure(args: util.ArrayList[SValue]): SValue = { val codePoints = getSList(args, 0).map(_.asInstanceOf[SInt64].value) SText(Utf8.pack(codePoints.toImmArray)) } } - final case object SBFromTextParty extends SBuiltinPure(1) { + final case object SBTextToParty extends SBuiltinPure(1) { override private[speedy] final def executePure(args: util.ArrayList[SValue]): SValue = { Party.fromString(getSText(args, 0)) match { case Left(_) => SV.None @@ -460,7 +460,7 @@ private[lf] object SBuiltin { } } - final case object SBFromTextInt64 extends SBuiltinPure(1) { + final case object SBTextToInt64 extends SBuiltinPure(1) { private val pattern = """[+-]?\d+""".r.pattern override private[speedy] final def executePure(args: util.ArrayList[SValue]): SValue = { @@ -481,7 +481,7 @@ private[lf] object SBuiltin { // accept and convert. In particular it should convert any string with an arbitrary number of // leading and trailing '0's as long as the corresponding number fits a Numeric without loss of // precision. We should take care not calling String to BigDecimal conversion on huge strings. - final case object SBFromTextNumeric extends SBuiltinPure(2) { + final case object SBTextToNumeric extends SBuiltinPure(2) { private val validFormat = """([+-]?)0*(\d+)(\.(\d*[1-9]|0)0*)?""".r @@ -512,7 +512,7 @@ private[lf] object SBuiltin { } } - final case object SBFromTextCodePoints extends SBuiltinPure(1) { + final case object SBTextToCodePoints extends SBuiltinPure(1) { override private[speedy] final def executePure(args: util.ArrayList[SValue]): SValue = { val string = getSText(args, 0) val codePoints = Utf8.unpack(string) @@ -879,14 +879,14 @@ private[lf] object SBuiltin { } } - final object SBToBigNumericNumeric extends SBuiltinPure(2) { + final object SBNumericToBigNumeric extends SBuiltinPure(2) { override private[speedy] def executePure(args: util.ArrayList[SValue]): SBigNumeric = { val x = getSNumeric(args, 1) SBigNumeric.fromNumeric(x) } } - final object SBToNumericBigNumeric extends SBBuiltinArithmetic("BIGNUMERIC_TO_NUMERIC", 2) { + final object SBBigNumericToNumeric extends SBBuiltinArithmetic("BIGNUMERIC_TO_NUMERIC", 2) { override private[speedy] def compute(args: util.ArrayList[SValue]): Option[SNumeric] = { val scale = getSTNat(args, 0) val x = getSBigNumeric(args, 1) diff --git a/daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/SBuiltinTest.scala b/daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/SBuiltinTest.scala index 594121b523b4..cbaa9c201adb 100644 --- a/daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/SBuiltinTest.scala +++ b/daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/SBuiltinTest.scala @@ -1459,7 +1459,7 @@ class SBuiltinTest extends AnyFreeSpec with Matchers with TableDrivenPropertyChe "SHIFT_RIGHT_BIGNUMERIC", ), ( - SBToNumericBigNumeric, + SBBigNumericToNumeric, List[SValue](TMinScale, VeryBigBigNumericA), "BIGNUMERIC_TO_NUMERIC", ), diff --git a/daml-lf/language/src/main/scala/com/digitalasset/daml/lf/language/Ast.scala b/daml-lf/language/src/main/scala/com/digitalasset/daml/lf/language/Ast.scala index de18de49b2b3..6a9a7ddfc944 100644 --- a/daml-lf/language/src/main/scala/com/digitalasset/daml/lf/language/Ast.scala +++ b/daml-lf/language/src/main/scala/com/digitalasset/daml/lf/language/Ast.scala @@ -398,20 +398,20 @@ object Ast { final case object BImplodeText extends BuiltinFunction // : List Text -> Text final case object BAppendText extends BuiltinFunction // : Text → Text → Text - final case object BToTextInt64 extends BuiltinFunction // Int64 → Text - final case object BToTextNumeric extends BuiltinFunction // : ∀s. Numeric s → Text - final case object BToTextText extends BuiltinFunction // : Text → Text - final case object BToTextTimestamp extends BuiltinFunction // : Timestamp → Text - final case object BToTextParty extends BuiltinFunction // : Party → Text - final case object BToTextDate extends BuiltinFunction // : Date -> Text - final case object BToTextContractId + final case object BInt64ToText extends BuiltinFunction // Int64 → Text + final case object BNumericToText extends BuiltinFunction // : ∀s. Numeric s → Text + final case object BTextToText extends BuiltinFunction // : Text → Text + final case object BTimestampToText extends BuiltinFunction // : Timestamp → Text + final case object BPartyToText extends BuiltinFunction // : Party → Text + final case object BDateToText extends BuiltinFunction // : Date -> Text + final case object BContractIdToText extends BuiltinFunction // : forall t. ContractId t -> Optional Text - final case object BToQuotedTextParty extends BuiltinFunction // : Party -> Text - final case object BToTextCodePoints extends BuiltinFunction // : [Int64] -> Text - final case object BFromTextParty extends BuiltinFunction // : Text -> Optional Party - final case object BFromTextInt64 extends BuiltinFunction // : Text -> Optional Int64 - final case object BFromTextNumeric extends BuiltinFunction // : ∀s. Text -> Optional (Numeric s) - final case object BFromTextCodePoints extends BuiltinFunction // : Text -> List Int64 + final case object BPartyToQuotedText extends BuiltinFunction // : Party -> Text + final case object BCodePointsToText extends BuiltinFunction // : [Int64] -> Text + final case object BTextToParty extends BuiltinFunction // : Text -> Optional Party + final case object BTextToInt64 extends BuiltinFunction // : Text -> Optional Int64 + final case object BTextToNumeric extends BuiltinFunction // : ∀s. Text -> Optional (Numeric s) + final case object BTextToCodePoints extends BuiltinFunction // : Text -> List Int64 final case object BSHA256Text extends BuiltinFunction // : Text -> Text @@ -455,9 +455,9 @@ object Ast { extends BuiltinFunction // : Int64 -> RoundingMode → BigNumeric → BigNumeric → BigNumeric s final case object BShiftRightBigNumeric extends BuiltinFunction // : Int64 → BigNumeric → BigNumeric - final case object BToNumericBigNumeric extends BuiltinFunction // : ∀s. BigNumeric → Numeric s - final case object BToBigNumericNumeric extends BuiltinFunction // : ∀s. Numeric s → BigNumeric - final case object BToTextBigNumeric extends BuiltinFunction // : BigNumeric → Text + final case object BBigNumericToNumeric extends BuiltinFunction // : ∀s. BigNumeric → Numeric s + final case object BNumericToBigNumeric extends BuiltinFunction // : ∀s. Numeric s → BigNumeric + final case object BBigNumericToText extends BuiltinFunction // : BigNumeric → Text // Unstable Text Primitives final case object BTextToUpper extends BuiltinFunction // Text → Text diff --git a/daml-lf/parser/src/main/scala/com/digitalasset/daml/lf/testing/parser/ExprParser.scala b/daml-lf/parser/src/main/scala/com/digitalasset/daml/lf/testing/parser/ExprParser.scala index 38bf719d767c..e56836eee348 100644 --- a/daml-lf/parser/src/main/scala/com/digitalasset/daml/lf/testing/parser/ExprParser.scala +++ b/daml-lf/parser/src/main/scala/com/digitalasset/daml/lf/testing/parser/ExprParser.scala @@ -283,19 +283,19 @@ private[parser] class ExprParser[P](parserParameters: ParserParameters[P]) { "IMPLODE_TEXT" -> BImplodeText, "APPEND_TEXT" -> BAppendText, "SHA256_TEXT" -> BSHA256Text, - "INT64_TO_TEXT" -> BToTextInt64, - "NUMERIC_TO_TEXT" -> BToTextNumeric, - "TEXT_TO_TEXT" -> BToTextText, - "TIMESTAMP_TO_TEXT" -> BToTextTimestamp, - "PARTY_TO_TEXT" -> BToTextParty, - "DATE_TO_TEXT" -> BToTextDate, - "CONTRACT_ID_TO_TEXT" -> BToTextContractId, - "PARTY_TO_QUOTED_TEXT" -> BToQuotedTextParty, - "CODE_POINTS_TO_TEXT" -> BToTextCodePoints, - "TEXT_TO_PARTY" -> BFromTextParty, - "TEXT_TO_INT64" -> BFromTextInt64, - "TEXT_TO_NUMERIC" -> BFromTextNumeric, - "TEXT_POINTS_TO_CODE" -> BFromTextCodePoints, + "INT64_TO_TEXT" -> BInt64ToText, + "NUMERIC_TO_TEXT" -> BNumericToText, + "TEXT_TO_TEXT" -> BTextToText, + "TIMESTAMP_TO_TEXT" -> BTimestampToText, + "PARTY_TO_TEXT" -> BPartyToText, + "DATE_TO_TEXT" -> BDateToText, + "CONTRACT_ID_TO_TEXT" -> BContractIdToText, + "PARTY_TO_QUOTED_TEXT" -> BPartyToQuotedText, + "CODE_POINTS_TO_TEXT" -> BCodePointsToText, + "TEXT_TO_PARTY" -> BTextToParty, + "TEXT_TO_INT64" -> BTextToInt64, + "TEXT_TO_NUMERIC" -> BTextToNumeric, + "TEXT_POINTS_TO_CODE" -> BTextToCodePoints, "ERROR" -> BError, "LESS_NUMERIC" -> BLessNumeric, "LESS_EQ_NUMERIC" -> BLessEqNumeric, @@ -320,9 +320,9 @@ private[parser] class ExprParser[P](parserParameters: ParserParameters[P]) { "MUL_BIGNUMERIC" -> BMulBigNumeric, "DIV_BIGNUMERIC" -> BDivBigNumeric, "SHIFT_RIGHT_BIGNUMERIC" -> BShiftRightBigNumeric, - "BIGNUMERIC_TO_NUMERIC" -> BToNumericBigNumeric, - "NUMERIC_TO_BIGNUMERIC" -> BToBigNumericNumeric, - "BIGNUMERIC_TO_TEXT" -> BToTextBigNumeric, + "BIGNUMERIC_TO_NUMERIC" -> BBigNumericToNumeric, + "NUMERIC_TO_BIGNUMERIC" -> BNumericToBigNumeric, + "BIGNUMERIC_TO_TEXT" -> BBigNumericToText, ) private lazy val experimental: Parser[Expr] = diff --git a/daml-lf/parser/src/test/scala/com/digitalasset/daml/lf/testing/parser/ParsersSpec.scala b/daml-lf/parser/src/test/scala/com/digitalasset/daml/lf/testing/parser/ParsersSpec.scala index 7eef26b52fdd..c15ffc68b7fe 100644 --- a/daml-lf/parser/src/test/scala/com/digitalasset/daml/lf/testing/parser/ParsersSpec.scala +++ b/daml-lf/parser/src/test/scala/com/digitalasset/daml/lf/testing/parser/ParsersSpec.scala @@ -211,12 +211,12 @@ class ParsersSpec extends AnyWordSpec with ScalaCheckPropertyChecks with Matcher "EXPLODE_TEXT" -> BExplodeText, "IMPLODE_TEXT" -> BImplodeText, "APPEND_TEXT" -> BAppendText, - "INT64_TO_TEXT" -> BToTextInt64, - "NUMERIC_TO_TEXT" -> BToTextNumeric, - "TEXT_TO_TEXT" -> BToTextText, - "TIMESTAMP_TO_TEXT" -> BToTextTimestamp, - "PARTY_TO_TEXT" -> BToTextParty, - "DATE_TO_TEXT" -> BToTextDate, + "INT64_TO_TEXT" -> BInt64ToText, + "NUMERIC_TO_TEXT" -> BNumericToText, + "TEXT_TO_TEXT" -> BTextToText, + "TIMESTAMP_TO_TEXT" -> BTimestampToText, + "PARTY_TO_TEXT" -> BPartyToText, + "DATE_TO_TEXT" -> BDateToText, "ERROR" -> BError, "LESS_NUMERIC" -> BLessNumeric, "LESS_EQ_NUMERIC" -> BLessEqNumeric, diff --git a/daml-lf/validation/src/main/scala/com/digitalasset/daml/lf/validation/Typing.scala b/daml-lf/validation/src/main/scala/com/digitalasset/daml/lf/validation/Typing.scala index 7894ad2f985c..ef7160419e46 100644 --- a/daml-lf/validation/src/main/scala/com/digitalasset/daml/lf/validation/Typing.scala +++ b/daml-lf/validation/src/main/scala/com/digitalasset/daml/lf/validation/Typing.scala @@ -184,20 +184,20 @@ private[validation] object Typing { // Text functions BExplodeText -> (TText ->: TList(TText)), BAppendText -> tBinop(TText), - BToTextInt64 -> (TInt64 ->: TText), - BToTextNumeric -> TForall(alpha.name -> KNat, TNumeric(alpha) ->: TText), - BToTextText -> (TText ->: TText), - BToTextTimestamp -> (TTimestamp ->: TText), - BToTextParty -> (TParty ->: TText), - BToTextDate -> (TDate ->: TText), - BToTextContractId -> TForall(alpha.name -> KStar, TContractId(alpha) ->: TOptional(TText)), + BInt64ToText -> (TInt64 ->: TText), + BNumericToText -> TForall(alpha.name -> KNat, TNumeric(alpha) ->: TText), + BTextToText -> (TText ->: TText), + BTimestampToText -> (TTimestamp ->: TText), + BPartyToText -> (TParty ->: TText), + BDateToText -> (TDate ->: TText), + BContractIdToText -> TForall(alpha.name -> KStar, TContractId(alpha) ->: TOptional(TText)), BSHA256Text -> (TText ->: TText), - BToQuotedTextParty -> (TParty ->: TText), - BToTextCodePoints -> (TList(TInt64) ->: TText), - BFromTextParty -> (TText ->: TOptional(TParty)), - BFromTextInt64 -> (TText ->: TOptional(TInt64)), - BFromTextNumeric -> TForall(alpha.name -> KNat, TText ->: TOptional(TNumeric(alpha))), - BFromTextCodePoints -> (TText ->: TList(TInt64)), + BPartyToQuotedText -> (TParty ->: TText), + BCodePointsToText -> (TList(TInt64) ->: TText), + BTextToParty -> (TText ->: TOptional(TParty)), + BTextToInt64 -> (TText ->: TOptional(TInt64)), + BTextToNumeric -> TForall(alpha.name -> KNat, TText ->: TOptional(TNumeric(alpha))), + BTextToCodePoints -> (TText ->: TList(TInt64)), BError -> TForall(alpha.name -> KStar, TText ->: alpha), // ComparisonsA BLessNumeric -> tNumComparison, @@ -231,9 +231,9 @@ private[validation] object Typing { BMulBigNumeric -> (TBigNumeric ->: TBigNumeric ->: TBigNumeric), BDivBigNumeric -> (TInt64 ->: TRoundingMode ->: TBigNumeric ->: TBigNumeric ->: TBigNumeric), BShiftRightBigNumeric -> (TInt64 ->: TBigNumeric ->: TBigNumeric), - BToNumericBigNumeric -> TForall(alpha.name -> KNat, TBigNumeric ->: TNumeric(alpha)), - BToBigNumericNumeric -> TForall(alpha.name -> KNat, TNumeric(alpha) ->: TBigNumeric), - BToTextBigNumeric -> (TBigNumeric ->: TText), + BBigNumericToNumeric -> TForall(alpha.name -> KNat, TBigNumeric ->: TNumeric(alpha)), + BNumericToBigNumeric -> TForall(alpha.name -> KNat, TNumeric(alpha) ->: TBigNumeric), + BBigNumericToText -> (TBigNumeric ->: TText), // Exception functions BAnyExceptionMessage -> (TAnyException ->: TText), BAnyExceptionIsArithmeticError -> (TAnyException ->: TBool),