Skip to content

Commit

Permalink
make DevValue.is_test dev-only (#18764)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbrauner-da authored Mar 15, 2024
1 parent d1453ec commit 12e0169
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,7 @@ message DefValue {

Expr expr = 3;

bool is_test = 4;

bool is_test = 1000; // *Available in versions >= 2.dev*
}

message FeatureFlags {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ private[archive] class DecodeV2(minor: LV.Minor) {
}

private def decodeDefValue(lfValue: PLF.DefValue): Work[DValue] = {
if (lfValue.getIsTest) {
assertSince(LV.Features.scenarios, "is_test")
}
val name = getInternedDottedName(lfValue.getNameWithType.getNameInternedDname)
decodeType(lfValue.getNameWithType.getType) { typ =>
decodeExpr(lfValue.getExpr, name.toString) { body =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,9 @@ private[daml] class EncodeV2(minorLanguageVersion: LV.Minor) {

private implicit def encodeValueDef(nameWithDef: (DottedName, DValue)): PLF.DefValue = {
val (dottedName, value) = nameWithDef
if (value.isTest) {
assertSince(LV.Features.scenarios, "Value.isTest")
}
PLF.DefValue
.newBuilder()
.setNameWithType(dottedName -> value.typ)
Expand Down

0 comments on commit 12e0169

Please sign in to comment.