daml-lf: prepare release of LF 1.7 (#3329)

* daml-lf: prepare release of LF 1.7

* add comment
This commit is contained in:
Remy 2019-11-04 22:57:35 +01:00 committed by GitHub
parent b06a62e543
commit 7d8a484ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 33 deletions

View File

@ -630,8 +630,6 @@ decodePrimLit :: LF1.PrimLit -> Decode BuiltinExpr
decodePrimLit (LF1.PrimLit mbSum) = mayDecode "primLitSum" mbSum $ \case
LF1.PrimLitSumInt64 sInt -> pure $ BEInt64 sInt
LF1.PrimLitSumDecimalStr sDec -> decodeDecimalLit $ decodeString sDec
LF1.PrimLitSumDecimalInternedStr strId -> lookupString strId >>= decodeDecimalLit
LF1.PrimLitSumNumericStr sNum -> decodeNumericLit $ decodeString sNum
LF1.PrimLitSumNumericInternedStr strId -> lookupString strId >>= decodeNumericLit
LF1.PrimLitSumTimestamp sTime -> pure $ BETimestamp sTime
LF1.PrimLitSumTextStr x -> pure $ BEText $ decodeString x

View File

@ -328,11 +328,9 @@ encodeBuiltinExpr :: BuiltinExpr -> Encode P.ExprSum
encodeBuiltinExpr = \case
BEInt64 x -> pureLit $ P.PrimLitSumInt64 x
BEDecimal dec ->
lit . either P.PrimLitSumDecimalStr P.PrimLitSumDecimalInternedStr
<$> encodeInternableString (T.pack (show dec))
BENumeric n ->
lit . either P.PrimLitSumNumericStr P.PrimLitSumNumericInternedStr
<$> encodeInternableString (T.pack (show n))
pureLit $ P.PrimLitSumDecimalStr $ encodeString (T.pack (show dec))
BENumeric num ->
lit . P.PrimLitSumNumericInternedStr <$> allocString (T.pack (show num))
BEText x ->
lit . either P.PrimLitSumTextStr P.PrimLitSumTextInternedStr
<$> encodeInternableString x

View File

@ -510,8 +510,8 @@ message PrimLit {
// *Must be a valid representation of decimal*
string decimal_str = 2; // *Available in versions < 1.dev*
// *Must be a valid interned decimal*
int32 decimal_interned_str = 10; // *Available in versions >= 1.dev* // *Available in version < 1.dev*
// *Must be a valid interned numeric */
int32 numeric_interned_str = 10; // *Available in versions >= 1.dev*
string text_str = 4; // *Available in version < 1.dev*
@ -529,12 +529,6 @@ message PrimLit {
// *Must be a valid date*
int32 date = 8;
// *Must be a valid numeric */
string numeric_str = 9; // *Available in versions >= 1.dev* // *Available in version < 1.dev*
// *Must be a valid interned numeric */
int32 numeric_interned_str = 13; // *Available in versions >= 1.dev*
}
reserved 3; // This was char.

View File

@ -1103,10 +1103,6 @@ private[archive] class DecodeV1(minor: LV.Minor) extends Decode.OfPackage[PLF.Pa
assertUntil(LV.Features.numeric, "PrimLit.decimal")
assertUntil(LV.Features.internedStrings, "PrimLit.decimal_str")
toPLDecimal(lfPrimLit.getDecimalStr)
case PLF.PrimLit.SumCase.NUMERIC_STR =>
assertSince(LV.Features.numeric, "PrimLit.numeric")
assertUntil(LV.Features.internedStrings, "PrimLit.numeric_str")
toPLNumeric(lfPrimLit.getNumericStr)
case PLF.PrimLit.SumCase.TEXT_STR =>
assertUntil(LV.Features.internedStrings, "PrimLit.text_str")
PLText(lfPrimLit.getTextStr)
@ -1122,10 +1118,6 @@ private[archive] class DecodeV1(minor: LV.Minor) extends Decode.OfPackage[PLF.Pa
case PLF.PrimLit.SumCase.TEXT_INTERNED_STR =>
assertSince(LV.Features.internedStrings, "PrimLit.text_interned_str")
PLText(getInternedStr(lfPrimLit.getTextInternedStr))
case PLF.PrimLit.SumCase.DECIMAL_INTERNED_STR =>
assertUntil(LV.Features.numeric, "PrimLit.decimal_interned_str")
assertSince(LV.Features.internedStrings, "PrimLit.decimal_interned_str")
toPLDecimal(getInternedStr(lfPrimLit.getDecimalInternedStr))
case PLF.PrimLit.SumCase.NUMERIC_INTERNED_STR =>
assertSince(LV.Features.numeric, "PrimLit.numeric")
assertSince(LV.Features.internedStrings, "PrimLit.decimal_interned_str")

View File

@ -389,12 +389,9 @@ private[digitalasset] class EncodeV1(val minor: LV.Minor) {
case PLNumeric(value) =>
if (versionIsOlderThan(LV.Features.numeric)) {
assert(value.scale == Decimal.scale)
setString(
Numeric.toUnscaledString(value),
builder.setDecimalStr,
builder.setDecimalInternedStr)
builder.setDecimalStr(Numeric.toUnscaledString(value))
} else
setString(Numeric.toString(value), builder.setNumericStr, builder.setNumericInternedStr)
builder.setNumericInternedStr(stringsTable.insert(Numeric.toString(value)))
case PLText(value) =>
setString(value, builder.setTextStr, builder.setTextInternedStr)
case PLTimestamp(value) =>

View File

@ -40,6 +40,10 @@ object LanguageVersion {
private val List(v1_0, v1_1, v1_2, v1_3, v1_4, v1_5, v1_6, v1_dev) =
Major.V1.supportedMinorVersions.map(LanguageVersion(Major.V1, _))
// FIXME https://github.com/digital-asset/daml/issues/2289
// Change the following line LF 1.7 freeze
val v1_7 = v1_dev
val default = v1_0
val arrowType = v1_1
val optional = v1_1
@ -55,11 +59,11 @@ object LanguageVersion {
val textPacking = v1_6
val enum = v1_6
val internedPackageId = v1_6
val internedStrings = v1_dev
val internedDottedNames = v1_dev
val numeric = v1_dev
val anyType = v1_dev
val typeRep = v1_dev
val internedStrings = v1_7
val internedDottedNames = v1_7
val numeric = v1_7
val anyType = v1_7
val typeRep = v1_7
/** See <https://github.com/digital-asset/daml/issues/1866>. To not break backwards
* compatibility, we introduce a new DAML-LF version where this restriction is in