From bab7cf5d765afbe5a5a4e87ed490cce373d4ab60 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Fri, 28 Jun 2024 17:29:22 -0700 Subject: [PATCH 01/30] Parameterize TrOptExpr in its continuation --- .../Backends/Dafny/DafnyCodeGenerator.cs | 4 +-- .../Backends/Java/JavaCodeGenerator.cs | 4 +-- .../SinglePassCodeGenerator.Expression.cs | 8 ++--- .../SinglePassCodeGenerator.cs | 30 ++++++++++--------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs b/Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs index 0bb731ae39f..87d2b4981e1 100644 --- a/Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs +++ b/Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs @@ -2844,8 +2844,8 @@ protected override void EmitNestedMatchExpr(NestedMatchExpr match, bool inLetExp } protected override void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultType, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, - bool inLetExprBody, IVariable accumulatorVar) { - TrExprOpt(match.Flattened, resultType, wr, wStmts, inLetExprBody, accumulatorVar); + bool inLetExprBody, IVariable accumulatorVar, Action continuation) { + TrExprOpt(match.Flattened, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } protected override void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntaxTree writer) { diff --git a/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs b/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs index 8fd4afa98c2..ca10157852d 100644 --- a/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs +++ b/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs @@ -4364,8 +4364,8 @@ protected override void EmitNestedMatchExpr(NestedMatchExpr match, bool inLetExp } protected override void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultType, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, - bool inLetExprBody, IVariable accumulatorVar) { - TrExprOpt(match.Flattened, resultType, wr, wStmts, inLetExprBody, accumulatorVar); + bool inLetExprBody, IVariable accumulatorVar, Action continuation) { + TrExprOpt(match.Flattened, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } protected override void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntaxTree writer) { diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs index 654a5af6623..cf8c1db92ae 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs @@ -699,7 +699,7 @@ private void EmitMatchExpr(MatchExpr e, bool inLetExprBody, ConcreteSyntaxTree w var sourceType = (UserDefinedType)e.Source.Type.NormalizeExpand(); foreach (MatchCaseExpr mc in e.Cases) { var wCase = MatchCasePrelude(source, sourceType, mc.Ctor, mc.Arguments, i, e.Cases.Count, w); - TrExprOpt(mc.Body, mc.Body.Type, wCase, wStmts, inLetExprBody: true, accumulatorVar: null); + TrExprOpt(mc.Body, mc.Body.Type, wCase, wStmts, inLetExprBody: true, accumulatorVar: null, EmitReturnExpr); i++; } } @@ -710,17 +710,17 @@ private void EmitMatchExpr(MatchExpr e, bool inLetExprBody, ConcreteSyntaxTree w protected virtual void EmitNestedMatchExpr(NestedMatchExpr match, bool inLetExprBody, ConcreteSyntaxTree output, ConcreteSyntaxTree wStmts) { var lambdaBody = EmitAppliedLambda(output, wStmts, match.Tok, match.Type); - TrOptNestedMatchExpr(match, match.Type, lambdaBody, wStmts, inLetExprBody, null); + TrOptNestedMatchExpr(match, match.Type, lambdaBody, wStmts, inLetExprBody, null, EmitReturnExpr); } protected virtual void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultType, ConcreteSyntaxTree wr, - ConcreteSyntaxTree wStmts, bool inLetExprBody, IVariable accumulatorVar) { + ConcreteSyntaxTree wStmts, bool inLetExprBody, IVariable accumulatorVar, Action continuation) { wStmts = wr.Fork(); EmitNestedMatchGeneric(match, (caseIndex, caseBody) => { var myCase = match.Cases[caseIndex]; - TrExprOpt(myCase.Body, myCase.Body.Type, caseBody, wStmts, inLetExprBody: true, accumulatorVar: null); + TrExprOpt(myCase.Body, myCase.Body.Type, caseBody, wStmts, inLetExprBody: true, accumulatorVar: null, continuation); }, wr, true); } diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index 7ad99fe4a9d..c0b91f3797f 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -2924,11 +2924,12 @@ void TrCasePatternOpt(CasePattern pat, Expression rhs, Action - protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, bool inLetExprBody, [CanBeNull] IVariable accumulatorVar) { + protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, bool inLetExprBody, + [CanBeNull] IVariable accumulatorVar, Action continuation) { Contract.Requires(expr != null); Contract.Requires(wr != null); - Contract.Requires(resultType != null); Contract.Requires(accumulatorVar == null || (enclosingFunction != null && enclosingFunction.IsAccumulatorTailRecursive)); + Contract.Requires(continuation != null); expr = expr.Resolved; if (expr is LetExpr) { @@ -2940,37 +2941,37 @@ protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr TrCasePatternOpt(lhs, e.RHSs[i], wr, inLetExprBody); } } - TrExprOpt(e.Body, resultType, wr, wStmts, inLetExprBody, accumulatorVar); + TrExprOpt(e.Body, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } else { // We haven't optimized the other cases, so fallback to normal compilation - EmitReturnExpr(e, resultType, inLetExprBody, wr); + continuation(e, resultType, inLetExprBody, wr); } } else if (expr is ITEExpr) { var e = (ITEExpr)expr; switch (e.HowToCompile) { case ITEExpr.ITECompilation.CompileJustThenBranch: - TrExprOpt(e.Thn, resultType, wr, wStmts, inLetExprBody, accumulatorVar); + TrExprOpt(e.Thn, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); break; case ITEExpr.ITECompilation.CompileJustElseBranch: - TrExprOpt(e.Els, resultType, wr, wStmts, inLetExprBody, accumulatorVar); + TrExprOpt(e.Els, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); break; case ITEExpr.ITECompilation.CompileBothBranches: var thn = EmitIf(out var guardWriter, true, wr); EmitExpr(e.Test, inLetExprBody, guardWriter, wStmts); Coverage.Instrument(e.Thn.tok, "then branch", thn); - TrExprOpt(e.Thn, resultType, thn, wStmts, inLetExprBody, accumulatorVar); + TrExprOpt(e.Thn, resultType, thn, wStmts, inLetExprBody, accumulatorVar, continuation); ConcreteSyntaxTree els = wr; if (!(e.Els is ITEExpr { HowToCompile: ITEExpr.ITECompilation.CompileBothBranches })) { els = EmitBlock(wr); Coverage.Instrument(e.Thn.tok, "else branch", els); } - TrExprOpt(e.Els, resultType, els, wStmts, inLetExprBody, accumulatorVar); + TrExprOpt(e.Els, resultType, els, wStmts, inLetExprBody, accumulatorVar, continuation); break; } } else if (expr is NestedMatchExpr nestedMatchExpr) { - TrOptNestedMatchExpr(nestedMatchExpr, resultType, wr, wStmts, inLetExprBody, accumulatorVar); + TrOptNestedMatchExpr(nestedMatchExpr, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } else if (expr is MatchExpr) { var e = (MatchExpr)expr; // var _source = E; @@ -2995,14 +2996,14 @@ protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr var sourceType = (UserDefinedType)e.Source.Type.NormalizeExpand(); foreach (MatchCaseExpr mc in e.Cases) { var w = MatchCasePrelude(source, sourceType, mc.Ctor, mc.Arguments, i, e.Cases.Count, wr); - TrExprOpt(mc.Body, resultType, w, wStmts, inLetExprBody, accumulatorVar); + TrExprOpt(mc.Body, resultType, w, wStmts, inLetExprBody, accumulatorVar, continuation); i++; } } } else if (expr is StmtExpr) { var e = (StmtExpr)expr; - TrExprOpt(e.E, resultType, wr, wStmts, inLetExprBody, accumulatorVar); + TrExprOpt(e.E, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } else if (expr is FunctionCallExpr fce && fce.Function == enclosingFunction && enclosingFunction.IsTailRecursive) { var e = fce; @@ -3088,7 +3089,7 @@ protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr } var wRhs = EmitAssignment(VariableLvalue(accumulatorVar), enclosingFunction.ResultType, enclosingFunction.ResultType, wr, expr.tok); EmitExpr(rhs, false, wRhs, wStmts); - TrExprOpt(tailTerm, resultType, wr, wStmts, inLetExprBody, accumulatorVar); + TrExprOpt(tailTerm, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } else { // We haven't optimized any other cases, so fallback to normal compilation @@ -3130,7 +3131,8 @@ protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr } else { Contract.Assert(accumulatorVar == null); } - EmitReturnExpr(expr, resultType, inLetExprBody, wr); + + continuation(expr, resultType, inLetExprBody, wr); } } @@ -3141,7 +3143,7 @@ void CompileReturnBody(Expression body, Type originalResultType, ConcreteSyntaxT Contract.Requires(accumulatorVar == null || (enclosingFunction != null && enclosingFunction.IsAccumulatorTailRecursive)); copyInstrWriters.Push(wr.Fork()); var wStmts = wr.Fork(); - TrExprOpt(body.Resolved, originalResultType, wr, wStmts, false, accumulatorVar); + TrExprOpt(body.Resolved, originalResultType, wr, wStmts, false, accumulatorVar, EmitReturnExpr); copyInstrWriters.Pop(); } From cf34d7e598e453aaf203dca80875d82f3d173244 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Fri, 28 Jun 2024 17:56:38 -0700 Subject: [PATCH 02/30] Use TrExprOpt for simple assignment statements --- .../SinglePassCodeGenerator.Statement.cs | 21 ++++++++++++---- .../LitTest/git-issues/git-issue-3868.dfy | 23 ++++++++++++++++++ .../git-issues/git-issue-3868.dfy.expect | 1 + .../LitTest/git-issues/git-issue-3868b.dfy | 24 +++++++++++++++++++ 4 files changed, 64 insertions(+), 5 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index d4feaecdeac..eb1ace29bf7 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -116,13 +116,24 @@ protected void TrStmt(Statement stmt, ConcreteSyntaxTree wr, ConcreteSyntaxTree if (Options.ForbidNondeterminism) { Error(ErrorId.c_nondeterminism_forbidden, s.Rhs.Tok, "nondeterministic assignment forbidden by the --enforce-determinism option", wr); } - } else if (s.Rhs is ExprRhs eRhs && eRhs.Expr.Resolved is FunctionCallExpr fce && IsTailRecursiveByMethodCall(fce)) { - TrTailCallStmt(s.Tok, fce.Function.ByMethodDecl, fce.Receiver, fce.Args, null, wr); - } else { + } else if (s.Rhs is TypeRhs typeRhs) { var lvalue = CreateLvalue(s.Lhs, wr, wStmts); wStmts = wr.Fork(); - var wRhs = EmitAssignment(lvalue, TypeOfLhs(s.Lhs), TypeOfRhs(s.Rhs), wr, assignStmt.Tok); - TrRhs(s.Rhs, wRhs, wStmts); + var wRhs = EmitAssignment(lvalue, TypeOfLhs(s.Lhs), TypeOfRhs(typeRhs), wr, assignStmt.Tok); + TrRhs(typeRhs, wRhs, wStmts); + } else { + var eRhs = (ExprRhs)s.Rhs; + if (eRhs.Expr.Resolved is FunctionCallExpr fce && IsTailRecursiveByMethodCall(fce)) { + TrTailCallStmt(s.Tok, fce.Function.ByMethodDecl, fce.Receiver, fce.Args, null, wr); + } else { + var lvalue = CreateLvalue(s.Lhs, wr, wStmts); + var doAssignment = (Expression e, Type resultType, bool inLetExprBody, ConcreteSyntaxTree wrAssignment) => { + var wStmtsBeforeAssignment = wrAssignment.Fork(); + var wRhs = EmitAssignment(lvalue, resultType, e.Type, wrAssignment, assignStmt.Tok); + EmitExpr(e, false, wRhs, wStmtsBeforeAssignment); + }; + TrExprOpt(eRhs.Expr, TypeOfLhs(s.Lhs), wr, wStmts, false, null, doAssignment); + } } break; diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy index a5b424ee52e..87d1c116e27 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy @@ -9,6 +9,8 @@ method Main() { print WoahThat'sDeepToo(AA("i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x"), "555"), "\n"; print "Recur: ", recur.Follow0(A, 12, 80), "\n"; // 116 (that is, 80 + 12*(2 + 1) print "Recur: ", recur.Follow1(A, 12, 80), "\n"; // 116 (that is, 80 + 12*(2 + 1) + var w := DeepAssignment(25); + print w, "\n"; // 25 } method NotOptimized(s: string) returns (r: int) { @@ -163,3 +165,24 @@ datatype Option<+T> = None | Some(value: T) { value } } + +method DeepAssignment(x: int) returns (r: int) { + r := + var x0 := x; + var x1 := x0; + var x2 := x1; + var x3 := x2; + var x4 := x3; + var x5 := x4; + var x6 := x5; + var x7 := x6; + if x0 == x7 then + var y0 := x; + var y1 := y0; + y1 + else + var y2 := x; + var y3 := y2; + y3; + return r; +} diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy.expect b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy.expect index 71f58061f67..8ddaa2813a8 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy.expect +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy.expect @@ -4,3 +4,4 @@ Option.Some(['4', '2']) Option.Some(['x']) Recur: 116 Recur: 116 +25 diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868b.dfy b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868b.dfy index 7d58d9ce524..69b0295513c 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868b.dfy +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868b.dfy @@ -51,3 +51,27 @@ datatype Option<+T> = None | Some(value: T) { value } } + +// The following method includes an assignment whose RHS is a deeply nested expression. +// We optimize such assignments, too. By including this test here, we make sure the Java +// we generate doesn't contain any occurrences of "Let(". +method DeepAssignment(x: int) returns (r: int) { + r := + var x0 := x; + var x1 := x0; + var x2 := x1; + var x3 := x2; + var x4 := x3; + var x5 := x4; + var x6 := x5; + var x7 := x6; + if x0 == x7 then + var y0 := x; + var y1 := y0; + y1 + else + var y2 := x; + var y3 := y2; + y3; + return r; +} From 93f5ccf456c10a78df13059d6ec189f454cc256d Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Fri, 28 Jun 2024 18:07:38 -0700 Subject: [PATCH 03/30] Add release notes --- docs/dev/news/5589.fix | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/dev/news/5589.fix diff --git a/docs/dev/news/5589.fix b/docs/dev/news/5589.fix new file mode 100644 index 00000000000..1af9c03533a --- /dev/null +++ b/docs/dev/news/5589.fix @@ -0,0 +1 @@ +Optimize the compilation of single-LHS assignment statements to allow the RHS to be a deeply nested expression. This solves a problem in compiling to Java, since `javac` does not deal gracefully with nested lambda expressions. \ No newline at end of file From 013f6d2e934d915bf38da84038af6e6f0ca75b3d Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 14:55:16 -0700 Subject: [PATCH 04/30] Add tests --- .../LitTest/git-issues/git-issue-3868.dfy | 105 ++++++++++++++++++ .../git-issues/git-issue-3868.dfy.expect | 8 ++ 2 files changed, 113 insertions(+) diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy index 87d1c116e27..df3753fe200 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy @@ -11,6 +11,7 @@ method Main() { print "Recur: ", recur.Follow1(A, 12, 80), "\n"; // 116 (that is, 80 + 12*(2 + 1) var w := DeepAssignment(25); print w, "\n"; // 25 + MatchExpressions.Test(); } method NotOptimized(s: string) returns (r: int) { @@ -186,3 +187,107 @@ method DeepAssignment(x: int) returns (r: int) { y3; return r; } + +module MatchExpressions { + datatype Color = Red | Green | Blue + datatype AB = A | B + datatype ABC = AA | BB | CC + + method Test() { + M(Green); + N(Red); + var r := O(Blue, 10); + print r, "\n"; // 12 + P(7, 2); + label L: { + var abc := 0; + break L; + } + print TailRecursive(A, 19), " ", AutoAccumulator(A, 19), "\n"; // 6 25 + print LastCaseIsDisjunctive(BB), "\n"; // 22 + print F(A, 12, 80), "\n"; // 80 + print "It's done\n"; + } + + method M(c: Color) { + var x := match c + case Red => 5 + case Green => 7 + case Blue => 11; + print x, "\n"; // 5 + } + + method N(c: Color) + requires c == Red + { + var x := match c + case Red => 5; + print x, "\n"; // 5 + } + + method O(c: Color, y: int) returns (r: int) + requires 0 <= y + { + if y < 0 { + // unreachable + var x: int := match c; + } + r := 12; + } + + method P(s: int, t: int) + requires t == 0 || t == 2 + { + var x: int := match s + case 0 => 100 + case 2 => 200 + case _ => 400; + var y: int := match t + case 0 => 60 + case 2 => 80; + if t == 1 { + // unreachable + var z: int := match s + t; + } + print x, " ", y, "\n"; // 400 80 + } + + function TailRecursive(o: AB, n: nat): int { + if n == 0 then 6 else + match o + case A | B => TailRecursive(o, n - 1) + } + + function AutoAccumulator(o: AB, n: nat): int { + if n == 0 then 6 else + match o + case A | B => AutoAccumulator(o, n - 1) + 1 + } + + function LastCaseIsDisjunctive(o: ABC): int { + match o + case CC => + 777 + case AA | BB => + 22 + } + + function F(o: AB, n: nat, m: int): int + { + if n == 0 then + m + else if n == 1 then + var ff := () => match o { // for Java, make sure o is copied + case A => 20 + case B => 999 + }; + var s := ff(); + F(o, n - 1, m) + else + var u := match o { + case A => 20 + case B => 999 + }; + F(o, n - 1, m) + } +} diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy.expect b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy.expect index 8ddaa2813a8..883c085d988 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy.expect +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-3868.dfy.expect @@ -5,3 +5,11 @@ Option.Some(['x']) Recur: 116 Recur: 116 25 +7 +5 +12 +400 80 +6 25 +22 +80 +It's done From 0e27fa639e326ae3d4347bc906f5af81ed9402f7 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 15:22:06 -0700 Subject: [PATCH 05/30] fix: Thread inLetExprBody through EmitNestedMatchGeneric --- .../SinglePassCodeGenerator.Expression.cs | 2 +- .../SinglePassCodeGenerator.Statement.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs index cf8c1db92ae..8a7d05a18bc 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs @@ -721,7 +721,7 @@ protected virtual void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultTy EmitNestedMatchGeneric(match, (caseIndex, caseBody) => { var myCase = match.Cases[caseIndex]; TrExprOpt(myCase.Body, myCase.Body.Type, caseBody, wStmts, inLetExprBody: true, accumulatorVar: null, continuation); - }, wr, true); + }, inLetExprBody, wr, true); } private ConcreteSyntaxTree EmitAppliedLambda(ConcreteSyntaxTree output, ConcreteSyntaxTree wStmts, diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index eb1ace29bf7..881e29a5d58 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -524,7 +524,7 @@ private void EmitMatchStmt(ConcreteSyntaxTree wr, MatchStmt s) { protected virtual void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntaxTree writer) { EmitNestedMatchGeneric(match, (caseIndex, caseBody) => { TrStmtList(match.Cases[caseIndex].Body, caseBody); - }, writer, false); + }, false, writer, false); } /// @@ -556,7 +556,7 @@ protected virtual void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntax /// /// private void EmitNestedMatchGeneric(INestedMatch match, Action emitBody, - ConcreteSyntaxTree output, bool bodyExpected) { + bool inLetExprBody, ConcreteSyntaxTree output, bool bodyExpected) { if (match.Cases.Count == 0) { if (bodyExpected) { // the verifier would have proved we never get here; still, we need some code that will compile @@ -564,7 +564,7 @@ private void EmitNestedMatchGeneric(INestedMatch match, Action Date: Wed, 3 Jul 2024 15:08:19 -0700 Subject: [PATCH 06/30] Use last case unconditionally --- .../SinglePassCodeGenerator.Statement.cs | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index 881e29a5d58..f356c5b5d72 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -549,10 +549,9 @@ protected virtual void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntax /// } /// } /// } - /// if (unmatched) { - /// var r = a; - /// body2; - /// } + /// var r = a; + /// body2; + /// throw ABSURD; /// /// private void EmitNestedMatchGeneric(INestedMatch match, Action emitBody, @@ -573,18 +572,16 @@ private void EmitNestedMatchGeneric(INestedMatch match, Action + /// If "emitIf" is true, then emits an else-less "if" statement, sets "guardWriter" to a non-null value, and returns the writer to the + /// "then" branch. + /// If "emitIf" is false, then emits a block statement, sets "guardWriter" to null, and returns the writer to the inside of the block. + /// + protected ConcreteSyntaxTree EmitIfOrBlock(bool emitIf, [CanBeNull] out ConcreteSyntaxTree guardWriter, ConcreteSyntaxTree wr) { + var innerWriter = EmitIf(out guardWriter, false, wr); + if (!emitIf) { + guardWriter.Write(True); + guardWriter = null; + } + return innerWriter; + } + + private ConcreteSyntaxTree EmitNestedMatchStmtCaseConstructor(string sourceName, Type sourceType, IdPattern idPattern, ConcreteSyntaxTree result, bool lastCase) { From ac36a0cd18a8eb2c9075132eb9c446f6eaa3ba3b Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 15:26:14 -0700 Subject: [PATCH 07/30] =?UTF-8?q?Remove=20=E2=80=9Cunmatched=E2=80=9D=20me?= =?UTF-8?q?chanism?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SinglePassCodeGenerator.Statement.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index f356c5b5d72..f378e1c59a4 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -565,20 +565,12 @@ private void EmitNestedMatchGeneric(INestedMatch match, Action Date: Wed, 3 Jul 2024 16:03:33 -0700 Subject: [PATCH 08/30] Always emit exception-throw for zero-case match --- .../SinglePassCodeGenerator.Expression.cs | 2 +- .../SinglePassCodeGenerator.Statement.cs | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs index 8a7d05a18bc..206ad5459b3 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs @@ -721,7 +721,7 @@ protected virtual void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultTy EmitNestedMatchGeneric(match, (caseIndex, caseBody) => { var myCase = match.Cases[caseIndex]; TrExprOpt(myCase.Body, myCase.Body.Type, caseBody, wStmts, inLetExprBody: true, accumulatorVar: null, continuation); - }, inLetExprBody, wr, true); + }, inLetExprBody, wr); } private ConcreteSyntaxTree EmitAppliedLambda(ConcreteSyntaxTree output, ConcreteSyntaxTree wStmts, diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index f378e1c59a4..076d2be69a8 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -524,7 +524,7 @@ private void EmitMatchStmt(ConcreteSyntaxTree wr, MatchStmt s) { protected virtual void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntaxTree writer) { EmitNestedMatchGeneric(match, (caseIndex, caseBody) => { TrStmtList(match.Cases[caseIndex].Body, caseBody); - }, false, writer, false); + }, false, writer); } /// @@ -555,12 +555,10 @@ protected virtual void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntax /// /// private void EmitNestedMatchGeneric(INestedMatch match, Action emitBody, - bool inLetExprBody, ConcreteSyntaxTree output, bool bodyExpected) { + bool inLetExprBody, ConcreteSyntaxTree output) { if (match.Cases.Count == 0) { - if (bodyExpected) { - // the verifier would have proved we never get here; still, we need some code that will compile - EmitAbsurd(null, output); - } + // the verifier would have proved we never get here; still, we need some code that will compile + EmitAbsurd(null, output); } else { string sourceName = ProtectedFreshId("_source"); DeclareLocalVar(sourceName, match.Source.Type, match.Source.tok, match.Source, inLetExprBody, output); From 0f4d7d9354624206aa4aca84a436f2581f36bd01 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 16:03:47 -0700 Subject: [PATCH 09/30] chore: Improve code --- .../SinglePassCodeGenerator.Statement.cs | 20 +++---------------- .../CompileNestedMatch/MatchFlattener.cs | 4 ++-- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index 076d2be69a8..46490d76d7f 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -575,8 +575,7 @@ private void EmitNestedMatchGeneric(INestedMatch match, Action - /// If "emitIf" is true, then emits an else-less "if" statement, sets "guardWriter" to a non-null value, and returns the writer to the - /// "then" branch. - /// If "emitIf" is false, then emits a block statement, sets "guardWriter" to null, and returns the writer to the inside of the block. - /// - protected ConcreteSyntaxTree EmitIfOrBlock(bool emitIf, [CanBeNull] out ConcreteSyntaxTree guardWriter, ConcreteSyntaxTree wr) { - var innerWriter = EmitIf(out guardWriter, false, wr); - if (!emitIf) { - guardWriter.Write(True); - guardWriter = null; - } - return innerWriter; - } - - private ConcreteSyntaxTree EmitNestedMatchStmtCaseConstructor(string sourceName, Type sourceType, IdPattern idPattern, ConcreteSyntaxTree result, bool lastCase) { diff --git a/Source/DafnyCore/CompileNestedMatch/MatchFlattener.cs b/Source/DafnyCore/CompileNestedMatch/MatchFlattener.cs index 33837e33690..7530fd2f841 100644 --- a/Source/DafnyCore/CompileNestedMatch/MatchFlattener.cs +++ b/Source/DafnyCore/CompileNestedMatch/MatchFlattener.cs @@ -510,8 +510,8 @@ public static LiteralExpr GetLiteralExpressionFromPattern(ExtendedPattern head) LiteralExpr lit = null; if (head is LitPattern litPattern) { lit = litPattern.OptimisticallyDesugaredLit; - } else if (head is IdPattern id && id.ResolvedLit != null) { - lit = id.ResolvedLit; + } else if (head is IdPattern { ResolvedLit: { } resolvedLit }) { + lit = resolvedLit; } return lit; From 15afb896806acf62a475814c3e2b477e2915044f Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 16:05:38 -0700 Subject: [PATCH 10/30] Emit no tests for last case --- .../SinglePassCodeGenerator.Statement.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index 46490d76d7f..e6589ecbe3f 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -580,6 +580,10 @@ private ConcreteSyntaxTree EmitNestedMatchCaseConditions(string sourceName, Type var litExpression = MatchFlattener.GetLiteralExpressionFromPattern(pattern); if (litExpression != null) { + if (lastCase) { + return writer; + } + var thenWriter = EmitIf(out var guardWriter, false, writer); CompileBinOp(BinaryExpr.ResolvedOpcode.EqCommon, sourceType, litExpression.Type, pattern.Tok, Type.Bool, out var opString, out var preOpString, out var postOpString, out var callString, out var staticCallString, @@ -605,6 +609,10 @@ private ConcreteSyntaxTree EmitNestedMatchCaseConditions(string sourceName, Type } } else if (pattern is DisjunctivePattern disjunctivePattern) { + if (lastCase) { + return writer; + } + string disjunctiveMatch = ProtectedFreshId("disjunctiveMatch"); DeclareLocalVar(disjunctiveMatch, Type.Bool, disjunctivePattern.Tok, Expression.CreateBoolLiteral(disjunctivePattern.Tok, false), false, writer); foreach (var alternative in disjunctivePattern.Alternatives) { From df493ff1e6bc494c58b90beea2cd2fe039b6bebf Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 16:30:06 -0700 Subject: [PATCH 11/30] Introduce OptimizedExpressionContinuation record type --- Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs | 2 +- Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs | 6 +++++- .../SinglePassCodeGenerator.Expression.cs | 8 +++++--- .../SinglePassCodeGenerator.Statement.cs | 3 ++- .../SinglePassCodeGenerator.cs | 11 +++++++---- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs b/Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs index 87d2b4981e1..2f5e5e1cd6b 100644 --- a/Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs +++ b/Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs @@ -2844,7 +2844,7 @@ protected override void EmitNestedMatchExpr(NestedMatchExpr match, bool inLetExp } protected override void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultType, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, - bool inLetExprBody, IVariable accumulatorVar, Action continuation) { + bool inLetExprBody, IVariable accumulatorVar, OptimizedExpressionContinuation continuation) { TrExprOpt(match.Flattened, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } diff --git a/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs b/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs index ca10157852d..f5d729d4c1b 100644 --- a/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs +++ b/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs @@ -3597,6 +3597,10 @@ protected override void EmitAbsurd(string message, ConcreteSyntaxTree wr) { message = "unexpected control point"; } + // Wrapping an "if (true) { ... }" around the "break" statement is a way to tell the Java compiler not to give + // errors for any (unreachable) code that may follow. + wr = EmitIf(out var guardWriter, false, wr); + guardWriter.Write("true"); wr.WriteLine($"throw new IllegalArgumentException(\"{message}\");"); } @@ -4364,7 +4368,7 @@ protected override void EmitNestedMatchExpr(NestedMatchExpr match, bool inLetExp } protected override void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultType, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, - bool inLetExprBody, IVariable accumulatorVar, Action continuation) { + bool inLetExprBody, IVariable accumulatorVar, OptimizedExpressionContinuation continuation) { TrExprOpt(match.Flattened, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs index 206ad5459b3..c541e11835f 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs @@ -699,7 +699,8 @@ private void EmitMatchExpr(MatchExpr e, bool inLetExprBody, ConcreteSyntaxTree w var sourceType = (UserDefinedType)e.Source.Type.NormalizeExpand(); foreach (MatchCaseExpr mc in e.Cases) { var wCase = MatchCasePrelude(source, sourceType, mc.Ctor, mc.Arguments, i, e.Cases.Count, w); - TrExprOpt(mc.Body, mc.Body.Type, wCase, wStmts, inLetExprBody: true, accumulatorVar: null, EmitReturnExpr); + var continuation = new OptimizedExpressionContinuation(EmitReturnExpr); + TrExprOpt(mc.Body, mc.Body.Type, wCase, wStmts, inLetExprBody: true, accumulatorVar: null, continuation); i++; } } @@ -710,11 +711,12 @@ private void EmitMatchExpr(MatchExpr e, bool inLetExprBody, ConcreteSyntaxTree w protected virtual void EmitNestedMatchExpr(NestedMatchExpr match, bool inLetExprBody, ConcreteSyntaxTree output, ConcreteSyntaxTree wStmts) { var lambdaBody = EmitAppliedLambda(output, wStmts, match.Tok, match.Type); - TrOptNestedMatchExpr(match, match.Type, lambdaBody, wStmts, inLetExprBody, null, EmitReturnExpr); + var continuation = new OptimizedExpressionContinuation(EmitReturnExpr); + TrOptNestedMatchExpr(match, match.Type, lambdaBody, wStmts, inLetExprBody, null, continuation); } protected virtual void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultType, ConcreteSyntaxTree wr, - ConcreteSyntaxTree wStmts, bool inLetExprBody, IVariable accumulatorVar, Action continuation) { + ConcreteSyntaxTree wStmts, bool inLetExprBody, IVariable accumulatorVar, OptimizedExpressionContinuation continuation) { wStmts = wr.Fork(); diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index e6589ecbe3f..a4181f103fd 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -132,7 +132,8 @@ protected void TrStmt(Statement stmt, ConcreteSyntaxTree wr, ConcreteSyntaxTree var wRhs = EmitAssignment(lvalue, resultType, e.Type, wrAssignment, assignStmt.Tok); EmitExpr(e, false, wRhs, wStmtsBeforeAssignment); }; - TrExprOpt(eRhs.Expr, TypeOfLhs(s.Lhs), wr, wStmts, false, null, doAssignment); + var continuation = new OptimizedExpressionContinuation(doAssignment); + TrExprOpt(eRhs.Expr, TypeOfLhs(s.Lhs), wr, wStmts, false, null, continuation); } } diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index c0b91f3797f..3e38e0a38de 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -2914,6 +2914,8 @@ void TrCasePatternOpt(CasePattern pat, Expression rhs, Action Continuation); + /// /// This method compiles "expr" into a statement context of the target. This typically means that, for example, Dafny let-bound variables can /// be compiled into local variables in the target code, and that Dafny if-then-else expressions can be compiled into if statements in the @@ -2925,7 +2927,7 @@ void TrCasePatternOpt(CasePattern pat, Expression rhs, Action protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, bool inLetExprBody, - [CanBeNull] IVariable accumulatorVar, Action continuation) { + [CanBeNull] IVariable accumulatorVar, OptimizedExpressionContinuation continuation) { Contract.Requires(expr != null); Contract.Requires(wr != null); Contract.Requires(accumulatorVar == null || (enclosingFunction != null && enclosingFunction.IsAccumulatorTailRecursive)); @@ -2944,7 +2946,7 @@ protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr TrExprOpt(e.Body, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); } else { // We haven't optimized the other cases, so fallback to normal compilation - continuation(e, resultType, inLetExprBody, wr); + continuation.Continuation(e, resultType, inLetExprBody, wr); } } else if (expr is ITEExpr) { @@ -3132,7 +3134,7 @@ protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr Contract.Assert(accumulatorVar == null); } - continuation(expr, resultType, inLetExprBody, wr); + continuation.Continuation(expr, resultType, inLetExprBody, wr); } } @@ -3143,7 +3145,8 @@ void CompileReturnBody(Expression body, Type originalResultType, ConcreteSyntaxT Contract.Requires(accumulatorVar == null || (enclosingFunction != null && enclosingFunction.IsAccumulatorTailRecursive)); copyInstrWriters.Push(wr.Fork()); var wStmts = wr.Fork(); - TrExprOpt(body.Resolved, originalResultType, wr, wStmts, false, accumulatorVar, EmitReturnExpr); + var continuation = new OptimizedExpressionContinuation(EmitReturnExpr); + TrExprOpt(body.Resolved, originalResultType, wr, wStmts, false, accumulatorVar, continuation); copyInstrWriters.Pop(); } From 434e3fb03cba0b6823919f966e63549f37e0633f Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 16:44:04 -0700 Subject: [PATCH 12/30] Prevent case fall-through by using break/goto --- .../SinglePassCodeGenerator.Expression.cs | 6 +- .../SinglePassCodeGenerator.Statement.cs | 59 ++++++++++++------- .../SinglePassCodeGenerator.cs | 4 +- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs index c541e11835f..bb2fe08eddc 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs @@ -699,7 +699,7 @@ private void EmitMatchExpr(MatchExpr e, bool inLetExprBody, ConcreteSyntaxTree w var sourceType = (UserDefinedType)e.Source.Type.NormalizeExpand(); foreach (MatchCaseExpr mc in e.Cases) { var wCase = MatchCasePrelude(source, sourceType, mc.Ctor, mc.Arguments, i, e.Cases.Count, w); - var continuation = new OptimizedExpressionContinuation(EmitReturnExpr); + var continuation = new OptimizedExpressionContinuation(EmitReturnExpr, false); TrExprOpt(mc.Body, mc.Body.Type, wCase, wStmts, inLetExprBody: true, accumulatorVar: null, continuation); i++; } @@ -711,7 +711,7 @@ private void EmitMatchExpr(MatchExpr e, bool inLetExprBody, ConcreteSyntaxTree w protected virtual void EmitNestedMatchExpr(NestedMatchExpr match, bool inLetExprBody, ConcreteSyntaxTree output, ConcreteSyntaxTree wStmts) { var lambdaBody = EmitAppliedLambda(output, wStmts, match.Tok, match.Type); - var continuation = new OptimizedExpressionContinuation(EmitReturnExpr); + var continuation = new OptimizedExpressionContinuation(EmitReturnExpr, false); TrOptNestedMatchExpr(match, match.Type, lambdaBody, wStmts, inLetExprBody, null, continuation); } @@ -720,7 +720,7 @@ protected virtual void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultTy wStmts = wr.Fork(); - EmitNestedMatchGeneric(match, (caseIndex, caseBody) => { + EmitNestedMatchGeneric(match, continuation.PreventCaseFallThrough, (caseIndex, caseBody) => { var myCase = match.Cases[caseIndex]; TrExprOpt(myCase.Body, myCase.Body.Type, caseBody, wStmts, inLetExprBody: true, accumulatorVar: null, continuation); }, inLetExprBody, wr); diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index a4181f103fd..341fcf7abd0 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -132,7 +132,7 @@ protected void TrStmt(Statement stmt, ConcreteSyntaxTree wr, ConcreteSyntaxTree var wRhs = EmitAssignment(lvalue, resultType, e.Type, wrAssignment, assignStmt.Tok); EmitExpr(e, false, wRhs, wStmtsBeforeAssignment); }; - var continuation = new OptimizedExpressionContinuation(doAssignment); + var continuation = new OptimizedExpressionContinuation(doAssignment, true); TrExprOpt(eRhs.Expr, TypeOfLhs(s.Lhs), wr, wStmts, false, null, continuation); } } @@ -523,39 +523,48 @@ private void EmitMatchStmt(ConcreteSyntaxTree wr, MatchStmt s) { } protected virtual void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntaxTree writer) { - EmitNestedMatchGeneric(match, (caseIndex, caseBody) => { + EmitNestedMatchGeneric(match, true, (caseIndex, caseBody) => { TrStmtList(match.Cases[caseIndex].Body, caseBody); }, false, writer); } /// - /// - /// match a + /// Given + /// + /// match a /// case X(Y(b),Z(W(c)) => body1 /// case r => body2 + /// + /// If there are no cases, then emit: + /// + /// throw ABSURD; /// - /// var unmatched = true; - /// if (unmatched && a is X) { - /// var x1 = ((X)a).1; - /// if (x1 is Y) { - /// var b = ((Y)x1).1; + /// Else, emit: /// - /// var x2 = ((X)a).2; - /// if (x2 is Z) { - /// var x4 = ((Z)x2).1; - /// if (x4 is W) { - /// var c = ((W)x4).1; - /// body1; + /// BLOCK { + /// var unmatched = true; + /// if (unmatched && a is X) { + /// var x1 = ((X)a).1; + /// if (x1 is Y) { + /// var b = ((Y)x1).1; + /// + /// var x2 = ((X)a).2; + /// if (x2 is Z) { + /// var x4 = ((Z)x2).1; + /// if (x4 is W) { + /// var c = ((W)x4).1; + /// body1; + /// } + /// } /// } - /// } + /// break BLOCK; + /// } + /// var r = a; + /// body2; /// } - /// } - /// var r = a; - /// body2; - /// throw ABSURD; /// /// - private void EmitNestedMatchGeneric(INestedMatch match, Action emitBody, + private void EmitNestedMatchGeneric(INestedMatch match, bool preventCaseFallThrough, Action emitBody, bool inLetExprBody, ConcreteSyntaxTree output) { if (match.Cases.Count == 0) { // the verifier would have proved we never get here; still, we need some code that will compile @@ -564,6 +573,11 @@ private void EmitNestedMatchGeneric(INestedMatch match, Action(CasePattern pat, Expression rhs, Action Continuation); + public record OptimizedExpressionContinuation(Action Continuation, bool PreventCaseFallThrough); /// /// This method compiles "expr" into a statement context of the target. This typically means that, for example, Dafny let-bound variables can @@ -3145,7 +3145,7 @@ void CompileReturnBody(Expression body, Type originalResultType, ConcreteSyntaxT Contract.Requires(accumulatorVar == null || (enclosingFunction != null && enclosingFunction.IsAccumulatorTailRecursive)); copyInstrWriters.Push(wr.Fork()); var wStmts = wr.Fork(); - var continuation = new OptimizedExpressionContinuation(EmitReturnExpr); + var continuation = new OptimizedExpressionContinuation(EmitReturnExpr, false); TrExprOpt(body.Resolved, originalResultType, wr, wStmts, false, accumulatorVar, continuation); copyInstrWriters.Pop(); } From 5502bfffb1e27c59530ef7deac023095672bbe4e Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 17:47:49 -0700 Subject: [PATCH 13/30] fix: Use Downcast for let RHS and for function body Fixes #5597 --- .../SinglePassCodeGenerator.cs | 7 ++- .../LitTest/comp/CovariantCollections.dfy | 9 +++- .../LitTest/git-issues/git-issue-5597.dfy | 51 +++++++++++++++++++ .../git-issues/git-issue-5597.dfy.expect | 1 + 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy create mode 100644 Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy.expect diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index 0eb5240b5a8..424be425fba 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -576,7 +576,9 @@ protected virtual void EmitSetterParameter(ConcreteSyntaxTree wr) { protected virtual void EmitReturnExpr(Expression expr, Type resultType, bool inLetExprBody, ConcreteSyntaxTree wr) { // emits "return ;" for function bodies var wStmts = wr.Fork(); var w = EmitReturnExpr(wr); - EmitExpr(expr, inLetExprBody, EmitCoercionIfNecessary(expr.Type, resultType, null, w), wStmts); + w = EmitCoercionIfNecessary(expr.Type, resultType, expr.tok, w); + w = EmitDowncastIfNecessary(expr.Type, resultType, expr.tok, w); + EmitExpr(expr, inLetExprBody, w, wStmts); } protected virtual void EmitReturnExpr(string returnExpr, ConcreteSyntaxTree wr) { // emits "return ;" for function bodies var w = EmitReturnExpr(wr); @@ -2868,7 +2870,8 @@ void TrCasePatternOpt(CasePattern pat, Expression rhs, Action := m; v; // regression test -- this once tripped up the compilation to Java, whereas the next line had not s' := var u: set := var v: set := m; v; u; - var eq := s == m && m == s; + var s'' := DowncastFunction(a, b); // regression test -- the same error was later discovered in top-level function bodies + var eq := s == m && m == s && s == s''; print eq, "\n"; // true s := FId(m); // cast in @@ -367,6 +368,12 @@ method Create(a: T, b: T) returns (m: set, n: multiset, o: seq, p: m p := map[a := b, b := a]; } +function DowncastFunction(a: Integer, b: Integer): set { + var m: set := {a, b}; + var v: set := m; + v +} + function DowncastF(s: set): set { s } method DowncastM(s: set) returns (r: set) ensures r == s diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy new file mode 100644 index 00000000000..a8de65a62c0 --- /dev/null +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy @@ -0,0 +1,51 @@ +// RUN: %testDafnyForEachCompiler "%s" + +method Main() { + var n: set := {}; + var s: set; + s := DoItWithAssignment(n); + print |s|, " "; + s := DoItWithPlainLet(n); + print |s|, " "; + s := DoItWithOptimizedLet(n); + print |s|, " "; + s := DoItViaFunctionBodyResult(n); + print |s|, "\n"; +} + +trait Number { + const value: int +} + +class Integer extends Number { + constructor(value: int) { + this.value := value; + } +} + +method DoItWithAssignment(numbers: set) returns (integers00: set) + requires |numbers| == 0 +{ + integers00 := numbers; +} + +function DoItWithPlainLet(numbers: set): set + requires |numbers| == 0 +{ + {} + + var integers11: set := numbers; + integers11 +} + +function DoItWithOptimizedLet(numbers: set): set + requires |numbers| == 0 +{ + var integers22: set := numbers; + integers22 +} + +function DoItViaFunctionBodyResult(numbers: set): set + requires |numbers| == 0 +{ + numbers +} diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy.expect b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy.expect new file mode 100644 index 00000000000..6a20ce40185 --- /dev/null +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy.expect @@ -0,0 +1 @@ +0 0 0 0 From d89fb6bb07683da9b95d0335445903680af9a67c Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 17:54:05 -0700 Subject: [PATCH 14/30] Add tests --- .../LitTests/LitTest/patterns/OrPatterns.dfy | 24 +++++++++++++++++++ .../LitTest/patterns/OrPatterns.dfy.expect | 7 ++++++ 2 files changed, 31 insertions(+) diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/patterns/OrPatterns.dfy b/Source/IntegrationTests/TestFiles/LitTests/LitTest/patterns/OrPatterns.dfy index 8a4b0f8b75f..ab52479f90f 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/patterns/OrPatterns.dfy +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/patterns/OrPatterns.dfy @@ -123,6 +123,30 @@ method Main() { var b6 := F2(A); var b7 := F2(B); expect 1 == b0 == b1 == b2 == b3 == b4 == b5 == b6 == b7; + + MoreOrTests.Test(); print "OK\n"; } + +module MoreOrTests { + datatype Dt = A | B | C | D | E | F | G + + method Test() { + M(A); + M(B); + M(C); + M(D); + M(E); + M(F); + M(G); + } + + method M(d: Dt) { + match d + case A | B => print "AB\n"; + case C => print "C\n"; + case D | E => print "DE\n"; + case F | G => print "FG\n"; + } +} diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/patterns/OrPatterns.dfy.expect b/Source/IntegrationTests/TestFiles/LitTests/LitTest/patterns/OrPatterns.dfy.expect index d86bac9de59..225f08e4fcb 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/patterns/OrPatterns.dfy.expect +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/patterns/OrPatterns.dfy.expect @@ -1 +1,8 @@ +AB +AB +C +DE +DE +FG +FG OK From e02d322c17b627b1fcbf64b86623ff5190a1c524 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 18:54:50 -0700 Subject: [PATCH 15/30] Handle only non-degenerate matches differently for Java --- .../Backends/Java/JavaCodeGenerator.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs b/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs index f5d729d4c1b..f5337198f95 100644 --- a/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs +++ b/Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs @@ -4364,16 +4364,28 @@ protected override void EmitHaltRecoveryStmt(Statement body, string haltMessageV protected override void EmitNestedMatchExpr(NestedMatchExpr match, bool inLetExprBody, ConcreteSyntaxTree output, ConcreteSyntaxTree wStmts) { - EmitExpr(match.Flattened, inLetExprBody, output, wStmts); + if (match.Cases.Count == 0) { + base.EmitNestedMatchExpr(match, inLetExprBody, output, wStmts); + } else { + EmitExpr(match.Flattened, inLetExprBody, output, wStmts); + } } protected override void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultType, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, bool inLetExprBody, IVariable accumulatorVar, OptimizedExpressionContinuation continuation) { - TrExprOpt(match.Flattened, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); + if (match.Cases.Count == 0) { + base.TrOptNestedMatchExpr(match, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); + } else { + TrExprOpt(match.Flattened, resultType, wr, wStmts, inLetExprBody, accumulatorVar, continuation); + } } protected override void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntaxTree writer) { - TrStmt(match.Flattened, writer); + if (match.Cases.Count == 0) { + base.EmitNestedMatchStmt(match, writer); + } else { + TrStmt(match.Flattened, writer); + } } } } From ab826e39a49ab062d30ff90d3e2ec2d0e984ce5a Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 21:04:18 -0700 Subject: [PATCH 16/30] fix: Add a missing case in C# type conversions --- Source/DafnyCore/Backends/CSharp/CsharpCodeGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DafnyCore/Backends/CSharp/CsharpCodeGenerator.cs b/Source/DafnyCore/Backends/CSharp/CsharpCodeGenerator.cs index 99f4c54c6f5..8526e760a2f 100644 --- a/Source/DafnyCore/Backends/CSharp/CsharpCodeGenerator.cs +++ b/Source/DafnyCore/Backends/CSharp/CsharpCodeGenerator.cs @@ -2897,7 +2897,7 @@ protected override ConcreteSyntaxTree EmitDowncast(Type from, Type to, IToken to var w = new ConcreteSyntaxTree(); if (from.IsTraitType && to.AsNewtype != null) { wr.Format($"(({to.AsNewtype.GetFullCompileName(Options)})({w}))"); - } else if (to.IsRefType || to.IsTraitType || from.IsTraitType) { + } else if (to.IsRefType || to.IsTraitType || from.IsTraitType || to.IsTypeParameter) { wr.Format($"(({TypeName(to, wr, tok)})({w}))"); } else { Contract.Assert(Type.SameHead(from, to)); From fa1bb3202591ce23fca9f2f9b77ccc247848bdf1 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 3 Jul 2024 21:20:26 -0700 Subject: [PATCH 17/30] Updated code generated from Dafny --- Source/DafnyCore/GeneratedFromDafny/DCOMP.cs | 6914 ++++++++--------- Source/DafnyCore/GeneratedFromDafny/RAST.cs | 1862 ++--- .../GeneratedFromDafny/Std_Wrappers.cs | 168 +- 3 files changed, 4020 insertions(+), 4924 deletions(-) diff --git a/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs b/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs index 7594e701098..f3f115c0841 100644 --- a/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs +++ b/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs @@ -412,54 +412,43 @@ public RAST._IMod GenModule(DAST._IModule mod, Dafny.ISequence _1012_generated = Dafny.Sequence.Empty; DAST._IModuleItem _source44 = (body).Select(_1011_i); - bool unmatched44 = true; - if (unmatched44) { - if (_source44.is_Module) { - DAST._IModule _1013_m = _source44.dtor_Module_a0; - unmatched44 = false; - RAST._IMod _1014_mm; - RAST._IMod _out16; - _out16 = (this).GenModule(_1013_m, containingPath); - _1014_mm = _out16; - _1012_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_ModDecl(_1014_mm)); - } - } - if (unmatched44) { - if (_source44.is_Class) { - DAST._IClass _1015_c = _source44.dtor_Class_a0; - unmatched44 = false; - Dafny.ISequence _out17; - _out17 = (this).GenClass(_1015_c, Dafny.Sequence>.Concat(containingPath, Dafny.Sequence>.FromElements((_1015_c).dtor_name))); - _1012_generated = _out17; - } - } - if (unmatched44) { - if (_source44.is_Trait) { - DAST._ITrait _1016_t = _source44.dtor_Trait_a0; - unmatched44 = false; - Dafny.ISequence _1017_tt; - Dafny.ISequence _out18; - _out18 = (this).GenTrait(_1016_t, containingPath); - _1017_tt = _out18; - _1012_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_RawDecl(_1017_tt)); - } - } - if (unmatched44) { - if (_source44.is_Newtype) { - DAST._INewtype _1018_n = _source44.dtor_Newtype_a0; - unmatched44 = false; - Dafny.ISequence _out19; - _out19 = (this).GenNewtype(_1018_n); - _1012_generated = _out19; - } - } - if (unmatched44) { - DAST._IDatatype _1019_d = _source44.dtor_Datatype_a0; - unmatched44 = false; - Dafny.ISequence _out20; - _out20 = (this).GenDatatype(_1019_d); - _1012_generated = _out20; - } + if (_source44.is_Module) { + DAST._IModule _1013_m = _source44.dtor_Module_a0; + RAST._IMod _1014_mm; + RAST._IMod _out16; + _out16 = (this).GenModule(_1013_m, containingPath); + _1014_mm = _out16; + _1012_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_ModDecl(_1014_mm)); + goto after_match1; + } + if (_source44.is_Class) { + DAST._IClass _1015_c = _source44.dtor_Class_a0; + Dafny.ISequence _out17; + _out17 = (this).GenClass(_1015_c, Dafny.Sequence>.Concat(containingPath, Dafny.Sequence>.FromElements((_1015_c).dtor_name))); + _1012_generated = _out17; + goto after_match1; + } + if (_source44.is_Trait) { + DAST._ITrait _1016_t = _source44.dtor_Trait_a0; + Dafny.ISequence _1017_tt; + Dafny.ISequence _out18; + _out18 = (this).GenTrait(_1016_t, containingPath); + _1017_tt = _out18; + _1012_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_RawDecl(_1017_tt)); + goto after_match1; + } + if (_source44.is_Newtype) { + DAST._INewtype _1018_n = _source44.dtor_Newtype_a0; + Dafny.ISequence _out19; + _out19 = (this).GenNewtype(_1018_n); + _1012_generated = _out19; + goto after_match1; + } + DAST._IDatatype _1019_d = _source44.dtor_Datatype_a0; + Dafny.ISequence _out20; + _out20 = (this).GenDatatype(_1019_d); + _1012_generated = _out20; + after_match1: ; s = Dafny.Sequence.Concat(s, _1012_generated); } return s; @@ -470,7 +459,11 @@ public void GenTypeParam(DAST._ITypeArgDecl tp, out DAST._IType typeArg, out RAS typeParam = RAST.TypeParamDecl.Default(); typeArg = DAST.Type.create_TypeArg((tp).dtor_name); Dafny.ISequence _1020_genTpConstraint; - _1020_genTpConstraint = ((((tp).dtor_bounds).Contains(DAST.TypeArgBound.create_SupportsEquality())) ? (Dafny.Sequence.FromElements(RAST.__default.DafnyTypeEq)) : (Dafny.Sequence.FromElements(RAST.__default.DafnyType))); + if (((tp).dtor_bounds).Contains(DAST.TypeArgBound.create_SupportsEquality())) { + _1020_genTpConstraint = Dafny.Sequence.FromElements(RAST.__default.DafnyTypeEq); + } else { + _1020_genTpConstraint = Dafny.Sequence.FromElements(RAST.__default.DafnyType); + } if (((tp).dtor_bounds).Contains(DAST.TypeArgBound.create_SupportsDefault())) { _1020_genTpConstraint = Dafny.Sequence.Concat(_1020_genTpConstraint, Dafny.Sequence.FromElements(((RAST.__default.std__type).MSel(Dafny.Sequence.UnicodeFromString("default"))).MSel(Dafny.Sequence.UnicodeFromString("Default")))); } @@ -542,34 +535,29 @@ public void GenTypeParameters(Dafny.ISequence @params, out D _1036_fieldRustName = DCOMP.__default.escapeName(((_1034_field).dtor_formal).dtor_name); _1031_fields = Dafny.Sequence.Concat(_1031_fields, Dafny.Sequence.FromElements(RAST.Field.create(RAST.Visibility.create_PUB(), RAST.Formal.create(_1036_fieldRustName, _1035_fieldType)))); Std.Wrappers._IOption _source45 = (_1034_field).dtor_defaultValue; - bool unmatched45 = true; - if (unmatched45) { - if (_source45.is_Some) { - DAST._IExpression _1037_e = _source45.dtor_value; - unmatched45 = false; - { - RAST._IExpr _1038_expr; - DCOMP._IOwnership _1039___v42; - Dafny.ISet> _1040___v43; - RAST._IExpr _out29; - DCOMP._IOwnership _out30; - Dafny.ISet> _out31; - (this).GenExpr(_1037_e, Std.Wrappers.Option>.create_None(), DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out29, out _out30, out _out31); - _1038_expr = _out29; - _1039___v42 = _out30; - _1040___v43 = _out31; - _1032_fieldInits = Dafny.Sequence.Concat(_1032_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(DCOMP.__default.escapeName(((_1034_field).dtor_formal).dtor_name), RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::cell::RefCell::new("), (_1038_expr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")))))); - } - } - } - if (unmatched45) { - unmatched45 = false; + if (_source45.is_Some) { + DAST._IExpression _1037_e = _source45.dtor_value; { - RAST._IExpr _1041_default; - _1041_default = RAST.__default.std__Default__default; - _1032_fieldInits = Dafny.Sequence.Concat(_1032_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1036_fieldRustName, _1041_default))); - } + RAST._IExpr _1038_expr; + DCOMP._IOwnership _1039___v42; + Dafny.ISet> _1040___v43; + RAST._IExpr _out29; + DCOMP._IOwnership _out30; + Dafny.ISet> _out31; + (this).GenExpr(_1037_e, Std.Wrappers.Option>.create_None(), DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out29, out _out30, out _out31); + _1038_expr = _out29; + _1039___v42 = _out30; + _1040___v43 = _out31; + _1032_fieldInits = Dafny.Sequence.Concat(_1032_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(DCOMP.__default.escapeName(((_1034_field).dtor_formal).dtor_name), RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::cell::RefCell::new("), (_1038_expr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")))))); + } + goto after_match2; } + { + RAST._IExpr _1041_default; + _1041_default = RAST.__default.std__Default__default; + _1032_fieldInits = Dafny.Sequence.Concat(_1032_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1036_fieldRustName, _1041_default))); + } + after_match2: ; } BigInteger _hi8 = new BigInteger(((c).dtor_typeParams).Count); for (BigInteger _1042_typeParamI = BigInteger.Zero; _1042_typeParamI < _hi8; _1042_typeParamI++) { @@ -611,42 +599,37 @@ public void GenTypeParameters(Dafny.ISequence @params, out D DAST._IType _1053_superClass; _1053_superClass = ((c).dtor_superClasses).Select(_1052_i); DAST._IType _source46 = _1053_superClass; - bool unmatched46 = true; - if (unmatched46) { - if (_source46.is_Path) { - Dafny.ISequence> _1054_traitPath = _source46.dtor_Path_a0; - Dafny.ISequence _1055_typeArgs = _source46.dtor_typeArgs; - DAST._IResolvedType resolved0 = _source46.dtor_resolved; - if (resolved0.is_Trait) { - unmatched46 = false; - { - RAST._IType _1056_pathStr; - RAST._IType _out37; - _out37 = DCOMP.COMP.GenPath(_1054_traitPath); - _1056_pathStr = _out37; - Dafny.ISequence _1057_typeArgs; - Dafny.ISequence _out38; - _out38 = (this).GenTypeArgs(_1055_typeArgs, false, false); - _1057_typeArgs = _out38; - Dafny.ISequence _1058_body; - _1058_body = Dafny.Sequence.FromElements(); - if ((_1049_traitBodies).Contains(_1054_traitPath)) { - _1058_body = Dafny.Map>, Dafny.ISequence>.Select(_1049_traitBodies,_1054_traitPath); - } - RAST._IType _1059_genSelfPath; - RAST._IType _out39; - _out39 = DCOMP.COMP.GenPath(path); - _1059_genSelfPath = _out39; - RAST._IModDecl _1060_x; - _1060_x = RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1028_rTypeParamsDecls, RAST.Type.create_TypeApp(_1056_pathStr, _1057_typeArgs), RAST.__default.Rc(RAST.Type.create_TypeApp(_1059_genSelfPath, _1027_rTypeParams)), _1029_whereConstraints, _1058_body)); - s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1060_x)); + if (_source46.is_Path) { + Dafny.ISequence> _1054_traitPath = _source46.dtor_Path_a0; + Dafny.ISequence _1055_typeArgs = _source46.dtor_typeArgs; + DAST._IResolvedType resolved0 = _source46.dtor_resolved; + if (resolved0.is_Trait) { + { + RAST._IType _1056_pathStr; + RAST._IType _out37; + _out37 = DCOMP.COMP.GenPath(_1054_traitPath); + _1056_pathStr = _out37; + Dafny.ISequence _1057_typeArgs; + Dafny.ISequence _out38; + _out38 = (this).GenTypeArgs(_1055_typeArgs, false, false); + _1057_typeArgs = _out38; + Dafny.ISequence _1058_body; + _1058_body = Dafny.Sequence.FromElements(); + if ((_1049_traitBodies).Contains(_1054_traitPath)) { + _1058_body = Dafny.Map>, Dafny.ISequence>.Select(_1049_traitBodies,_1054_traitPath); } + RAST._IType _1059_genSelfPath; + RAST._IType _out39; + _out39 = DCOMP.COMP.GenPath(path); + _1059_genSelfPath = _out39; + RAST._IModDecl _1060_x; + _1060_x = RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1028_rTypeParamsDecls, RAST.Type.create_TypeApp(_1056_pathStr, _1057_typeArgs), RAST.__default.Rc(RAST.Type.create_TypeApp(_1059_genSelfPath, _1027_rTypeParams)), _1029_whereConstraints, _1058_body)); + s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1060_x)); } + goto after_match3; } } - if (unmatched46) { - unmatched46 = false; - } + after_match3: ; _1052_i = (_1052_i) + (BigInteger.One); } } @@ -729,20 +712,15 @@ public void GenTypeParameters(Dafny.ISequence @params, out D _1082_constrainedTypeParams = RAST.TypeParamDecl.ToStringMultiple(_1080_rTypeParamsDecls, Dafny.Sequence.Concat(RAST.__default.IND, RAST.__default.IND)); RAST._IType _1083_underlyingType = RAST.Type.Default(); Std.Wrappers._IOption _source47 = DCOMP.COMP.NewtypeToRustType((c).dtor_base, (c).dtor_range); - bool unmatched47 = true; - if (unmatched47) { - if (_source47.is_Some) { - RAST._IType _1084_v = _source47.dtor_value; - unmatched47 = false; - _1083_underlyingType = _1084_v; - } - } - if (unmatched47) { - unmatched47 = false; - RAST._IType _out49; - _out49 = (this).GenType((c).dtor_base, false, false); - _1083_underlyingType = _out49; - } + if (_source47.is_Some) { + RAST._IType _1084_v = _source47.dtor_value; + _1083_underlyingType = _1084_v; + goto after_match4; + } + RAST._IType _out49; + _out49 = (this).GenType((c).dtor_base, false, false); + _1083_underlyingType = _out49; + after_match4: ; DAST._IType _1085_resultingType; _1085_resultingType = DAST.Type.create_Path(Dafny.Sequence>.FromElements(), Dafny.Sequence.FromElements(), DAST.ResolvedType.create_Newtype((c).dtor_base, (c).dtor_range, false, (c).dtor_attributes)); Dafny.ISequence _1086_datatypeName; @@ -751,34 +729,33 @@ public void GenTypeParameters(Dafny.ISequence @params, out D RAST._IExpr _1087_fnBody; _1087_fnBody = RAST.Expr.create_Identifier(_1086_datatypeName); Std.Wrappers._IOption _source48 = (c).dtor_witnessExpr; - bool unmatched48 = true; - if (unmatched48) { - if (_source48.is_Some) { - DAST._IExpression _1088_e = _source48.dtor_value; - unmatched48 = false; - { - DAST._IExpression _1089_e; - _1089_e = ((object.Equals((c).dtor_base, _1085_resultingType)) ? (_1088_e) : (DAST.Expression.create_Convert(_1088_e, (c).dtor_base, _1085_resultingType))); - RAST._IExpr _1090_eStr; - DCOMP._IOwnership _1091___v48; - Dafny.ISet> _1092___v49; - RAST._IExpr _out50; - DCOMP._IOwnership _out51; - Dafny.ISet> _out52; - (this).GenExpr(_1089_e, Std.Wrappers.Option>.create_None(), DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out50, out _out51, out _out52); - _1090_eStr = _out50; - _1091___v48 = _out51; - _1092___v49 = _out52; - _1087_fnBody = (_1087_fnBody).Apply1(_1090_eStr); - } - } - } - if (unmatched48) { - unmatched48 = false; + if (_source48.is_Some) { + DAST._IExpression _1088_e = _source48.dtor_value; { - _1087_fnBody = (_1087_fnBody).Apply1(RAST.__default.std__Default__default); - } - } + DAST._IExpression _1089_e; + if (object.Equals((c).dtor_base, _1085_resultingType)) { + _1089_e = _1088_e; + } else { + _1089_e = DAST.Expression.create_Convert(_1088_e, (c).dtor_base, _1085_resultingType); + } + RAST._IExpr _1090_eStr; + DCOMP._IOwnership _1091___v48; + Dafny.ISet> _1092___v49; + RAST._IExpr _out50; + DCOMP._IOwnership _out51; + Dafny.ISet> _out52; + (this).GenExpr(_1089_e, Std.Wrappers.Option>.create_None(), DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out50, out _out51, out _out52); + _1090_eStr = _out50; + _1091___v48 = _out51; + _1092___v49 = _out52; + _1087_fnBody = (_1087_fnBody).Apply1(_1090_eStr); + } + goto after_match5; + } + { + _1087_fnBody = (_1087_fnBody).Apply1(RAST.__default.std__Default__default); + } + after_match5: ; RAST._IImplMember _1093_body; _1093_body = RAST.ImplMember.create_FnDecl(RAST.Visibility.create_PRIV(), RAST.Fn.create(Dafny.Sequence.UnicodeFromString("default"), Dafny.Sequence.FromElements(), Dafny.Sequence.FromElements(), Std.Wrappers.Option.create_Some(RAST.Type.create_SelfOwned()), Dafny.Sequence.UnicodeFromString(""), Std.Wrappers.Option.create_Some(_1087_fnBody))); s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1080_rTypeParamsDecls, RAST.__default.DefaultTrait, RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(_1086_datatypeName), _1079_rTypeParams), _1081_whereConstraints, Dafny.Sequence.FromElements(_1093_body))))); @@ -965,7 +942,11 @@ public void GenTypeParameters(Dafny.ISequence @params, out D Dafny.ISequence _1143_ctorMatch; _1143_ctorMatch = DCOMP.__default.escapeName((_1142_ctor).dtor_name); Dafny.ISequence _1144_modulePrefix; - _1144_modulePrefix = ((((((c).dtor_enclosingModule))).Equals(Dafny.Sequence.UnicodeFromString("_module"))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat((((c).dtor_enclosingModule)), Dafny.Sequence.UnicodeFromString(".")))); + if (((((c).dtor_enclosingModule))).Equals(Dafny.Sequence.UnicodeFromString("_module"))) { + _1144_modulePrefix = Dafny.Sequence.UnicodeFromString(""); + } else { + _1144_modulePrefix = Dafny.Sequence.Concat((((c).dtor_enclosingModule)), Dafny.Sequence.UnicodeFromString(".")); + } Dafny.ISequence _1145_ctorName; _1145_ctorName = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1144_modulePrefix, ((c).dtor_name)), Dafny.Sequence.UnicodeFromString(".")), ((_1142_ctor).dtor_name)); if (((new BigInteger((_1145_ctorName).Count)) >= (new BigInteger(13))) && (((_1145_ctorName).Subsequence(BigInteger.Zero, new BigInteger(13))).Equals(Dafny.Sequence.UnicodeFromString("_System.Tuple")))) { @@ -1047,7 +1028,11 @@ public static RAST._IType GenPath(Dafny.ISequence> p r = RAST.Type.create_SelfOwned(); return r; } else { - r = ((((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("std"))) ? (RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString(""))) : (RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("super")))); + if (((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("std"))) { + r = RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("")); + } else { + r = RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("super")); + } BigInteger _hi19 = new BigInteger((p).Count); for (BigInteger _1163_i = BigInteger.Zero; _1163_i < _hi19; _1163_i++) { r = (r).MSel(DCOMP.__default.escapeName(((p).Select(_1163_i)))); @@ -1062,7 +1047,11 @@ public static RAST._IExpr GenPathExpr(Dafny.ISequence.UnicodeFromString("std"))) ? (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString(""))) : (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("super")))); + if (((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("std"))) { + r = RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("")); + } else { + r = RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("super")); + } BigInteger _hi20 = new BigInteger((p).Count); for (BigInteger _1164_i = BigInteger.Zero; _1164_i < _hi20; _1164_i++) { r = (r).MSel(DCOMP.__default.escapeName(((p).Select(_1164_i)))); @@ -1095,298 +1084,250 @@ public RAST._IType GenType(DAST._IType c, bool inBinding, bool inFn) { RAST._IType s = RAST.Type.Default(); DAST._IType _source49 = c; - bool unmatched49 = true; - if (unmatched49) { - if (_source49.is_Path) { - Dafny.ISequence> _1167_p = _source49.dtor_Path_a0; - Dafny.ISequence _1168_args = _source49.dtor_typeArgs; - DAST._IResolvedType _1169_resolved = _source49.dtor_resolved; - unmatched49 = false; - { - RAST._IType _1170_t; - RAST._IType _out65; - _out65 = DCOMP.COMP.GenPath(_1167_p); - _1170_t = _out65; - Dafny.ISequence _1171_typeArgs; - Dafny.ISequence _out66; - _out66 = (this).GenTypeArgs(_1168_args, inBinding, inFn); - _1171_typeArgs = _out66; - s = RAST.Type.create_TypeApp(_1170_t, _1171_typeArgs); - DAST._IResolvedType _source50 = _1169_resolved; - bool unmatched50 = true; - if (unmatched50) { - if (_source50.is_Datatype) { - DAST._IDatatypeType datatypeType0 = _source50.dtor_datatypeType; - Dafny.ISequence _1172_attributes = datatypeType0.dtor_attributes; - unmatched50 = false; - { - if ((this).IsRcWrapped(_1172_attributes)) { - s = RAST.__default.Rc(s); - } - } - } - } - if (unmatched50) { - if (_source50.is_Trait) { - unmatched50 = false; - { - if ((_1167_p).Equals(Dafny.Sequence>.FromElements(Dafny.Sequence.UnicodeFromString("_System"), Dafny.Sequence.UnicodeFromString("object")))) { - s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("::std::rc::Rc")); - } else { - if (inBinding) { - s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("_")); - } else { - s = RAST.Type.create_ImplType(s); - } - } - } + if (_source49.is_Path) { + Dafny.ISequence> _1167_p = _source49.dtor_Path_a0; + Dafny.ISequence _1168_args = _source49.dtor_typeArgs; + DAST._IResolvedType _1169_resolved = _source49.dtor_resolved; + { + RAST._IType _1170_t; + RAST._IType _out65; + _out65 = DCOMP.COMP.GenPath(_1167_p); + _1170_t = _out65; + Dafny.ISequence _1171_typeArgs; + Dafny.ISequence _out66; + _out66 = (this).GenTypeArgs(_1168_args, inBinding, inFn); + _1171_typeArgs = _out66; + s = RAST.Type.create_TypeApp(_1170_t, _1171_typeArgs); + DAST._IResolvedType _source50 = _1169_resolved; + if (_source50.is_Datatype) { + DAST._IDatatypeType datatypeType0 = _source50.dtor_datatypeType; + Dafny.ISequence _1172_attributes = datatypeType0.dtor_attributes; + { + if ((this).IsRcWrapped(_1172_attributes)) { + s = RAST.__default.Rc(s); } } - if (unmatched50) { - DAST._IType _1173_t = _source50.dtor_baseType; - DAST._INewtypeRange _1174_range = _source50.dtor_range; - bool _1175_erased = _source50.dtor_erase; - Dafny.ISequence _1176_attributes = _source50.dtor_attributes; - unmatched50 = false; - { - if (_1175_erased) { - Std.Wrappers._IOption _source51 = DCOMP.COMP.NewtypeToRustType(_1173_t, _1174_range); - bool unmatched51 = true; - if (unmatched51) { - if (_source51.is_Some) { - RAST._IType _1177_v = _source51.dtor_value; - unmatched51 = false; - s = _1177_v; - } - } - if (unmatched51) { - unmatched51 = false; - } + goto after_match7; + } + if (_source50.is_Trait) { + { + if ((_1167_p).Equals(Dafny.Sequence>.FromElements(Dafny.Sequence.UnicodeFromString("_System"), Dafny.Sequence.UnicodeFromString("object")))) { + s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("::std::rc::Rc")); + } else { + if (inBinding) { + s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("_")); + } else { + s = RAST.Type.create_ImplType(s); } } } + goto after_match7; } - } - } - if (unmatched49) { - if (_source49.is_Nullable) { - DAST._IType _1178_inner = _source49.dtor_Nullable_a0; - unmatched49 = false; - { - RAST._IType _1179_innerExpr; - RAST._IType _out67; - _out67 = (this).GenType(_1178_inner, inBinding, inFn); - _1179_innerExpr = _out67; - s = RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("::std::option::Option")), Dafny.Sequence.FromElements(_1179_innerExpr)); - } - } - } - if (unmatched49) { - if (_source49.is_Tuple) { - Dafny.ISequence _1180_types = _source49.dtor_Tuple_a0; - unmatched49 = false; + DAST._IType _1173_t = _source50.dtor_baseType; + DAST._INewtypeRange _1174_range = _source50.dtor_range; + bool _1175_erased = _source50.dtor_erase; + Dafny.ISequence _1176_attributes = _source50.dtor_attributes; { - Dafny.ISequence _1181_args; - _1181_args = Dafny.Sequence.FromElements(); - BigInteger _1182_i; - _1182_i = BigInteger.Zero; - while ((_1182_i) < (new BigInteger((_1180_types).Count))) { - RAST._IType _1183_generated; - RAST._IType _out68; - _out68 = (this).GenType((_1180_types).Select(_1182_i), inBinding, inFn); - _1183_generated = _out68; - _1181_args = Dafny.Sequence.Concat(_1181_args, Dafny.Sequence.FromElements(_1183_generated)); - _1182_i = (_1182_i) + (BigInteger.One); + if (_1175_erased) { + Std.Wrappers._IOption _source51 = DCOMP.COMP.NewtypeToRustType(_1173_t, _1174_range); + if (_source51.is_Some) { + RAST._IType _1177_v = _source51.dtor_value; + s = _1177_v; + goto after_match8; + } + after_match8: ; } - s = (((new BigInteger((_1180_types).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) ? (RAST.Type.create_TupleType(_1181_args)) : (RAST.__default.SystemTupleType(_1181_args))); } + after_match7: ; } + goto after_match6; } - if (unmatched49) { - if (_source49.is_Array) { - DAST._IType _1184_element = _source49.dtor_element; - BigInteger _1185_dims = _source49.dtor_dims; - unmatched49 = false; - { - RAST._IType _1186_elem; - RAST._IType _out69; - _out69 = (this).GenType(_1184_element, inBinding, inFn); - _1186_elem = _out69; - s = _1186_elem; - BigInteger _1187_i; - _1187_i = BigInteger.Zero; - while ((_1187_i) < (_1185_dims)) { - s = RAST.__default.Rc(RAST.__default.RefCell(RAST.__default.Vec(s))); - _1187_i = (_1187_i) + (BigInteger.One); - } - } + if (_source49.is_Nullable) { + DAST._IType _1178_inner = _source49.dtor_Nullable_a0; + { + RAST._IType _1179_innerExpr; + RAST._IType _out67; + _out67 = (this).GenType(_1178_inner, inBinding, inFn); + _1179_innerExpr = _out67; + s = RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("::std::option::Option")), Dafny.Sequence.FromElements(_1179_innerExpr)); } + goto after_match6; } - if (unmatched49) { - if (_source49.is_Seq) { - DAST._IType _1188_element = _source49.dtor_element; - unmatched49 = false; - { - RAST._IType _1189_elem; - RAST._IType _out70; - _out70 = (this).GenType(_1188_element, inBinding, inFn); - _1189_elem = _out70; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements(_1189_elem)); + if (_source49.is_Tuple) { + Dafny.ISequence _1180_types = _source49.dtor_Tuple_a0; + { + Dafny.ISequence _1181_args; + _1181_args = Dafny.Sequence.FromElements(); + BigInteger _1182_i; + _1182_i = BigInteger.Zero; + while ((_1182_i) < (new BigInteger((_1180_types).Count))) { + RAST._IType _1183_generated; + RAST._IType _out68; + _out68 = (this).GenType((_1180_types).Select(_1182_i), inBinding, inFn); + _1183_generated = _out68; + _1181_args = Dafny.Sequence.Concat(_1181_args, Dafny.Sequence.FromElements(_1183_generated)); + _1182_i = (_1182_i) + (BigInteger.One); + } + if ((new BigInteger((_1180_types).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) { + s = RAST.Type.create_TupleType(_1181_args); + } else { + s = RAST.__default.SystemTupleType(_1181_args); } } + goto after_match6; } - if (unmatched49) { - if (_source49.is_Set) { - DAST._IType _1190_element = _source49.dtor_element; - unmatched49 = false; - { - RAST._IType _1191_elem; - RAST._IType _out71; - _out71 = (this).GenType(_1190_element, inBinding, inFn); - _1191_elem = _out71; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Set")), Dafny.Sequence.FromElements(_1191_elem)); - } + if (_source49.is_Array) { + DAST._IType _1184_element = _source49.dtor_element; + BigInteger _1185_dims = _source49.dtor_dims; + { + RAST._IType _1186_elem; + RAST._IType _out69; + _out69 = (this).GenType(_1184_element, inBinding, inFn); + _1186_elem = _out69; + s = _1186_elem; + BigInteger _1187_i; + _1187_i = BigInteger.Zero; + while ((_1187_i) < (_1185_dims)) { + s = RAST.__default.Rc(RAST.__default.RefCell(RAST.__default.Vec(s))); + _1187_i = (_1187_i) + (BigInteger.One); + } + } + goto after_match6; + } + if (_source49.is_Seq) { + DAST._IType _1188_element = _source49.dtor_element; + { + RAST._IType _1189_elem; + RAST._IType _out70; + _out70 = (this).GenType(_1188_element, inBinding, inFn); + _1189_elem = _out70; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements(_1189_elem)); } + goto after_match6; } - if (unmatched49) { - if (_source49.is_Multiset) { - DAST._IType _1192_element = _source49.dtor_element; - unmatched49 = false; - { - RAST._IType _1193_elem; - RAST._IType _out72; - _out72 = (this).GenType(_1192_element, inBinding, inFn); - _1193_elem = _out72; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Multiset")), Dafny.Sequence.FromElements(_1193_elem)); - } + if (_source49.is_Set) { + DAST._IType _1190_element = _source49.dtor_element; + { + RAST._IType _1191_elem; + RAST._IType _out71; + _out71 = (this).GenType(_1190_element, inBinding, inFn); + _1191_elem = _out71; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Set")), Dafny.Sequence.FromElements(_1191_elem)); } + goto after_match6; } - if (unmatched49) { - if (_source49.is_Map) { - DAST._IType _1194_key = _source49.dtor_key; - DAST._IType _1195_value = _source49.dtor_value; - unmatched49 = false; - { - RAST._IType _1196_keyType; - RAST._IType _out73; - _out73 = (this).GenType(_1194_key, inBinding, inFn); - _1196_keyType = _out73; - RAST._IType _1197_valueType; - RAST._IType _out74; - _out74 = (this).GenType(_1195_value, inBinding, inFn); - _1197_valueType = _out74; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Map")), Dafny.Sequence.FromElements(_1196_keyType, _1197_valueType)); - } + if (_source49.is_Multiset) { + DAST._IType _1192_element = _source49.dtor_element; + { + RAST._IType _1193_elem; + RAST._IType _out72; + _out72 = (this).GenType(_1192_element, inBinding, inFn); + _1193_elem = _out72; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Multiset")), Dafny.Sequence.FromElements(_1193_elem)); } + goto after_match6; } - if (unmatched49) { - if (_source49.is_MapBuilder) { - DAST._IType _1198_key = _source49.dtor_key; - DAST._IType _1199_value = _source49.dtor_value; - unmatched49 = false; - { - RAST._IType _1200_keyType; - RAST._IType _out75; - _out75 = (this).GenType(_1198_key, inBinding, inFn); - _1200_keyType = _out75; - RAST._IType _1201_valueType; - RAST._IType _out76; - _out76 = (this).GenType(_1199_value, inBinding, inFn); - _1201_valueType = _out76; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder")), Dafny.Sequence.FromElements(_1200_keyType, _1201_valueType)); - } + if (_source49.is_Map) { + DAST._IType _1194_key = _source49.dtor_key; + DAST._IType _1195_value = _source49.dtor_value; + { + RAST._IType _1196_keyType; + RAST._IType _out73; + _out73 = (this).GenType(_1194_key, inBinding, inFn); + _1196_keyType = _out73; + RAST._IType _1197_valueType; + RAST._IType _out74; + _out74 = (this).GenType(_1195_value, inBinding, inFn); + _1197_valueType = _out74; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Map")), Dafny.Sequence.FromElements(_1196_keyType, _1197_valueType)); + } + goto after_match6; + } + if (_source49.is_MapBuilder) { + DAST._IType _1198_key = _source49.dtor_key; + DAST._IType _1199_value = _source49.dtor_value; + { + RAST._IType _1200_keyType; + RAST._IType _out75; + _out75 = (this).GenType(_1198_key, inBinding, inFn); + _1200_keyType = _out75; + RAST._IType _1201_valueType; + RAST._IType _out76; + _out76 = (this).GenType(_1199_value, inBinding, inFn); + _1201_valueType = _out76; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder")), Dafny.Sequence.FromElements(_1200_keyType, _1201_valueType)); + } + goto after_match6; + } + if (_source49.is_SetBuilder) { + DAST._IType _1202_elem = _source49.dtor_element; + { + RAST._IType _1203_elemType; + RAST._IType _out77; + _out77 = (this).GenType(_1202_elem, inBinding, inFn); + _1203_elemType = _out77; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder")), Dafny.Sequence.FromElements(_1203_elemType)); } + goto after_match6; } - if (unmatched49) { - if (_source49.is_SetBuilder) { - DAST._IType _1202_elem = _source49.dtor_element; - unmatched49 = false; - { - RAST._IType _1203_elemType; - RAST._IType _out77; - _out77 = (this).GenType(_1202_elem, inBinding, inFn); - _1203_elemType = _out77; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder")), Dafny.Sequence.FromElements(_1203_elemType)); + if (_source49.is_Arrow) { + Dafny.ISequence _1204_args = _source49.dtor_args; + DAST._IType _1205_result = _source49.dtor_result; + { + Dafny.ISequence _1206_argTypes; + _1206_argTypes = Dafny.Sequence.FromElements(); + BigInteger _1207_i; + _1207_i = BigInteger.Zero; + while ((_1207_i) < (new BigInteger((_1204_args).Count))) { + RAST._IType _1208_generated; + RAST._IType _out78; + _out78 = (this).GenType((_1204_args).Select(_1207_i), inBinding, true); + _1208_generated = _out78; + _1206_argTypes = Dafny.Sequence.Concat(_1206_argTypes, Dafny.Sequence.FromElements(RAST.Type.create_Borrowed(_1208_generated))); + _1207_i = (_1207_i) + (BigInteger.One); + } + RAST._IType _1209_resultType; + RAST._IType _out79; + _out79 = (this).GenType(_1205_result, inBinding, (inFn) || (inBinding)); + _1209_resultType = _out79; + s = RAST.__default.Rc(RAST.Type.create_DynType(RAST.Type.create_FnType(_1206_argTypes, _1209_resultType))); + } + goto after_match6; + } + if (_source49.is_TypeArg) { + Dafny.ISequence _h100 = _source49.dtor_TypeArg_a0; + Dafny.ISequence _1210_name = _h100; + s = RAST.Type.create_TIdentifier(DCOMP.__default.escapeName(_1210_name)); + goto after_match6; + } + if (_source49.is_Primitive) { + DAST._IPrimitive _1211_p = _source49.dtor_Primitive_a0; + { + DAST._IPrimitive _source52 = _1211_p; + if (_source52.is_Int) { + s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("DafnyInt")); + goto after_match9; } - } - } - if (unmatched49) { - if (_source49.is_Arrow) { - Dafny.ISequence _1204_args = _source49.dtor_args; - DAST._IType _1205_result = _source49.dtor_result; - unmatched49 = false; - { - Dafny.ISequence _1206_argTypes; - _1206_argTypes = Dafny.Sequence.FromElements(); - BigInteger _1207_i; - _1207_i = BigInteger.Zero; - while ((_1207_i) < (new BigInteger((_1204_args).Count))) { - RAST._IType _1208_generated; - RAST._IType _out78; - _out78 = (this).GenType((_1204_args).Select(_1207_i), inBinding, true); - _1208_generated = _out78; - _1206_argTypes = Dafny.Sequence.Concat(_1206_argTypes, Dafny.Sequence.FromElements(RAST.Type.create_Borrowed(_1208_generated))); - _1207_i = (_1207_i) + (BigInteger.One); - } - RAST._IType _1209_resultType; - RAST._IType _out79; - _out79 = (this).GenType(_1205_result, inBinding, (inFn) || (inBinding)); - _1209_resultType = _out79; - s = RAST.__default.Rc(RAST.Type.create_DynType(RAST.Type.create_FnType(_1206_argTypes, _1209_resultType))); + if (_source52.is_Real) { + s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("BigRational")); + goto after_match9; } - } - } - if (unmatched49) { - if (_source49.is_TypeArg) { - Dafny.ISequence _h100 = _source49.dtor_TypeArg_a0; - Dafny.ISequence _1210_name = _h100; - unmatched49 = false; - s = RAST.Type.create_TIdentifier(DCOMP.__default.escapeName(_1210_name)); - } - } - if (unmatched49) { - if (_source49.is_Primitive) { - DAST._IPrimitive _1211_p = _source49.dtor_Primitive_a0; - unmatched49 = false; - { - DAST._IPrimitive _source52 = _1211_p; - bool unmatched52 = true; - if (unmatched52) { - if (_source52.is_Int) { - unmatched52 = false; - s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("DafnyInt")); - } - } - if (unmatched52) { - if (_source52.is_Real) { - unmatched52 = false; - s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("BigRational")); - } - } - if (unmatched52) { - if (_source52.is_String) { - unmatched52 = false; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements((RAST.__default.dafny__runtime__type).MSel((this).DafnyChar))); - } - } - if (unmatched52) { - if (_source52.is_Bool) { - unmatched52 = false; - s = RAST.Type.create_Bool(); - } - } - if (unmatched52) { - unmatched52 = false; - s = (RAST.__default.dafny__runtime__type).MSel((this).DafnyChar); - } + if (_source52.is_String) { + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements((RAST.__default.dafny__runtime__type).MSel((this).DafnyChar))); + goto after_match9; + } + if (_source52.is_Bool) { + s = RAST.Type.create_Bool(); + goto after_match9; } + s = (RAST.__default.dafny__runtime__type).MSel((this).DafnyChar); + after_match9: ; } + goto after_match6; } - if (unmatched49) { - Dafny.ISequence _1212_v = _source49.dtor_Passthrough_a0; - unmatched49 = false; - s = RAST.__default.RawType(_1212_v); - } + Dafny.ISequence _1212_v = _source49.dtor_Passthrough_a0; + s = RAST.__default.RawType(_1212_v); + after_match6: ; return s; } public void GenClassImplBody(Dafny.ISequence body, bool forTrait, DAST._IType enclosingType, Dafny.ISet enclosingTypeParams, out Dafny.ISequence s, out Dafny.IMap>,Dafny.ISequence> traitBodies) @@ -1398,44 +1339,36 @@ public void GenClassImplBody(Dafny.ISequence body, bool forTrait, BigInteger _hi21 = new BigInteger((body).Count); for (BigInteger _1213_i = BigInteger.Zero; _1213_i < _hi21; _1213_i++) { DAST._IMethod _source53 = (body).Select(_1213_i); - bool unmatched53 = true; - if (unmatched53) { - DAST._IMethod _1214_m = _source53; - unmatched53 = false; - { - Std.Wrappers._IOption>> _source54 = (_1214_m).dtor_overridingPath; - bool unmatched54 = true; - if (unmatched54) { - if (_source54.is_Some) { - Dafny.ISequence> _1215_p = _source54.dtor_value; - unmatched54 = false; - { - Dafny.ISequence _1216_existing; - _1216_existing = Dafny.Sequence.FromElements(); - if ((traitBodies).Contains(_1215_p)) { - _1216_existing = Dafny.Map>, Dafny.ISequence>.Select(traitBodies,_1215_p); - } - RAST._IImplMember _1217_genMethod; - RAST._IImplMember _out80; - _out80 = (this).GenMethod(_1214_m, true, enclosingType, enclosingTypeParams); - _1217_genMethod = _out80; - _1216_existing = Dafny.Sequence.Concat(_1216_existing, Dafny.Sequence.FromElements(_1217_genMethod)); - traitBodies = Dafny.Map>, Dafny.ISequence>.Merge(traitBodies, Dafny.Map>, Dafny.ISequence>.FromElements(new Dafny.Pair>, Dafny.ISequence>(_1215_p, _1216_existing))); - } - } - } - if (unmatched54) { - unmatched54 = false; - { - RAST._IImplMember _1218_generated; - RAST._IImplMember _out81; - _out81 = (this).GenMethod(_1214_m, forTrait, enclosingType, enclosingTypeParams); - _1218_generated = _out81; - s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1218_generated)); + DAST._IMethod _1214_m = _source53; + { + Std.Wrappers._IOption>> _source54 = (_1214_m).dtor_overridingPath; + if (_source54.is_Some) { + Dafny.ISequence> _1215_p = _source54.dtor_value; + { + Dafny.ISequence _1216_existing; + _1216_existing = Dafny.Sequence.FromElements(); + if ((traitBodies).Contains(_1215_p)) { + _1216_existing = Dafny.Map>, Dafny.ISequence>.Select(traitBodies,_1215_p); } + RAST._IImplMember _1217_genMethod; + RAST._IImplMember _out80; + _out80 = (this).GenMethod(_1214_m, true, enclosingType, enclosingTypeParams); + _1217_genMethod = _out80; + _1216_existing = Dafny.Sequence.Concat(_1216_existing, Dafny.Sequence.FromElements(_1217_genMethod)); + traitBodies = Dafny.Map>, Dafny.ISequence>.Merge(traitBodies, Dafny.Map>, Dafny.ISequence>.FromElements(new Dafny.Pair>, Dafny.ISequence>(_1215_p, _1216_existing))); } + goto after_match11; + } + { + RAST._IImplMember _1218_generated; + RAST._IImplMember _out81; + _out81 = (this).GenMethod(_1214_m, forTrait, enclosingType, enclosingTypeParams); + _1218_generated = _out81; + s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1218_generated)); } + after_match11: ; } + after_match10: ; } } public Dafny.ISequence GenParams(Dafny.ISequence @params) @@ -1541,8 +1474,9 @@ public RAST._IImplMember GenMethod(DAST._IMethod m, bool forTrait, DAST._IType e (this).GenTypeParam((_1238_typeParamsFiltered).Select(_1242_i), out _out86, out _out87); _1243_typeArg = _out86; _1244_rTypeParamDecl = _out87; - var _pat_let_tv101 = _1244_rTypeParamDecl; - _1244_rTypeParamDecl = Dafny.Helpers.Let(_1244_rTypeParamDecl, _pat_let6_0 => Dafny.Helpers.Let(_pat_let6_0, _1245_dt__update__tmp_h0 => Dafny.Helpers.Let, RAST._ITypeParamDecl>(Dafny.Sequence.Concat((_pat_let_tv101).dtor_constraints, Dafny.Sequence.FromElements(((RAST.__default.std__type).MSel(Dafny.Sequence.UnicodeFromString("default"))).MSel(Dafny.Sequence.UnicodeFromString("Default")))), _pat_let7_0 => Dafny.Helpers.Let, RAST._ITypeParamDecl>(_pat_let7_0, _1246_dt__update_hconstraints_h0 => RAST.TypeParamDecl.create((_1245_dt__update__tmp_h0).dtor_content, _1246_dt__update_hconstraints_h0))))); + RAST._ITypeParamDecl _1245_dt__update__tmp_h0 = _1244_rTypeParamDecl; + Dafny.ISequence _1246_dt__update_hconstraints_h0 = Dafny.Sequence.Concat((_1244_rTypeParamDecl).dtor_constraints, Dafny.Sequence.FromElements(((RAST.__default.std__type).MSel(Dafny.Sequence.UnicodeFromString("default"))).MSel(Dafny.Sequence.UnicodeFromString("Default")))); + _1244_rTypeParamDecl = RAST.TypeParamDecl.create((_1245_dt__update__tmp_h0).dtor_content, _1246_dt__update_hconstraints_h0); _1241_typeParams = Dafny.Sequence.Concat(_1241_typeParams, Dafny.Sequence.FromElements(_1244_rTypeParamDecl)); } } @@ -1554,51 +1488,50 @@ public RAST._IImplMember GenMethod(DAST._IMethod m, bool forTrait, DAST._IType e RAST._IExpr _1250_earlyReturn; _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_None()); Std.Wrappers._IOption>> _source55 = (m).dtor_outVars; - bool unmatched55 = true; - if (unmatched55) { - if (_source55.is_Some) { - Dafny.ISequence> _1251_outVars = _source55.dtor_value; - unmatched55 = false; - { - Dafny.ISequence _1252_tupleArgs; - _1252_tupleArgs = Dafny.Sequence.FromElements(); - BigInteger _hi26 = new BigInteger((_1251_outVars).Count); - for (BigInteger _1253_outI = BigInteger.Zero; _1253_outI < _hi26; _1253_outI++) { - Dafny.ISequence _1254_outVar; - _1254_outVar = (_1251_outVars).Select(_1253_outI); - RAST._IType _1255_outType; - RAST._IType _out88; - _out88 = (this).GenType(((m).dtor_outTypes).Select(_1253_outI), false, false); - _1255_outType = _out88; - Dafny.ISequence _1256_outName; - _1256_outName = DCOMP.__default.escapeName((_1254_outVar)); - _1223_paramNames = Dafny.Sequence>.Concat(_1223_paramNames, Dafny.Sequence>.FromElements(_1256_outName)); - RAST._IType _1257_outMaybeType; - _1257_outMaybeType = (((_1255_outType).CanReadWithoutClone()) ? (_1255_outType) : (RAST.Type.create_Borrowed(_1255_outType))); - _1224_paramTypes = Dafny.Map, RAST._IType>.Update(_1224_paramTypes, _1256_outName, _1257_outMaybeType); - RAST._IExpr _1258_outVarReturn; - DCOMP._IOwnership _1259___v53; - Dafny.ISet> _1260___v54; - RAST._IExpr _out89; - DCOMP._IOwnership _out90; - Dafny.ISet> _out91; - (this).GenExpr(DAST.Expression.create_Ident((_1254_outVar)), Std.Wrappers.Option>.create_None(), DCOMP.Environment.create(Dafny.Sequence>.FromElements(_1256_outName), Dafny.Map, RAST._IType>.FromElements(new Dafny.Pair, RAST._IType>(_1256_outName, _1257_outMaybeType))), DCOMP.Ownership.create_OwnershipOwned(), out _out89, out _out90, out _out91); - _1258_outVarReturn = _out89; - _1259___v53 = _out90; - _1260___v54 = _out91; - _1252_tupleArgs = Dafny.Sequence.Concat(_1252_tupleArgs, Dafny.Sequence.FromElements(_1258_outVarReturn)); - } - if ((new BigInteger((_1252_tupleArgs).Count)) == (BigInteger.One)) { - _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some((_1252_tupleArgs).Select(BigInteger.Zero))); + if (_source55.is_Some) { + Dafny.ISequence> _1251_outVars = _source55.dtor_value; + { + Dafny.ISequence _1252_tupleArgs; + _1252_tupleArgs = Dafny.Sequence.FromElements(); + BigInteger _hi26 = new BigInteger((_1251_outVars).Count); + for (BigInteger _1253_outI = BigInteger.Zero; _1253_outI < _hi26; _1253_outI++) { + Dafny.ISequence _1254_outVar; + _1254_outVar = (_1251_outVars).Select(_1253_outI); + RAST._IType _1255_outType; + RAST._IType _out88; + _out88 = (this).GenType(((m).dtor_outTypes).Select(_1253_outI), false, false); + _1255_outType = _out88; + Dafny.ISequence _1256_outName; + _1256_outName = DCOMP.__default.escapeName((_1254_outVar)); + _1223_paramNames = Dafny.Sequence>.Concat(_1223_paramNames, Dafny.Sequence>.FromElements(_1256_outName)); + RAST._IType _1257_outMaybeType; + if ((_1255_outType).CanReadWithoutClone()) { + _1257_outMaybeType = _1255_outType; } else { - _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(RAST.Expr.create_Tuple(_1252_tupleArgs))); + _1257_outMaybeType = RAST.Type.create_Borrowed(_1255_outType); } + _1224_paramTypes = Dafny.Map, RAST._IType>.Update(_1224_paramTypes, _1256_outName, _1257_outMaybeType); + RAST._IExpr _1258_outVarReturn; + DCOMP._IOwnership _1259___v53; + Dafny.ISet> _1260___v54; + RAST._IExpr _out89; + DCOMP._IOwnership _out90; + Dafny.ISet> _out91; + (this).GenExpr(DAST.Expression.create_Ident((_1254_outVar)), Std.Wrappers.Option>.create_None(), DCOMP.Environment.create(Dafny.Sequence>.FromElements(_1256_outName), Dafny.Map, RAST._IType>.FromElements(new Dafny.Pair, RAST._IType>(_1256_outName, _1257_outMaybeType))), DCOMP.Ownership.create_OwnershipOwned(), out _out89, out _out90, out _out91); + _1258_outVarReturn = _out89; + _1259___v53 = _out90; + _1260___v54 = _out91; + _1252_tupleArgs = Dafny.Sequence.Concat(_1252_tupleArgs, Dafny.Sequence.FromElements(_1258_outVarReturn)); + } + if ((new BigInteger((_1252_tupleArgs).Count)) == (BigInteger.One)) { + _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some((_1252_tupleArgs).Select(BigInteger.Zero))); + } else { + _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(RAST.Expr.create_Tuple(_1252_tupleArgs))); } } + goto after_match12; } - if (unmatched55) { - unmatched55 = false; - } + after_match12: ; _1248_env = DCOMP.Environment.create(_1223_paramNames, _1224_paramTypes); RAST._IExpr _1261_body; Dafny.ISet> _1262___v55; @@ -1645,19 +1578,14 @@ public void GenStmts(Dafny.ISequence stmts, Std.Wrappers._IOpt _1269_newEnv2 = _out97; newEnv = _1269_newEnv2; DAST._IStatement _source56 = _1266_stmt; - bool unmatched56 = true; - if (unmatched56) { - if (_source56.is_DeclareVar) { - Dafny.ISequence _1270_name = _source56.dtor_name; - unmatched56 = false; - { - _1264_declarations = Dafny.Set>.Union(_1264_declarations, Dafny.Set>.FromElements(DCOMP.__default.escapeName(_1270_name))); - } + if (_source56.is_DeclareVar) { + Dafny.ISequence _1270_name = _source56.dtor_name; + { + _1264_declarations = Dafny.Set>.Union(_1264_declarations, Dafny.Set>.FromElements(DCOMP.__default.escapeName(_1270_name))); } + goto after_match13; } - if (unmatched56) { - unmatched56 = false; - } + after_match13: ; readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.Difference(_1268_recIdents, _1264_declarations)); generated = (generated).Then(_1267_stmtExpr); _1265_i = (_1265_i) + (BigInteger.One); @@ -1671,94 +1599,87 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, Std.Wrappers._IO newEnv = DCOMP.Environment.Default(); newEnv = env; DAST._IAssignLhs _source57 = lhs; - bool unmatched57 = true; - if (unmatched57) { - if (_source57.is_Ident) { - Dafny.ISequence ident0 = _source57.dtor_ident; - Dafny.ISequence _1271_id = ident0; - unmatched57 = false; - { - Dafny.ISequence _1272_idRust; - _1272_idRust = DCOMP.__default.escapeName(_1271_id); - if (((env).IsBorrowed(_1272_idRust)) || ((env).IsBorrowedMut(_1272_idRust))) { - generated = RAST.__default.AssignVar(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*"), _1272_idRust), rhs); - } else { - generated = RAST.__default.AssignVar(_1272_idRust, rhs); - } - readIdents = Dafny.Set>.FromElements(_1272_idRust); - needsIIFE = false; - } - } - } - if (unmatched57) { - if (_source57.is_Select) { - DAST._IExpression _1273_on = _source57.dtor_expr; - Dafny.ISequence _1274_field = _source57.dtor_field; - unmatched57 = false; - { - Dafny.ISequence _1275_fieldName; - _1275_fieldName = DCOMP.__default.escapeName(_1274_field); - RAST._IExpr _1276_onExpr; - DCOMP._IOwnership _1277_onOwned; - Dafny.ISet> _1278_recIdents; - RAST._IExpr _out98; - DCOMP._IOwnership _out99; - Dafny.ISet> _out100; - (this).GenExpr(_1273_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowedMut(), out _out98, out _out99, out _out100); - _1276_onExpr = _out98; - _1277_onOwned = _out99; - _1278_recIdents = _out100; - generated = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*("), (_1276_onExpr)._ToString(RAST.__default.IND)), Dafny.Sequence.UnicodeFromString(".")), _1275_fieldName), Dafny.Sequence.UnicodeFromString(".borrow_mut()) = ")), (rhs)._ToString(RAST.__default.IND)), Dafny.Sequence.UnicodeFromString(";"))); - readIdents = _1278_recIdents; - needsIIFE = true; + if (_source57.is_Ident) { + Dafny.ISequence ident0 = _source57.dtor_ident; + Dafny.ISequence _1271_id = ident0; + { + Dafny.ISequence _1272_idRust; + _1272_idRust = DCOMP.__default.escapeName(_1271_id); + if (((env).IsBorrowed(_1272_idRust)) || ((env).IsBorrowedMut(_1272_idRust))) { + generated = RAST.__default.AssignVar(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*"), _1272_idRust), rhs); + } else { + generated = RAST.__default.AssignVar(_1272_idRust, rhs); } + readIdents = Dafny.Set>.FromElements(_1272_idRust); + needsIIFE = false; } + goto after_match14; } - if (unmatched57) { - DAST._IExpression _1279_on = _source57.dtor_expr; - Dafny.ISequence _1280_indices = _source57.dtor_indices; - unmatched57 = false; + if (_source57.is_Select) { + DAST._IExpression _1273_on = _source57.dtor_expr; + Dafny.ISequence _1274_field = _source57.dtor_field; { - RAST._IExpr _1281_onExpr; - DCOMP._IOwnership _1282_onOwned; - Dafny.ISet> _1283_recIdents; - RAST._IExpr _out101; - DCOMP._IOwnership _out102; - Dafny.ISet> _out103; - (this).GenExpr(_1279_on, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out101, out _out102, out _out103); - _1281_onExpr = _out101; - _1282_onOwned = _out102; - _1283_recIdents = _out103; - readIdents = _1283_recIdents; - Dafny.ISequence _1284_r; - _1284_r = Dafny.Sequence.UnicodeFromString("{\n"); - BigInteger _1285_i; - _1285_i = BigInteger.Zero; - while ((_1285_i) < (new BigInteger((_1280_indices).Count))) { - RAST._IExpr _1286_idx; - DCOMP._IOwnership _1287___v60; - Dafny.ISet> _1288_recIdentsIdx; - RAST._IExpr _out104; - DCOMP._IOwnership _out105; - Dafny.ISet> _out106; - (this).GenExpr((_1280_indices).Select(_1285_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out104, out _out105, out _out106); - _1286_idx = _out104; - _1287___v60 = _out105; - _1288_recIdentsIdx = _out106; - _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString("let __idx")), Std.Strings.__default.OfNat(_1285_i)), Dafny.Sequence.UnicodeFromString(" = ::from(")), (_1286_idx)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap();\n")); - readIdents = Dafny.Set>.Union(readIdents, _1288_recIdentsIdx); - _1285_i = (_1285_i) + (BigInteger.One); - } - _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, (_1281_onExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(".borrow_mut()")); - _1285_i = BigInteger.Zero; - while ((_1285_i) < (new BigInteger((_1280_indices).Count))) { - _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString("[__idx")), Std.Strings.__default.OfNat(_1285_i)), Dafny.Sequence.UnicodeFromString("]")); - _1285_i = (_1285_i) + (BigInteger.One); - } - generated = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString(" = ")), (rhs)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";\n}"))); + Dafny.ISequence _1275_fieldName; + _1275_fieldName = DCOMP.__default.escapeName(_1274_field); + RAST._IExpr _1276_onExpr; + DCOMP._IOwnership _1277_onOwned; + Dafny.ISet> _1278_recIdents; + RAST._IExpr _out98; + DCOMP._IOwnership _out99; + Dafny.ISet> _out100; + (this).GenExpr(_1273_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowedMut(), out _out98, out _out99, out _out100); + _1276_onExpr = _out98; + _1277_onOwned = _out99; + _1278_recIdents = _out100; + generated = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*("), (_1276_onExpr)._ToString(RAST.__default.IND)), Dafny.Sequence.UnicodeFromString(".")), _1275_fieldName), Dafny.Sequence.UnicodeFromString(".borrow_mut()) = ")), (rhs)._ToString(RAST.__default.IND)), Dafny.Sequence.UnicodeFromString(";"))); + readIdents = _1278_recIdents; needsIIFE = true; } - } + goto after_match14; + } + DAST._IExpression _1279_on = _source57.dtor_expr; + Dafny.ISequence _1280_indices = _source57.dtor_indices; + { + RAST._IExpr _1281_onExpr; + DCOMP._IOwnership _1282_onOwned; + Dafny.ISet> _1283_recIdents; + RAST._IExpr _out101; + DCOMP._IOwnership _out102; + Dafny.ISet> _out103; + (this).GenExpr(_1279_on, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out101, out _out102, out _out103); + _1281_onExpr = _out101; + _1282_onOwned = _out102; + _1283_recIdents = _out103; + readIdents = _1283_recIdents; + Dafny.ISequence _1284_r; + _1284_r = Dafny.Sequence.UnicodeFromString("{\n"); + BigInteger _1285_i; + _1285_i = BigInteger.Zero; + while ((_1285_i) < (new BigInteger((_1280_indices).Count))) { + RAST._IExpr _1286_idx; + DCOMP._IOwnership _1287___v60; + Dafny.ISet> _1288_recIdentsIdx; + RAST._IExpr _out104; + DCOMP._IOwnership _out105; + Dafny.ISet> _out106; + (this).GenExpr((_1280_indices).Select(_1285_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out104, out _out105, out _out106); + _1286_idx = _out104; + _1287___v60 = _out105; + _1288_recIdentsIdx = _out106; + _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString("let __idx")), Std.Strings.__default.OfNat(_1285_i)), Dafny.Sequence.UnicodeFromString(" = ::from(")), (_1286_idx)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap();\n")); + readIdents = Dafny.Set>.Union(readIdents, _1288_recIdentsIdx); + _1285_i = (_1285_i) + (BigInteger.One); + } + _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, (_1281_onExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(".borrow_mut()")); + _1285_i = BigInteger.Zero; + while ((_1285_i) < (new BigInteger((_1280_indices).Count))) { + _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString("[__idx")), Std.Strings.__default.OfNat(_1285_i)), Dafny.Sequence.UnicodeFromString("]")); + _1285_i = (_1285_i) + (BigInteger.One); + } + generated = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString(" = ")), (rhs)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";\n}"))); + needsIIFE = true; + } + after_match14: ; } public void GenStmt(DAST._IStatement stmt, Std.Wrappers._IOption> selfIdent, DCOMP._IEnvironment env, bool isLast, RAST._IExpr earlyReturn, out RAST._IExpr generated, out Dafny.ISet> readIdents, out DCOMP._IEnvironment newEnv) { @@ -1766,613 +1687,519 @@ public void GenStmt(DAST._IStatement stmt, Std.Wrappers._IOption>.Empty; newEnv = DCOMP.Environment.Default(); DAST._IStatement _source58 = stmt; - bool unmatched58 = true; - if (unmatched58) { - if (_source58.is_DeclareVar) { - Dafny.ISequence _1289_name = _source58.dtor_name; - DAST._IType _1290_typ = _source58.dtor_typ; - Std.Wrappers._IOption maybeValue0 = _source58.dtor_maybeValue; - if (maybeValue0.is_Some) { - DAST._IExpression _1291_expression = maybeValue0.dtor_value; - unmatched58 = false; - { - RAST._IType _1292_tpe; - RAST._IType _out107; - _out107 = (this).GenType(_1290_typ, true, false); - _1292_tpe = _out107; - RAST._IExpr _1293_expr; - DCOMP._IOwnership _1294_exprOwnership; - Dafny.ISet> _1295_recIdents; - RAST._IExpr _out108; - DCOMP._IOwnership _out109; - Dafny.ISet> _out110; - (this).GenExpr(_1291_expression, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out108, out _out109, out _out110); - _1293_expr = _out108; - _1294_exprOwnership = _out109; - _1295_recIdents = _out110; - readIdents = _1295_recIdents; - generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), DCOMP.__default.escapeName(_1289_name), Std.Wrappers.Option.create_Some(_1292_tpe), Std.Wrappers.Option.create_Some(_1293_expr)); - newEnv = (env).AddAssigned(DCOMP.__default.escapeName(_1289_name), _1292_tpe); - } - } - } - } - if (unmatched58) { - if (_source58.is_DeclareVar) { - Dafny.ISequence _1296_name = _source58.dtor_name; - DAST._IType _1297_typ = _source58.dtor_typ; - Std.Wrappers._IOption maybeValue1 = _source58.dtor_maybeValue; - if (maybeValue1.is_None) { - unmatched58 = false; - { - DAST._IStatement _1298_newStmt; - _1298_newStmt = DAST.Statement.create_DeclareVar(_1296_name, _1297_typ, Std.Wrappers.Option.create_Some(DAST.Expression.create_InitializationValue(_1297_typ))); - RAST._IExpr _out111; - Dafny.ISet> _out112; - DCOMP._IEnvironment _out113; - (this).GenStmt(_1298_newStmt, selfIdent, env, isLast, earlyReturn, out _out111, out _out112, out _out113); - generated = _out111; - readIdents = _out112; - newEnv = _out113; - } - } - } - } - if (unmatched58) { - if (_source58.is_Assign) { - DAST._IAssignLhs _1299_lhs = _source58.dtor_lhs; - DAST._IExpression _1300_expression = _source58.dtor_value; - unmatched58 = false; + if (_source58.is_DeclareVar) { + Dafny.ISequence _1289_name = _source58.dtor_name; + DAST._IType _1290_typ = _source58.dtor_typ; + Std.Wrappers._IOption maybeValue0 = _source58.dtor_maybeValue; + if (maybeValue0.is_Some) { + DAST._IExpression _1291_expression = maybeValue0.dtor_value; { - RAST._IExpr _1301_exprGen; - DCOMP._IOwnership _1302___v61; - Dafny.ISet> _1303_exprIdents; - RAST._IExpr _out114; - DCOMP._IOwnership _out115; - Dafny.ISet> _out116; - (this).GenExpr(_1300_expression, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out114, out _out115, out _out116); - _1301_exprGen = _out114; - _1302___v61 = _out115; - _1303_exprIdents = _out116; - if ((_1299_lhs).is_Ident) { - Dafny.ISequence _1304_rustId; - _1304_rustId = DCOMP.__default.escapeName(((_1299_lhs).dtor_ident)); - Std.Wrappers._IOption _1305_tpe; - _1305_tpe = (env).GetType(_1304_rustId); - } - RAST._IExpr _1306_lhsGen; - bool _1307_needsIIFE; - Dafny.ISet> _1308_recIdents; - DCOMP._IEnvironment _1309_resEnv; - RAST._IExpr _out117; - bool _out118; - Dafny.ISet> _out119; - DCOMP._IEnvironment _out120; - (this).GenAssignLhs(_1299_lhs, _1301_exprGen, selfIdent, env, out _out117, out _out118, out _out119, out _out120); - _1306_lhsGen = _out117; - _1307_needsIIFE = _out118; - _1308_recIdents = _out119; - _1309_resEnv = _out120; - generated = _1306_lhsGen; - newEnv = _1309_resEnv; - if (_1307_needsIIFE) { - generated = RAST.Expr.create_Block(generated); - } - readIdents = Dafny.Set>.Union(_1308_recIdents, _1303_exprIdents); - } - } - } - if (unmatched58) { - if (_source58.is_If) { - DAST._IExpression _1310_cond = _source58.dtor_cond; - Dafny.ISequence _1311_thnDafny = _source58.dtor_thn; - Dafny.ISequence _1312_elsDafny = _source58.dtor_els; - unmatched58 = false; + RAST._IType _1292_tpe; + RAST._IType _out107; + _out107 = (this).GenType(_1290_typ, true, false); + _1292_tpe = _out107; + RAST._IExpr _1293_expr; + DCOMP._IOwnership _1294_exprOwnership; + Dafny.ISet> _1295_recIdents; + RAST._IExpr _out108; + DCOMP._IOwnership _out109; + Dafny.ISet> _out110; + (this).GenExpr(_1291_expression, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out108, out _out109, out _out110); + _1293_expr = _out108; + _1294_exprOwnership = _out109; + _1295_recIdents = _out110; + readIdents = _1295_recIdents; + generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), DCOMP.__default.escapeName(_1289_name), Std.Wrappers.Option.create_Some(_1292_tpe), Std.Wrappers.Option.create_Some(_1293_expr)); + newEnv = (env).AddAssigned(DCOMP.__default.escapeName(_1289_name), _1292_tpe); + } + goto after_match15; + } + } + if (_source58.is_DeclareVar) { + Dafny.ISequence _1296_name = _source58.dtor_name; + DAST._IType _1297_typ = _source58.dtor_typ; + Std.Wrappers._IOption maybeValue1 = _source58.dtor_maybeValue; + if (maybeValue1.is_None) { { - RAST._IExpr _1313_cond; - DCOMP._IOwnership _1314___v62; - Dafny.ISet> _1315_recIdents; - RAST._IExpr _out121; - DCOMP._IOwnership _out122; - Dafny.ISet> _out123; - (this).GenExpr(_1310_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out121, out _out122, out _out123); - _1313_cond = _out121; - _1314___v62 = _out122; - _1315_recIdents = _out123; - Dafny.ISequence _1316_condString; - _1316_condString = (_1313_cond)._ToString(DCOMP.__default.IND); - readIdents = _1315_recIdents; - RAST._IExpr _1317_thn; - Dafny.ISet> _1318_thnIdents; - DCOMP._IEnvironment _1319_thnEnv; - RAST._IExpr _out124; - Dafny.ISet> _out125; - DCOMP._IEnvironment _out126; - (this).GenStmts(_1311_thnDafny, selfIdent, env, isLast, earlyReturn, out _out124, out _out125, out _out126); - _1317_thn = _out124; - _1318_thnIdents = _out125; - _1319_thnEnv = _out126; - readIdents = Dafny.Set>.Union(readIdents, _1318_thnIdents); - RAST._IExpr _1320_els; - Dafny.ISet> _1321_elsIdents; - DCOMP._IEnvironment _1322_elsEnv; - RAST._IExpr _out127; - Dafny.ISet> _out128; - DCOMP._IEnvironment _out129; - (this).GenStmts(_1312_elsDafny, selfIdent, env, isLast, earlyReturn, out _out127, out _out128, out _out129); - _1320_els = _out127; - _1321_elsIdents = _out128; - _1322_elsEnv = _out129; - readIdents = Dafny.Set>.Union(readIdents, _1321_elsIdents); - newEnv = env; - generated = RAST.Expr.create_IfExpr(_1313_cond, _1317_thn, _1320_els); - } + DAST._IStatement _1298_newStmt; + _1298_newStmt = DAST.Statement.create_DeclareVar(_1296_name, _1297_typ, Std.Wrappers.Option.create_Some(DAST.Expression.create_InitializationValue(_1297_typ))); + RAST._IExpr _out111; + Dafny.ISet> _out112; + DCOMP._IEnvironment _out113; + (this).GenStmt(_1298_newStmt, selfIdent, env, isLast, earlyReturn, out _out111, out _out112, out _out113); + generated = _out111; + readIdents = _out112; + newEnv = _out113; + } + goto after_match15; + } + } + if (_source58.is_Assign) { + DAST._IAssignLhs _1299_lhs = _source58.dtor_lhs; + DAST._IExpression _1300_expression = _source58.dtor_value; + { + RAST._IExpr _1301_exprGen; + DCOMP._IOwnership _1302___v61; + Dafny.ISet> _1303_exprIdents; + RAST._IExpr _out114; + DCOMP._IOwnership _out115; + Dafny.ISet> _out116; + (this).GenExpr(_1300_expression, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out114, out _out115, out _out116); + _1301_exprGen = _out114; + _1302___v61 = _out115; + _1303_exprIdents = _out116; + if ((_1299_lhs).is_Ident) { + Dafny.ISequence _1304_rustId; + _1304_rustId = DCOMP.__default.escapeName(((_1299_lhs).dtor_ident)); + Std.Wrappers._IOption _1305_tpe; + _1305_tpe = (env).GetType(_1304_rustId); + } + RAST._IExpr _1306_lhsGen; + bool _1307_needsIIFE; + Dafny.ISet> _1308_recIdents; + DCOMP._IEnvironment _1309_resEnv; + RAST._IExpr _out117; + bool _out118; + Dafny.ISet> _out119; + DCOMP._IEnvironment _out120; + (this).GenAssignLhs(_1299_lhs, _1301_exprGen, selfIdent, env, out _out117, out _out118, out _out119, out _out120); + _1306_lhsGen = _out117; + _1307_needsIIFE = _out118; + _1308_recIdents = _out119; + _1309_resEnv = _out120; + generated = _1306_lhsGen; + newEnv = _1309_resEnv; + if (_1307_needsIIFE) { + generated = RAST.Expr.create_Block(generated); + } + readIdents = Dafny.Set>.Union(_1308_recIdents, _1303_exprIdents); + } + goto after_match15; + } + if (_source58.is_If) { + DAST._IExpression _1310_cond = _source58.dtor_cond; + Dafny.ISequence _1311_thnDafny = _source58.dtor_thn; + Dafny.ISequence _1312_elsDafny = _source58.dtor_els; + { + RAST._IExpr _1313_cond; + DCOMP._IOwnership _1314___v62; + Dafny.ISet> _1315_recIdents; + RAST._IExpr _out121; + DCOMP._IOwnership _out122; + Dafny.ISet> _out123; + (this).GenExpr(_1310_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out121, out _out122, out _out123); + _1313_cond = _out121; + _1314___v62 = _out122; + _1315_recIdents = _out123; + Dafny.ISequence _1316_condString; + _1316_condString = (_1313_cond)._ToString(DCOMP.__default.IND); + readIdents = _1315_recIdents; + RAST._IExpr _1317_thn; + Dafny.ISet> _1318_thnIdents; + DCOMP._IEnvironment _1319_thnEnv; + RAST._IExpr _out124; + Dafny.ISet> _out125; + DCOMP._IEnvironment _out126; + (this).GenStmts(_1311_thnDafny, selfIdent, env, isLast, earlyReturn, out _out124, out _out125, out _out126); + _1317_thn = _out124; + _1318_thnIdents = _out125; + _1319_thnEnv = _out126; + readIdents = Dafny.Set>.Union(readIdents, _1318_thnIdents); + RAST._IExpr _1320_els; + Dafny.ISet> _1321_elsIdents; + DCOMP._IEnvironment _1322_elsEnv; + RAST._IExpr _out127; + Dafny.ISet> _out128; + DCOMP._IEnvironment _out129; + (this).GenStmts(_1312_elsDafny, selfIdent, env, isLast, earlyReturn, out _out127, out _out128, out _out129); + _1320_els = _out127; + _1321_elsIdents = _out128; + _1322_elsEnv = _out129; + readIdents = Dafny.Set>.Union(readIdents, _1321_elsIdents); + newEnv = env; + generated = RAST.Expr.create_IfExpr(_1313_cond, _1317_thn, _1320_els); } + goto after_match15; } - if (unmatched58) { - if (_source58.is_Labeled) { - Dafny.ISequence _1323_lbl = _source58.dtor_lbl; - Dafny.ISequence _1324_body = _source58.dtor_body; - unmatched58 = false; - { - RAST._IExpr _1325_body; - Dafny.ISet> _1326_bodyIdents; - DCOMP._IEnvironment _1327_env2; - RAST._IExpr _out130; - Dafny.ISet> _out131; - DCOMP._IEnvironment _out132; - (this).GenStmts(_1324_body, selfIdent, env, isLast, earlyReturn, out _out130, out _out131, out _out132); - _1325_body = _out130; - _1326_bodyIdents = _out131; - _1327_env2 = _out132; - readIdents = _1326_bodyIdents; - generated = RAST.Expr.create_Labelled(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1323_lbl), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), RAST.Expr.create_StmtExpr(_1325_body, RAST.Expr.create_Break(Std.Wrappers.Option>.create_None())))); - newEnv = env; - } + if (_source58.is_Labeled) { + Dafny.ISequence _1323_lbl = _source58.dtor_lbl; + Dafny.ISequence _1324_body = _source58.dtor_body; + { + RAST._IExpr _1325_body; + Dafny.ISet> _1326_bodyIdents; + DCOMP._IEnvironment _1327_env2; + RAST._IExpr _out130; + Dafny.ISet> _out131; + DCOMP._IEnvironment _out132; + (this).GenStmts(_1324_body, selfIdent, env, isLast, earlyReturn, out _out130, out _out131, out _out132); + _1325_body = _out130; + _1326_bodyIdents = _out131; + _1327_env2 = _out132; + readIdents = _1326_bodyIdents; + generated = RAST.Expr.create_Labelled(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1323_lbl), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), RAST.Expr.create_StmtExpr(_1325_body, RAST.Expr.create_Break(Std.Wrappers.Option>.create_None())))); + newEnv = env; } + goto after_match15; } - if (unmatched58) { - if (_source58.is_While) { - DAST._IExpression _1328_cond = _source58.dtor_cond; - Dafny.ISequence _1329_body = _source58.dtor_body; - unmatched58 = false; - { - RAST._IExpr _1330_cond; - DCOMP._IOwnership _1331___v63; - Dafny.ISet> _1332_recIdents; - RAST._IExpr _out133; - DCOMP._IOwnership _out134; - Dafny.ISet> _out135; - (this).GenExpr(_1328_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out133, out _out134, out _out135); - _1330_cond = _out133; - _1331___v63 = _out134; - _1332_recIdents = _out135; - readIdents = _1332_recIdents; - RAST._IExpr _1333_bodyExpr; - Dafny.ISet> _1334_bodyIdents; - DCOMP._IEnvironment _1335_bodyEnv; - RAST._IExpr _out136; - Dafny.ISet> _out137; - DCOMP._IEnvironment _out138; - (this).GenStmts(_1329_body, selfIdent, env, false, earlyReturn, out _out136, out _out137, out _out138); - _1333_bodyExpr = _out136; - _1334_bodyIdents = _out137; - _1335_bodyEnv = _out138; - newEnv = env; - readIdents = Dafny.Set>.Union(readIdents, _1334_bodyIdents); - generated = RAST.Expr.create_Loop(Std.Wrappers.Option.create_Some(_1330_cond), _1333_bodyExpr); - } + if (_source58.is_While) { + DAST._IExpression _1328_cond = _source58.dtor_cond; + Dafny.ISequence _1329_body = _source58.dtor_body; + { + RAST._IExpr _1330_cond; + DCOMP._IOwnership _1331___v63; + Dafny.ISet> _1332_recIdents; + RAST._IExpr _out133; + DCOMP._IOwnership _out134; + Dafny.ISet> _out135; + (this).GenExpr(_1328_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out133, out _out134, out _out135); + _1330_cond = _out133; + _1331___v63 = _out134; + _1332_recIdents = _out135; + readIdents = _1332_recIdents; + RAST._IExpr _1333_bodyExpr; + Dafny.ISet> _1334_bodyIdents; + DCOMP._IEnvironment _1335_bodyEnv; + RAST._IExpr _out136; + Dafny.ISet> _out137; + DCOMP._IEnvironment _out138; + (this).GenStmts(_1329_body, selfIdent, env, false, earlyReturn, out _out136, out _out137, out _out138); + _1333_bodyExpr = _out136; + _1334_bodyIdents = _out137; + _1335_bodyEnv = _out138; + newEnv = env; + readIdents = Dafny.Set>.Union(readIdents, _1334_bodyIdents); + generated = RAST.Expr.create_Loop(Std.Wrappers.Option.create_Some(_1330_cond), _1333_bodyExpr); } + goto after_match15; } - if (unmatched58) { - if (_source58.is_Foreach) { - Dafny.ISequence _1336_boundName = _source58.dtor_boundName; - DAST._IType _1337_boundType = _source58.dtor_boundType; - DAST._IExpression _1338_over = _source58.dtor_over; - Dafny.ISequence _1339_body = _source58.dtor_body; - unmatched58 = false; - { - RAST._IExpr _1340_over; - DCOMP._IOwnership _1341___v64; - Dafny.ISet> _1342_recIdents; - RAST._IExpr _out139; - DCOMP._IOwnership _out140; - Dafny.ISet> _out141; - (this).GenExpr(_1338_over, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out139, out _out140, out _out141); - _1340_over = _out139; - _1341___v64 = _out140; - _1342_recIdents = _out141; - RAST._IType _1343_boundTpe; - RAST._IType _out142; - _out142 = (this).GenType(_1337_boundType, false, false); - _1343_boundTpe = _out142; - readIdents = _1342_recIdents; - Dafny.ISequence _1344_boundRName; - _1344_boundRName = DCOMP.__default.escapeName(_1336_boundName); - RAST._IExpr _1345_bodyExpr; - Dafny.ISet> _1346_bodyIdents; - DCOMP._IEnvironment _1347_bodyEnv; - RAST._IExpr _out143; - Dafny.ISet> _out144; - DCOMP._IEnvironment _out145; - (this).GenStmts(_1339_body, selfIdent, (env).AddAssigned(_1344_boundRName, _1343_boundTpe), false, earlyReturn, out _out143, out _out144, out _out145); - _1345_bodyExpr = _out143; - _1346_bodyIdents = _out144; - _1347_bodyEnv = _out145; - readIdents = Dafny.Set>.Difference(Dafny.Set>.Union(readIdents, _1346_bodyIdents), Dafny.Set>.FromElements(_1344_boundRName)); - newEnv = env; - generated = RAST.Expr.create_For(_1344_boundRName, _1340_over, _1345_bodyExpr); - } + if (_source58.is_Foreach) { + Dafny.ISequence _1336_boundName = _source58.dtor_boundName; + DAST._IType _1337_boundType = _source58.dtor_boundType; + DAST._IExpression _1338_over = _source58.dtor_over; + Dafny.ISequence _1339_body = _source58.dtor_body; + { + RAST._IExpr _1340_over; + DCOMP._IOwnership _1341___v64; + Dafny.ISet> _1342_recIdents; + RAST._IExpr _out139; + DCOMP._IOwnership _out140; + Dafny.ISet> _out141; + (this).GenExpr(_1338_over, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out139, out _out140, out _out141); + _1340_over = _out139; + _1341___v64 = _out140; + _1342_recIdents = _out141; + RAST._IType _1343_boundTpe; + RAST._IType _out142; + _out142 = (this).GenType(_1337_boundType, false, false); + _1343_boundTpe = _out142; + readIdents = _1342_recIdents; + Dafny.ISequence _1344_boundRName; + _1344_boundRName = DCOMP.__default.escapeName(_1336_boundName); + RAST._IExpr _1345_bodyExpr; + Dafny.ISet> _1346_bodyIdents; + DCOMP._IEnvironment _1347_bodyEnv; + RAST._IExpr _out143; + Dafny.ISet> _out144; + DCOMP._IEnvironment _out145; + (this).GenStmts(_1339_body, selfIdent, (env).AddAssigned(_1344_boundRName, _1343_boundTpe), false, earlyReturn, out _out143, out _out144, out _out145); + _1345_bodyExpr = _out143; + _1346_bodyIdents = _out144; + _1347_bodyEnv = _out145; + readIdents = Dafny.Set>.Difference(Dafny.Set>.Union(readIdents, _1346_bodyIdents), Dafny.Set>.FromElements(_1344_boundRName)); + newEnv = env; + generated = RAST.Expr.create_For(_1344_boundRName, _1340_over, _1345_bodyExpr); } + goto after_match15; } - if (unmatched58) { - if (_source58.is_Break) { - Std.Wrappers._IOption> _1348_toLabel = _source58.dtor_toLabel; - unmatched58 = false; - { - Std.Wrappers._IOption> _source59 = _1348_toLabel; - bool unmatched59 = true; - if (unmatched59) { - if (_source59.is_Some) { - Dafny.ISequence _1349_lbl = _source59.dtor_value; - unmatched59 = false; - { - generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_Some(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1349_lbl))); - } - } - } - if (unmatched59) { - unmatched59 = false; - { - generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_None()); - } + if (_source58.is_Break) { + Std.Wrappers._IOption> _1348_toLabel = _source58.dtor_toLabel; + { + Std.Wrappers._IOption> _source59 = _1348_toLabel; + if (_source59.is_Some) { + Dafny.ISequence _1349_lbl = _source59.dtor_value; + { + generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_Some(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1349_lbl))); } - readIdents = Dafny.Set>.FromElements(); - newEnv = env; + goto after_match16; } - } - } - if (unmatched58) { - if (_source58.is_TailRecursive) { - Dafny.ISequence _1350_body = _source58.dtor_body; - unmatched58 = false; { - generated = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); - if (!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) { - generated = (generated).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), Dafny.Sequence.UnicodeFromString("_this"), Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.__default.self).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); - } - newEnv = env; - BigInteger _hi27 = new BigInteger(((env).dtor_names).Count); - for (BigInteger _1351_paramI = BigInteger.Zero; _1351_paramI < _hi27; _1351_paramI++) { - Dafny.ISequence _1352_param; - _1352_param = ((env).dtor_names).Select(_1351_paramI); - RAST._IExpr _1353_paramInit; - DCOMP._IOwnership _1354___v65; - Dafny.ISet> _1355___v66; - RAST._IExpr _out146; - DCOMP._IOwnership _out147; - Dafny.ISet> _out148; - (this).GenIdent(_1352_param, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out146, out _out147, out _out148); - _1353_paramInit = _out146; - _1354___v65 = _out147; - _1355___v66 = _out148; - generated = (generated).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), _1352_param, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(_1353_paramInit))); - if (((env).dtor_types).Contains(_1352_param)) { - RAST._IType _1356_declaredType; - _1356_declaredType = (Dafny.Map, RAST._IType>.Select((env).dtor_types,_1352_param)).ToOwned(); - newEnv = (newEnv).AddAssigned(_1352_param, _1356_declaredType); - } - } - RAST._IExpr _1357_bodyExpr; - Dafny.ISet> _1358_bodyIdents; - DCOMP._IEnvironment _1359_bodyEnv; - RAST._IExpr _out149; - Dafny.ISet> _out150; - DCOMP._IEnvironment _out151; - (this).GenStmts(_1350_body, ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) ? (Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("_this"))) : (Std.Wrappers.Option>.create_None())), newEnv, false, earlyReturn, out _out149, out _out150, out _out151); - _1357_bodyExpr = _out149; - _1358_bodyIdents = _out150; - _1359_bodyEnv = _out151; - readIdents = _1358_bodyIdents; - generated = (generated).Then(RAST.Expr.create_Labelled(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), _1357_bodyExpr))); + generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_None()); } + after_match16: ; + readIdents = Dafny.Set>.FromElements(); + newEnv = env; } + goto after_match15; } - if (unmatched58) { - if (_source58.is_JumpTailCallStart) { - unmatched58 = false; - { - generated = RAST.Expr.create_Continue(Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"))); - readIdents = Dafny.Set>.FromElements(); - newEnv = env; + if (_source58.is_TailRecursive) { + Dafny.ISequence _1350_body = _source58.dtor_body; + { + generated = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); + if (!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) { + generated = (generated).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), Dafny.Sequence.UnicodeFromString("_this"), Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.__default.self).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); + } + newEnv = env; + BigInteger _hi27 = new BigInteger(((env).dtor_names).Count); + for (BigInteger _1351_paramI = BigInteger.Zero; _1351_paramI < _hi27; _1351_paramI++) { + Dafny.ISequence _1352_param; + _1352_param = ((env).dtor_names).Select(_1351_paramI); + RAST._IExpr _1353_paramInit; + DCOMP._IOwnership _1354___v65; + Dafny.ISet> _1355___v66; + RAST._IExpr _out146; + DCOMP._IOwnership _out147; + Dafny.ISet> _out148; + (this).GenIdent(_1352_param, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out146, out _out147, out _out148); + _1353_paramInit = _out146; + _1354___v65 = _out147; + _1355___v66 = _out148; + generated = (generated).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), _1352_param, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(_1353_paramInit))); + if (((env).dtor_types).Contains(_1352_param)) { + RAST._IType _1356_declaredType; + _1356_declaredType = (Dafny.Map, RAST._IType>.Select((env).dtor_types,_1352_param)).ToOwned(); + newEnv = (newEnv).AddAssigned(_1352_param, _1356_declaredType); + } } + RAST._IExpr _1357_bodyExpr; + Dafny.ISet> _1358_bodyIdents; + DCOMP._IEnvironment _1359_bodyEnv; + RAST._IExpr _out149; + Dafny.ISet> _out150; + DCOMP._IEnvironment _out151; + (this).GenStmts(_1350_body, ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) ? (Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("_this"))) : (Std.Wrappers.Option>.create_None())), newEnv, false, earlyReturn, out _out149, out _out150, out _out151); + _1357_bodyExpr = _out149; + _1358_bodyIdents = _out150; + _1359_bodyEnv = _out151; + readIdents = _1358_bodyIdents; + generated = (generated).Then(RAST.Expr.create_Labelled(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), _1357_bodyExpr))); + } + goto after_match15; + } + if (_source58.is_JumpTailCallStart) { + { + generated = RAST.Expr.create_Continue(Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"))); + readIdents = Dafny.Set>.FromElements(); + newEnv = env; } + goto after_match15; } - if (unmatched58) { - if (_source58.is_Call) { - DAST._IExpression _1360_on = _source58.dtor_on; - DAST._ICallName _1361_name = _source58.dtor_callName; - Dafny.ISequence _1362_typeArgs = _source58.dtor_typeArgs; - Dafny.ISequence _1363_args = _source58.dtor_args; - Std.Wrappers._IOption>> _1364_maybeOutVars = _source58.dtor_outs; - unmatched58 = false; - { - readIdents = Dafny.Set>.FromElements(); - RAST._IExpr _1365_onExpr; - DCOMP._IOwnership _1366___v67; - Dafny.ISet> _1367_enclosingIdents; - RAST._IExpr _out152; - DCOMP._IOwnership _out153; - Dafny.ISet> _out154; - (this).GenExpr(_1360_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out152, out _out153, out _out154); - _1365_onExpr = _out152; - _1366___v67 = _out153; - _1367_enclosingIdents = _out154; - Dafny.ISequence _1368_typeArgsR; - _1368_typeArgsR = Dafny.Sequence.FromElements(); - if ((new BigInteger((_1362_typeArgs).Count)) >= (BigInteger.One)) { - BigInteger _1369_typeI; - _1369_typeI = BigInteger.Zero; - while ((_1369_typeI) < (new BigInteger((_1362_typeArgs).Count))) { - RAST._IType _1370_tpe; - RAST._IType _out155; - _out155 = (this).GenType((_1362_typeArgs).Select(_1369_typeI), false, false); - _1370_tpe = _out155; - _1368_typeArgsR = Dafny.Sequence.Concat(_1368_typeArgsR, Dafny.Sequence.FromElements(_1370_tpe)); - _1369_typeI = (_1369_typeI) + (BigInteger.One); - } - } - Dafny.ISequence _1371_argExprs; - _1371_argExprs = Dafny.Sequence.FromElements(); - BigInteger _hi28 = new BigInteger((_1363_args).Count); - for (BigInteger _1372_i = BigInteger.Zero; _1372_i < _hi28; _1372_i++) { - DCOMP._IOwnership _1373_argOwnership; - _1373_argOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); - if (((_1361_name).is_CallName) && ((_1372_i) < (new BigInteger((((_1361_name).dtor_signature)).Count)))) { - RAST._IType _1374_tpe; - RAST._IType _out156; - _out156 = (this).GenType(((((_1361_name).dtor_signature)).Select(_1372_i)).dtor_typ, false, false); - _1374_tpe = _out156; - if ((_1374_tpe).CanReadWithoutClone()) { - _1373_argOwnership = DCOMP.Ownership.create_OwnershipOwned(); - } - } - RAST._IExpr _1375_argExpr; - DCOMP._IOwnership _1376_ownership; - Dafny.ISet> _1377_argIdents; - RAST._IExpr _out157; - DCOMP._IOwnership _out158; - Dafny.ISet> _out159; - (this).GenExpr((_1363_args).Select(_1372_i), selfIdent, env, _1373_argOwnership, out _out157, out _out158, out _out159); - _1375_argExpr = _out157; - _1376_ownership = _out158; - _1377_argIdents = _out159; - _1371_argExprs = Dafny.Sequence.Concat(_1371_argExprs, Dafny.Sequence.FromElements(_1375_argExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1377_argIdents); - } - readIdents = Dafny.Set>.Union(readIdents, _1367_enclosingIdents); - Dafny.ISequence _1378_renderedName; - _1378_renderedName = ((System.Func>)(() => { - DAST._ICallName _source60 = _1361_name; - bool unmatched60 = true; - if (unmatched60) { - if (_source60.is_CallName) { - Dafny.ISequence _1379_name = _source60.dtor_name; - unmatched60 = false; - return DCOMP.__default.escapeName(_1379_name); - } - } - if (unmatched60) { - bool disjunctiveMatch9 = false; - if (_source60.is_MapBuilderAdd) { - disjunctiveMatch9 = true; - } - if (_source60.is_SetBuilderAdd) { - disjunctiveMatch9 = true; - } - if (disjunctiveMatch9) { - unmatched60 = false; - return Dafny.Sequence.UnicodeFromString("add"); - } - } - if (unmatched60) { - bool disjunctiveMatch10 = false; - disjunctiveMatch10 = true; - disjunctiveMatch10 = true; - if (disjunctiveMatch10) { - unmatched60 = false; - return Dafny.Sequence.UnicodeFromString("build"); - } - } - throw new System.Exception("unexpected control point"); - }))(); - DAST._IExpression _source61 = _1360_on; - bool unmatched61 = true; - if (unmatched61) { - if (_source61.is_Companion) { - unmatched61 = false; - { - _1365_onExpr = (_1365_onExpr).MSel(_1378_renderedName); - } - } + if (_source58.is_Call) { + DAST._IExpression _1360_on = _source58.dtor_on; + DAST._ICallName _1361_name = _source58.dtor_callName; + Dafny.ISequence _1362_typeArgs = _source58.dtor_typeArgs; + Dafny.ISequence _1363_args = _source58.dtor_args; + Std.Wrappers._IOption>> _1364_maybeOutVars = _source58.dtor_outs; + { + readIdents = Dafny.Set>.FromElements(); + RAST._IExpr _1365_onExpr; + DCOMP._IOwnership _1366___v67; + Dafny.ISet> _1367_enclosingIdents; + RAST._IExpr _out152; + DCOMP._IOwnership _out153; + Dafny.ISet> _out154; + (this).GenExpr(_1360_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out152, out _out153, out _out154); + _1365_onExpr = _out152; + _1366___v67 = _out153; + _1367_enclosingIdents = _out154; + Dafny.ISequence _1368_typeArgsR; + _1368_typeArgsR = Dafny.Sequence.FromElements(); + if ((new BigInteger((_1362_typeArgs).Count)) >= (BigInteger.One)) { + BigInteger _1369_typeI; + _1369_typeI = BigInteger.Zero; + while ((_1369_typeI) < (new BigInteger((_1362_typeArgs).Count))) { + RAST._IType _1370_tpe; + RAST._IType _out155; + _out155 = (this).GenType((_1362_typeArgs).Select(_1369_typeI), false, false); + _1370_tpe = _out155; + _1368_typeArgsR = Dafny.Sequence.Concat(_1368_typeArgsR, Dafny.Sequence.FromElements(_1370_tpe)); + _1369_typeI = (_1369_typeI) + (BigInteger.One); } - if (unmatched61) { - unmatched61 = false; - { - _1365_onExpr = (_1365_onExpr).Sel(_1378_renderedName); + } + Dafny.ISequence _1371_argExprs; + _1371_argExprs = Dafny.Sequence.FromElements(); + BigInteger _hi28 = new BigInteger((_1363_args).Count); + for (BigInteger _1372_i = BigInteger.Zero; _1372_i < _hi28; _1372_i++) { + DCOMP._IOwnership _1373_argOwnership; + _1373_argOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + if (((_1361_name).is_CallName) && ((_1372_i) < (new BigInteger((((_1361_name).dtor_signature)).Count)))) { + RAST._IType _1374_tpe; + RAST._IType _out156; + _out156 = (this).GenType(((((_1361_name).dtor_signature)).Select(_1372_i)).dtor_typ, false, false); + _1374_tpe = _out156; + if ((_1374_tpe).CanReadWithoutClone()) { + _1373_argOwnership = DCOMP.Ownership.create_OwnershipOwned(); } } - generated = _1365_onExpr; - if ((new BigInteger((_1368_typeArgsR).Count)).Sign == 1) { - generated = (generated).ApplyType(_1368_typeArgsR); - } - generated = (generated).Apply(_1371_argExprs); - if (((_1364_maybeOutVars).is_Some) && ((new BigInteger(((_1364_maybeOutVars).dtor_value).Count)) == (BigInteger.One))) { - Dafny.ISequence _1380_outVar; - _1380_outVar = DCOMP.__default.escapeName((((_1364_maybeOutVars).dtor_value).Select(BigInteger.Zero))); - generated = RAST.__default.AssignVar(_1380_outVar, generated); - } else if (((_1364_maybeOutVars).is_None) || ((new BigInteger(((_1364_maybeOutVars).dtor_value).Count)).Sign == 0)) { - } else { - Dafny.ISequence _1381_tmpVar; - _1381_tmpVar = Dafny.Sequence.UnicodeFromString("_x"); - RAST._IExpr _1382_tmpId; - _1382_tmpId = RAST.Expr.create_Identifier(_1381_tmpVar); - generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), _1381_tmpVar, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(generated)); - Dafny.ISequence> _1383_outVars; - _1383_outVars = (_1364_maybeOutVars).dtor_value; - BigInteger _hi29 = new BigInteger((_1383_outVars).Count); - for (BigInteger _1384_outI = BigInteger.Zero; _1384_outI < _hi29; _1384_outI++) { - Dafny.ISequence _1385_outVar; - _1385_outVar = DCOMP.__default.escapeName(((_1383_outVars).Select(_1384_outI))); - RAST._IExpr _1386_rhs; - _1386_rhs = (_1382_tmpId).Sel(Std.Strings.__default.OfNat(_1384_outI)); - generated = (generated).Then(RAST.__default.AssignVar(_1385_outVar, _1386_rhs)); - } + RAST._IExpr _1375_argExpr; + DCOMP._IOwnership _1376_ownership; + Dafny.ISet> _1377_argIdents; + RAST._IExpr _out157; + DCOMP._IOwnership _out158; + Dafny.ISet> _out159; + (this).GenExpr((_1363_args).Select(_1372_i), selfIdent, env, _1373_argOwnership, out _out157, out _out158, out _out159); + _1375_argExpr = _out157; + _1376_ownership = _out158; + _1377_argIdents = _out159; + _1371_argExprs = Dafny.Sequence.Concat(_1371_argExprs, Dafny.Sequence.FromElements(_1375_argExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1377_argIdents); + } + readIdents = Dafny.Set>.Union(readIdents, _1367_enclosingIdents); + Dafny.ISequence _1378_renderedName; + DAST._ICallName _source60 = _1361_name; + if (_source60.is_CallName) { + Dafny.ISequence _1379_name = _source60.dtor_name; + _1378_renderedName = DCOMP.__default.escapeName(_1379_name); + goto after_match17; + } + bool disjunctiveMatch9 = false; + if (_source60.is_MapBuilderAdd) { + disjunctiveMatch9 = true; + } + if (_source60.is_SetBuilderAdd) { + disjunctiveMatch9 = true; + } + if (disjunctiveMatch9) { + _1378_renderedName = Dafny.Sequence.UnicodeFromString("add"); + goto after_match17; + } + _1378_renderedName = Dafny.Sequence.UnicodeFromString("build"); + after_match17: ; + DAST._IExpression _source61 = _1360_on; + if (_source61.is_Companion) { + { + _1365_onExpr = (_1365_onExpr).MSel(_1378_renderedName); } - newEnv = env; + goto after_match18; } - } - } - if (unmatched58) { - if (_source58.is_Return) { - DAST._IExpression _1387_exprDafny = _source58.dtor_expr; - unmatched58 = false; { - RAST._IExpr _1388_expr; - DCOMP._IOwnership _1389___v72; - Dafny.ISet> _1390_recIdents; - RAST._IExpr _out160; - DCOMP._IOwnership _out161; - Dafny.ISet> _out162; - (this).GenExpr(_1387_exprDafny, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out160, out _out161, out _out162); - _1388_expr = _out160; - _1389___v72 = _out161; - _1390_recIdents = _out162; - readIdents = _1390_recIdents; - if (isLast) { - generated = _1388_expr; - } else { - generated = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(_1388_expr)); + _1365_onExpr = (_1365_onExpr).Sel(_1378_renderedName); + } + after_match18: ; + generated = _1365_onExpr; + if ((new BigInteger((_1368_typeArgsR).Count)).Sign == 1) { + generated = (generated).ApplyType(_1368_typeArgsR); + } + generated = (generated).Apply(_1371_argExprs); + if (((_1364_maybeOutVars).is_Some) && ((new BigInteger(((_1364_maybeOutVars).dtor_value).Count)) == (BigInteger.One))) { + Dafny.ISequence _1380_outVar; + _1380_outVar = DCOMP.__default.escapeName((((_1364_maybeOutVars).dtor_value).Select(BigInteger.Zero))); + generated = RAST.__default.AssignVar(_1380_outVar, generated); + } else if (((_1364_maybeOutVars).is_None) || ((new BigInteger(((_1364_maybeOutVars).dtor_value).Count)).Sign == 0)) { + } else { + Dafny.ISequence _1381_tmpVar; + _1381_tmpVar = Dafny.Sequence.UnicodeFromString("_x"); + RAST._IExpr _1382_tmpId; + _1382_tmpId = RAST.Expr.create_Identifier(_1381_tmpVar); + generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), _1381_tmpVar, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(generated)); + Dafny.ISequence> _1383_outVars; + _1383_outVars = (_1364_maybeOutVars).dtor_value; + BigInteger _hi29 = new BigInteger((_1383_outVars).Count); + for (BigInteger _1384_outI = BigInteger.Zero; _1384_outI < _hi29; _1384_outI++) { + Dafny.ISequence _1385_outVar; + _1385_outVar = DCOMP.__default.escapeName(((_1383_outVars).Select(_1384_outI))); + RAST._IExpr _1386_rhs; + _1386_rhs = (_1382_tmpId).Sel(Std.Strings.__default.OfNat(_1384_outI)); + generated = (generated).Then(RAST.__default.AssignVar(_1385_outVar, _1386_rhs)); } - newEnv = env; } + newEnv = env; } + goto after_match15; } - if (unmatched58) { - if (_source58.is_EarlyReturn) { - unmatched58 = false; - { - generated = earlyReturn; - readIdents = Dafny.Set>.FromElements(); - newEnv = env; + if (_source58.is_Return) { + DAST._IExpression _1387_exprDafny = _source58.dtor_expr; + { + RAST._IExpr _1388_expr; + DCOMP._IOwnership _1389___v72; + Dafny.ISet> _1390_recIdents; + RAST._IExpr _out160; + DCOMP._IOwnership _out161; + Dafny.ISet> _out162; + (this).GenExpr(_1387_exprDafny, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out160, out _out161, out _out162); + _1388_expr = _out160; + _1389___v72 = _out161; + _1390_recIdents = _out162; + readIdents = _1390_recIdents; + if (isLast) { + generated = _1388_expr; + } else { + generated = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(_1388_expr)); } + newEnv = env; } + goto after_match15; } - if (unmatched58) { - if (_source58.is_Halt) { - unmatched58 = false; - { - generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("panic!"))).Apply1(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("Halt"), false, false)); - readIdents = Dafny.Set>.FromElements(); - newEnv = env; - } + if (_source58.is_EarlyReturn) { + { + generated = earlyReturn; + readIdents = Dafny.Set>.FromElements(); + newEnv = env; } + goto after_match15; } - if (unmatched58) { - DAST._IExpression _1391_e = _source58.dtor_Print_a0; - unmatched58 = false; + if (_source58.is_Halt) { { - RAST._IExpr _1392_printedExpr; - DCOMP._IOwnership _1393_recOwnership; - Dafny.ISet> _1394_recIdents; - RAST._IExpr _out163; - DCOMP._IOwnership _out164; - Dafny.ISet> _out165; - (this).GenExpr(_1391_e, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out163, out _out164, out _out165); - _1392_printedExpr = _out163; - _1393_recOwnership = _out164; - _1394_recIdents = _out165; - generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("print!"))).Apply(Dafny.Sequence.FromElements(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("{}"), false, false), ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("DafnyPrintWrapper"))).Apply1(_1392_printedExpr))); - readIdents = _1394_recIdents; + generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("panic!"))).Apply1(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("Halt"), false, false)); + readIdents = Dafny.Set>.FromElements(); newEnv = env; } - } + goto after_match15; + } + DAST._IExpression _1391_e = _source58.dtor_Print_a0; + { + RAST._IExpr _1392_printedExpr; + DCOMP._IOwnership _1393_recOwnership; + Dafny.ISet> _1394_recIdents; + RAST._IExpr _out163; + DCOMP._IOwnership _out164; + Dafny.ISet> _out165; + (this).GenExpr(_1391_e, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out163, out _out164, out _out165); + _1392_printedExpr = _out163; + _1393_recOwnership = _out164; + _1394_recIdents = _out165; + generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("print!"))).Apply(Dafny.Sequence.FromElements(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("{}"), false, false), ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("DafnyPrintWrapper"))).Apply1(_1392_printedExpr))); + readIdents = _1394_recIdents; + newEnv = env; + } + after_match15: ; } public static Std.Wrappers._IOption NewtypeToRustType(DAST._IType @base, DAST._INewtypeRange range) { DAST._INewtypeRange _source62 = range; - bool unmatched62 = true; - if (unmatched62) { - if (_source62.is_NoRange) { - unmatched62 = false; - return Std.Wrappers.Option.create_None(); - } + if (_source62.is_NoRange) { + return Std.Wrappers.Option.create_None(); } - if (unmatched62) { - if (_source62.is_U8) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_U8()); - } + if (_source62.is_U8) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U8()); } - if (unmatched62) { - if (_source62.is_U16) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_U16()); - } + if (_source62.is_U16) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U16()); } - if (unmatched62) { - if (_source62.is_U32) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_U32()); - } + if (_source62.is_U32) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U32()); } - if (unmatched62) { - if (_source62.is_U64) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_U64()); - } + if (_source62.is_U64) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U64()); } - if (unmatched62) { - if (_source62.is_U128) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_U128()); - } + if (_source62.is_U128) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U128()); } - if (unmatched62) { - if (_source62.is_I8) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_I8()); - } + if (_source62.is_I8) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I8()); } - if (unmatched62) { - if (_source62.is_I16) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_I16()); - } + if (_source62.is_I16) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I16()); } - if (unmatched62) { - if (_source62.is_I32) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_I32()); - } + if (_source62.is_I32) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I32()); } - if (unmatched62) { - if (_source62.is_I64) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_I64()); - } + if (_source62.is_I64) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I64()); } - if (unmatched62) { - if (_source62.is_I128) { - unmatched62 = false; - return Std.Wrappers.Option.create_Some(RAST.Type.create_I128()); - } + if (_source62.is_I128) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I128()); } - if (unmatched62) { - unmatched62 = false; - return Std.Wrappers.Option.create_None(); - } - throw new System.Exception("unexpected control point"); + return Std.Wrappers.Option.create_None(); } public static void FromOwned(RAST._IExpr r, DCOMP._IOwnership expectedOwnership, out RAST._IExpr @out, out DCOMP._IOwnership resultingOwnership) { @@ -2444,204 +2271,179 @@ public void GenExprLiteral(DAST._IExpression e, Std.Wrappers._IOption>.Empty; DAST._IExpression _source63 = e; - bool unmatched63 = true; - if (unmatched63) { - if (_source63.is_Literal) { - DAST._ILiteral _h140 = _source63.dtor_Literal_a0; - if (_h140.is_BoolLiteral) { - bool _1395_b = _h140.dtor_BoolLiteral_a0; - unmatched63 = false; - { - RAST._IExpr _out170; - DCOMP._IOwnership _out171; - DCOMP.COMP.FromOwned(RAST.Expr.create_LiteralBool(_1395_b), expectedOwnership, out _out170, out _out171); - r = _out170; - resultingOwnership = _out171; - readIdents = Dafny.Set>.FromElements(); - return ; - } + if (_source63.is_Literal) { + DAST._ILiteral _h140 = _source63.dtor_Literal_a0; + if (_h140.is_BoolLiteral) { + bool _1395_b = _h140.dtor_BoolLiteral_a0; + { + RAST._IExpr _out170; + DCOMP._IOwnership _out171; + DCOMP.COMP.FromOwned(RAST.Expr.create_LiteralBool(_1395_b), expectedOwnership, out _out170, out _out171); + r = _out170; + resultingOwnership = _out171; + readIdents = Dafny.Set>.FromElements(); + return ; } + goto after_match19; } } - if (unmatched63) { - if (_source63.is_Literal) { - DAST._ILiteral _h141 = _source63.dtor_Literal_a0; - if (_h141.is_IntLiteral) { - Dafny.ISequence _1396_i = _h141.dtor_IntLiteral_a0; - DAST._IType _1397_t = _h141.dtor_IntLiteral_a1; - unmatched63 = false; - { - DAST._IType _source64 = _1397_t; - bool unmatched64 = true; - if (unmatched64) { - if (_source64.is_Primitive) { - DAST._IPrimitive _h80 = _source64.dtor_Primitive_a0; - if (_h80.is_Int) { - unmatched64 = false; - { - if ((new BigInteger((_1396_i).Count)) <= (new BigInteger(4))) { - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralInt(_1396_i)); - } else { - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralString(_1396_i, true, false)); - } - } - } - } - } - if (unmatched64) { - DAST._IType _1398_o = _source64; - unmatched64 = false; + if (_source63.is_Literal) { + DAST._ILiteral _h141 = _source63.dtor_Literal_a0; + if (_h141.is_IntLiteral) { + Dafny.ISequence _1396_i = _h141.dtor_IntLiteral_a0; + DAST._IType _1397_t = _h141.dtor_IntLiteral_a1; + { + DAST._IType _source64 = _1397_t; + if (_source64.is_Primitive) { + DAST._IPrimitive _h80 = _source64.dtor_Primitive_a0; + if (_h80.is_Int) { { - RAST._IType _1399_genType; - RAST._IType _out172; - _out172 = (this).GenType(_1398_o, false, false); - _1399_genType = _out172; - r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(_1396_i), _1399_genType); + if ((new BigInteger((_1396_i).Count)) <= (new BigInteger(4))) { + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralInt(_1396_i)); + } else { + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralString(_1396_i, true, false)); + } } + goto after_match20; } - RAST._IExpr _out173; - DCOMP._IOwnership _out174; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out173, out _out174); - r = _out173; - resultingOwnership = _out174; - readIdents = Dafny.Set>.FromElements(); - return ; } + DAST._IType _1398_o = _source64; + { + RAST._IType _1399_genType; + RAST._IType _out172; + _out172 = (this).GenType(_1398_o, false, false); + _1399_genType = _out172; + r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(_1396_i), _1399_genType); + } + after_match20: ; + RAST._IExpr _out173; + DCOMP._IOwnership _out174; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out173, out _out174); + r = _out173; + resultingOwnership = _out174; + readIdents = Dafny.Set>.FromElements(); + return ; } + goto after_match19; } } - if (unmatched63) { - if (_source63.is_Literal) { - DAST._ILiteral _h142 = _source63.dtor_Literal_a0; - if (_h142.is_DecLiteral) { - Dafny.ISequence _1400_n = _h142.dtor_DecLiteral_a0; - Dafny.ISequence _1401_d = _h142.dtor_DecLiteral_a1; - DAST._IType _1402_t = _h142.dtor_DecLiteral_a2; - unmatched63 = false; - { - DAST._IType _source65 = _1402_t; - bool unmatched65 = true; - if (unmatched65) { - if (_source65.is_Primitive) { - DAST._IPrimitive _h81 = _source65.dtor_Primitive_a0; - if (_h81.is_Real) { - unmatched65 = false; - { - r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::new(::dafny_runtime::BigInt::parse_bytes(b\""), _1400_n), Dafny.Sequence.UnicodeFromString("\", 10).unwrap(), ::dafny_runtime::BigInt::parse_bytes(b\"")), _1401_d), Dafny.Sequence.UnicodeFromString("\", 10).unwrap())")))); - } - } - } - } - if (unmatched65) { - DAST._IType _1403_o = _source65; - unmatched65 = false; + if (_source63.is_Literal) { + DAST._ILiteral _h142 = _source63.dtor_Literal_a0; + if (_h142.is_DecLiteral) { + Dafny.ISequence _1400_n = _h142.dtor_DecLiteral_a0; + Dafny.ISequence _1401_d = _h142.dtor_DecLiteral_a1; + DAST._IType _1402_t = _h142.dtor_DecLiteral_a2; + { + DAST._IType _source65 = _1402_t; + if (_source65.is_Primitive) { + DAST._IPrimitive _h81 = _source65.dtor_Primitive_a0; + if (_h81.is_Real) { { - RAST._IType _1404_genType; - RAST._IType _out175; - _out175 = (this).GenType(_1403_o, false, false); - _1404_genType = _out175; - r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), _1400_n), Dafny.Sequence.UnicodeFromString(".0 / ")), _1401_d), Dafny.Sequence.UnicodeFromString(".0")), Dafny.Sequence.UnicodeFromString(")"))), _1404_genType); + r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::new(::dafny_runtime::BigInt::parse_bytes(b\""), _1400_n), Dafny.Sequence.UnicodeFromString("\", 10).unwrap(), ::dafny_runtime::BigInt::parse_bytes(b\"")), _1401_d), Dafny.Sequence.UnicodeFromString("\", 10).unwrap())")))); } + goto after_match21; } - RAST._IExpr _out176; - DCOMP._IOwnership _out177; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out176, out _out177); - r = _out176; - resultingOwnership = _out177; - readIdents = Dafny.Set>.FromElements(); - return ; } - } - } - } - if (unmatched63) { - if (_source63.is_Literal) { - DAST._ILiteral _h143 = _source63.dtor_Literal_a0; - if (_h143.is_StringLiteral) { - Dafny.ISequence _1405_l = _h143.dtor_StringLiteral_a0; - bool _1406_verbatim = _h143.dtor_verbatim; - unmatched63 = false; + DAST._IType _1403_o = _source65; { - if (_1406_verbatim) { - (this).error = Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("Verbatim strings prefixed by @ not supported yet.")); - } - r = ((RAST.__default.dafny__runtime).MSel((this).string__of)).Apply1(RAST.Expr.create_LiteralString(_1405_l, false, _1406_verbatim)); - RAST._IExpr _out178; - DCOMP._IOwnership _out179; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out178, out _out179); - r = _out178; - resultingOwnership = _out179; - readIdents = Dafny.Set>.FromElements(); - return ; + RAST._IType _1404_genType; + RAST._IType _out175; + _out175 = (this).GenType(_1403_o, false, false); + _1404_genType = _out175; + r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), _1400_n), Dafny.Sequence.UnicodeFromString(".0 / ")), _1401_d), Dafny.Sequence.UnicodeFromString(".0")), Dafny.Sequence.UnicodeFromString(")"))), _1404_genType); } + after_match21: ; + RAST._IExpr _out176; + DCOMP._IOwnership _out177; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out176, out _out177); + r = _out176; + resultingOwnership = _out177; + readIdents = Dafny.Set>.FromElements(); + return ; } + goto after_match19; } } - if (unmatched63) { - if (_source63.is_Literal) { - DAST._ILiteral _h144 = _source63.dtor_Literal_a0; - if (_h144.is_CharLiteralUTF16) { - BigInteger _1407_c = _h144.dtor_CharLiteralUTF16_a0; - unmatched63 = false; - { - r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(_1407_c)); - r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); - r = ((RAST.__default.dafny__runtime).MSel((this).DafnyChar)).Apply1(r); - RAST._IExpr _out180; - DCOMP._IOwnership _out181; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out180, out _out181); - r = _out180; - resultingOwnership = _out181; - readIdents = Dafny.Set>.FromElements(); - return ; + if (_source63.is_Literal) { + DAST._ILiteral _h143 = _source63.dtor_Literal_a0; + if (_h143.is_StringLiteral) { + Dafny.ISequence _1405_l = _h143.dtor_StringLiteral_a0; + bool _1406_verbatim = _h143.dtor_verbatim; + { + if (_1406_verbatim) { + (this).error = Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("Verbatim strings prefixed by @ not supported yet.")); } + r = ((RAST.__default.dafny__runtime).MSel((this).string__of)).Apply1(RAST.Expr.create_LiteralString(_1405_l, false, _1406_verbatim)); + RAST._IExpr _out178; + DCOMP._IOwnership _out179; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out178, out _out179); + r = _out178; + resultingOwnership = _out179; + readIdents = Dafny.Set>.FromElements(); + return ; } + goto after_match19; } } - if (unmatched63) { - if (_source63.is_Literal) { - DAST._ILiteral _h145 = _source63.dtor_Literal_a0; - if (_h145.is_CharLiteral) { - Dafny.Rune _1408_c = _h145.dtor_CharLiteral_a0; - unmatched63 = false; - { - r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(new BigInteger((_1408_c).Value))); - if (!((this).UnicodeChars)) { - r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); - } else { - r = (((((((RAST.__default.@global).MSel(Dafny.Sequence.UnicodeFromString("std"))).MSel(Dafny.Sequence.UnicodeFromString("primitive"))).MSel(Dafny.Sequence.UnicodeFromString("char"))).MSel(Dafny.Sequence.UnicodeFromString("from_u32"))).Apply1(r)).Sel(Dafny.Sequence.UnicodeFromString("unwrap"))).Apply(Dafny.Sequence.FromElements()); - } - r = ((RAST.__default.dafny__runtime).MSel((this).DafnyChar)).Apply1(r); - RAST._IExpr _out182; - DCOMP._IOwnership _out183; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out182, out _out183); - r = _out182; - resultingOwnership = _out183; - readIdents = Dafny.Set>.FromElements(); - return ; - } + if (_source63.is_Literal) { + DAST._ILiteral _h144 = _source63.dtor_Literal_a0; + if (_h144.is_CharLiteralUTF16) { + BigInteger _1407_c = _h144.dtor_CharLiteralUTF16_a0; + { + r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(_1407_c)); + r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); + r = ((RAST.__default.dafny__runtime).MSel((this).DafnyChar)).Apply1(r); + RAST._IExpr _out180; + DCOMP._IOwnership _out181; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out180, out _out181); + r = _out180; + resultingOwnership = _out181; + readIdents = Dafny.Set>.FromElements(); + return ; } + goto after_match19; } } - if (unmatched63) { - DAST._ILiteral _h146 = _source63.dtor_Literal_a0; - DAST._IType _1409_tpe = _h146.dtor_Null_a0; - unmatched63 = false; - { - RAST._IType _1410_tpeGen; - RAST._IType _out184; - _out184 = (this).GenType(_1409_tpe, false, false); - _1410_tpeGen = _out184; - r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("None")), _1410_tpeGen); - RAST._IExpr _out185; - DCOMP._IOwnership _out186; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out185, out _out186); - r = _out185; - resultingOwnership = _out186; - readIdents = Dafny.Set>.FromElements(); - return ; - } + if (_source63.is_Literal) { + DAST._ILiteral _h145 = _source63.dtor_Literal_a0; + if (_h145.is_CharLiteral) { + Dafny.Rune _1408_c = _h145.dtor_CharLiteral_a0; + { + r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(new BigInteger((_1408_c).Value))); + if (!((this).UnicodeChars)) { + r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); + } else { + r = (((((((RAST.__default.@global).MSel(Dafny.Sequence.UnicodeFromString("std"))).MSel(Dafny.Sequence.UnicodeFromString("primitive"))).MSel(Dafny.Sequence.UnicodeFromString("char"))).MSel(Dafny.Sequence.UnicodeFromString("from_u32"))).Apply1(r)).Sel(Dafny.Sequence.UnicodeFromString("unwrap"))).Apply(Dafny.Sequence.FromElements()); + } + r = ((RAST.__default.dafny__runtime).MSel((this).DafnyChar)).Apply1(r); + RAST._IExpr _out182; + DCOMP._IOwnership _out183; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out182, out _out183); + r = _out182; + resultingOwnership = _out183; + readIdents = Dafny.Set>.FromElements(); + return ; + } + goto after_match19; + } + } + DAST._ILiteral _h146 = _source63.dtor_Literal_a0; + DAST._IType _1409_tpe = _h146.dtor_Null_a0; + { + RAST._IType _1410_tpeGen; + RAST._IType _out184; + _out184 = (this).GenType(_1409_tpe, false, false); + _1410_tpeGen = _out184; + r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("None")), _1410_tpeGen); + RAST._IExpr _out185; + DCOMP._IOwnership _out186; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out185, out _out186); + r = _out185; + resultingOwnership = _out186; + readIdents = Dafny.Set>.FromElements(); + return ; } + after_match19: ; } public void GenExprBinary(DAST._IExpression e, Std.Wrappers._IOption> selfIdent, DCOMP._IEnvironment env, DCOMP._IOwnership expectedOwnership, out RAST._IExpr r, out DCOMP._IOwnership resultingOwnership, out Dafny.ISet> readIdents) { @@ -2654,163 +2456,129 @@ public void GenExprBinary(DAST._IExpression e, Std.Wrappers._IOption)(() => { - DAST._IBinOp _source66 = _1411_op; - bool unmatched66 = true; - if (unmatched66) { - bool disjunctiveMatch11 = false; - if (_source66.is_SetMerge) { - disjunctiveMatch11 = true; - } - if (_source66.is_SetSubtraction) { - disjunctiveMatch11 = true; - } - if (_source66.is_SetIntersection) { - disjunctiveMatch11 = true; - } - if (_source66.is_SetDisjoint) { - disjunctiveMatch11 = true; - } - if (_source66.is_MapMerge) { - disjunctiveMatch11 = true; - } - if (_source66.is_MapSubtraction) { - disjunctiveMatch11 = true; - } - if (_source66.is_MultisetMerge) { - disjunctiveMatch11 = true; - } - if (_source66.is_MultisetSubtraction) { - disjunctiveMatch11 = true; - } - if (_source66.is_MultisetIntersection) { - disjunctiveMatch11 = true; - } - if (_source66.is_MultisetDisjoint) { - disjunctiveMatch11 = true; - } - if (_source66.is_Concat) { - disjunctiveMatch11 = true; - } - if (disjunctiveMatch11) { - unmatched66 = false; - return true; - } - } - if (unmatched66) { - unmatched66 = false; - return false; - } - throw new System.Exception("unexpected control point"); - }))(); + DAST._IBinOp _source66 = _1411_op; + bool disjunctiveMatch10 = false; + if (_source66.is_SetMerge) { + disjunctiveMatch10 = true; + } + if (_source66.is_SetSubtraction) { + disjunctiveMatch10 = true; + } + if (_source66.is_SetIntersection) { + disjunctiveMatch10 = true; + } + if (_source66.is_SetDisjoint) { + disjunctiveMatch10 = true; + } + if (_source66.is_MapMerge) { + disjunctiveMatch10 = true; + } + if (_source66.is_MapSubtraction) { + disjunctiveMatch10 = true; + } + if (_source66.is_MultisetMerge) { + disjunctiveMatch10 = true; + } + if (_source66.is_MultisetSubtraction) { + disjunctiveMatch10 = true; + } + if (_source66.is_MultisetIntersection) { + disjunctiveMatch10 = true; + } + if (_source66.is_MultisetDisjoint) { + disjunctiveMatch10 = true; + } + if (_source66.is_Concat) { + disjunctiveMatch10 = true; + } + if (disjunctiveMatch10) { + _1415_becomesLeftCallsRight = true; + goto after_match22; + } + _1415_becomesLeftCallsRight = false; + after_match22: ; bool _1416_becomesRightCallsLeft; - _1416_becomesRightCallsLeft = ((System.Func)(() => { - DAST._IBinOp _source67 = _1411_op; - bool unmatched67 = true; - if (unmatched67) { - if (_source67.is_In) { - unmatched67 = false; - return true; - } - } - if (unmatched67) { - unmatched67 = false; - return false; - } - throw new System.Exception("unexpected control point"); - }))(); + DAST._IBinOp _source67 = _1411_op; + if (_source67.is_In) { + _1416_becomesRightCallsLeft = true; + goto after_match23; + } + _1416_becomesRightCallsLeft = false; + after_match23: ; bool _1417_becomesCallLeftRight; - _1417_becomesCallLeftRight = ((System.Func)(() => { - DAST._IBinOp _source68 = _1411_op; - bool unmatched68 = true; - if (unmatched68) { - if (_source68.is_Eq) { - bool referential0 = _source68.dtor_referential; - if ((referential0) == (true)) { - bool nullable0 = _source68.dtor_nullable; - if ((nullable0) == (false)) { - unmatched68 = false; - return true; - } - } - } - } - if (unmatched68) { - if (_source68.is_SetMerge) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_SetSubtraction) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_SetIntersection) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_SetDisjoint) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_MapMerge) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_MapSubtraction) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_MultisetMerge) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_MultisetSubtraction) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_MultisetIntersection) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_MultisetDisjoint) { - unmatched68 = false; - return true; - } - } - if (unmatched68) { - if (_source68.is_Concat) { - unmatched68 = false; - return true; + DAST._IBinOp _source68 = _1411_op; + if (_source68.is_Eq) { + bool referential0 = _source68.dtor_referential; + if ((referential0) == (true)) { + bool nullable0 = _source68.dtor_nullable; + if ((nullable0) == (false)) { + _1417_becomesCallLeftRight = true; + goto after_match24; } } - if (unmatched68) { - unmatched68 = false; - return false; - } - throw new System.Exception("unexpected control point"); - }))(); + } + if (_source68.is_SetMerge) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_SetSubtraction) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_SetIntersection) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_SetDisjoint) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_MapMerge) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_MapSubtraction) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_MultisetMerge) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_MultisetSubtraction) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_MultisetIntersection) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_MultisetDisjoint) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + if (_source68.is_Concat) { + _1417_becomesCallLeftRight = true; + goto after_match24; + } + _1417_becomesCallLeftRight = false; + after_match24: ; DCOMP._IOwnership _1418_expectedLeftOwnership; - _1418_expectedLeftOwnership = ((_1415_becomesLeftCallsRight) ? (DCOMP.Ownership.create_OwnershipAutoBorrowed()) : ((((_1416_becomesRightCallsLeft) || (_1417_becomesCallLeftRight)) ? (DCOMP.Ownership.create_OwnershipBorrowed()) : (DCOMP.Ownership.create_OwnershipOwned())))); + if (_1415_becomesLeftCallsRight) { + _1418_expectedLeftOwnership = DCOMP.Ownership.create_OwnershipAutoBorrowed(); + } else if ((_1416_becomesRightCallsLeft) || (_1417_becomesCallLeftRight)) { + _1418_expectedLeftOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else { + _1418_expectedLeftOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } DCOMP._IOwnership _1419_expectedRightOwnership; - _1419_expectedRightOwnership = (((_1415_becomesLeftCallsRight) || (_1417_becomesCallLeftRight)) ? (DCOMP.Ownership.create_OwnershipBorrowed()) : (((_1416_becomesRightCallsLeft) ? (DCOMP.Ownership.create_OwnershipAutoBorrowed()) : (DCOMP.Ownership.create_OwnershipOwned())))); + if ((_1415_becomesLeftCallsRight) || (_1417_becomesCallLeftRight)) { + _1419_expectedRightOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else if (_1416_becomesRightCallsLeft) { + _1419_expectedRightOwnership = DCOMP.Ownership.create_OwnershipAutoBorrowed(); + } else { + _1419_expectedRightOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } RAST._IExpr _1420_left; DCOMP._IOwnership _1421___v77; Dafny.ISet> _1422_recIdentsL; @@ -2832,199 +2600,151 @@ public void GenExprBinary(DAST._IExpression e, Std.Wrappers._IOption.UnicodeFromString("contains"))).Apply1(_1420_left); - } + if (_source69.is_In) { + { + r = ((_1423_right).Sel(Dafny.Sequence.UnicodeFromString("contains"))).Apply1(_1420_left); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_SeqProperPrefix) { - unmatched69 = false; - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); - } + if (_source69.is_SeqProperPrefix) { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); + goto after_match25; } - if (unmatched69) { - if (_source69.is_SeqPrefix) { - unmatched69 = false; - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); - } + if (_source69.is_SeqPrefix) { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); + goto after_match25; } - if (unmatched69) { - if (_source69.is_SetMerge) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); - } + if (_source69.is_SetMerge) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_SetSubtraction) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); - } + if (_source69.is_SetSubtraction) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_SetIntersection) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1423_right); - } + if (_source69.is_SetIntersection) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_Subset) { - unmatched69 = false; - { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); - } + if (_source69.is_Subset) { + { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_ProperSubset) { - unmatched69 = false; - { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); - } + if (_source69.is_ProperSubset) { + { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_SetDisjoint) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1423_right); - } + if (_source69.is_SetDisjoint) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_MapMerge) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); - } + if (_source69.is_MapMerge) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_MapSubtraction) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); - } + if (_source69.is_MapSubtraction) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_MultisetMerge) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); - } + if (_source69.is_MultisetMerge) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_MultisetSubtraction) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); - } + if (_source69.is_MultisetSubtraction) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_MultisetIntersection) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1423_right); - } + if (_source69.is_MultisetIntersection) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_Submultiset) { - unmatched69 = false; - { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); - } + if (_source69.is_Submultiset) { + { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_ProperSubmultiset) { - unmatched69 = false; - { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); - } + if (_source69.is_ProperSubmultiset) { + { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_MultisetDisjoint) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1423_right); - } + if (_source69.is_MultisetDisjoint) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - if (_source69.is_Concat) { - unmatched69 = false; - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("concat"))).Apply1(_1423_right); - } + if (_source69.is_Concat) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("concat"))).Apply1(_1423_right); } + goto after_match25; } - if (unmatched69) { - unmatched69 = false; - { - if ((DCOMP.COMP.OpTable).Contains(_1411_op)) { - r = RAST.Expr.create_BinaryOp(Dafny.Map>.Select(DCOMP.COMP.OpTable,_1411_op), _1420_left, _1423_right, _1414_format); - } else { - DAST._IBinOp _source70 = _1411_op; - bool unmatched70 = true; - if (unmatched70) { - if (_source70.is_Eq) { - bool _1426_referential = _source70.dtor_referential; - bool _1427_nullable = _source70.dtor_nullable; - unmatched70 = false; - { - if (_1426_referential) { - if (_1427_nullable) { - r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::nullable_referential_equality"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); - } else { - r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::ptr_eq"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); - } - } else { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("=="), _1420_left, _1423_right, DAST.Format.BinaryOpFormat.create_NoFormat()); - } - } - } - } - if (unmatched70) { - if (_source70.is_EuclidianDiv) { - unmatched70 = false; - { - r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_division"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + { + if ((DCOMP.COMP.OpTable).Contains(_1411_op)) { + r = RAST.Expr.create_BinaryOp(Dafny.Map>.Select(DCOMP.COMP.OpTable,_1411_op), _1420_left, _1423_right, _1414_format); + } else { + DAST._IBinOp _source70 = _1411_op; + if (_source70.is_Eq) { + bool _1426_referential = _source70.dtor_referential; + bool _1427_nullable = _source70.dtor_nullable; + { + if (_1426_referential) { + if (_1427_nullable) { + r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::nullable_referential_equality"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + } else { + r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::ptr_eq"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); } + } else { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("=="), _1420_left, _1423_right, DAST.Format.BinaryOpFormat.create_NoFormat()); } } - if (unmatched70) { - if (_source70.is_EuclidianMod) { - unmatched70 = false; - { - r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_modulo"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); - } - } + goto after_match26; + } + if (_source70.is_EuclidianDiv) { + { + r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_division"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); } - if (unmatched70) { - Dafny.ISequence _1428_op = _source70.dtor_Passthrough_a0; - unmatched70 = false; - { - r = RAST.Expr.create_BinaryOp(_1428_op, _1420_left, _1423_right, _1414_format); - } + goto after_match26; + } + if (_source70.is_EuclidianMod) { + { + r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_modulo"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); } + goto after_match26; + } + Dafny.ISequence _1428_op = _source70.dtor_Passthrough_a0; + { + r = RAST.Expr.create_BinaryOp(_1428_op, _1420_left, _1423_right, _1414_format); } + after_match26: ; } } + after_match25: ; RAST._IExpr _out193; DCOMP._IOwnership _out194; DCOMP.COMP.FromOwned(r, expectedOwnership, out _out193, out _out194); @@ -3127,36 +2847,31 @@ public void GenExprConvertToNewtype(DAST._IExpression e, Std.Wrappers._IOption _source71 = _1450_nativeToType; - bool unmatched71 = true; - if (unmatched71) { - if (_source71.is_Some) { - RAST._IType _1454_v = _source71.dtor_value; - unmatched71 = false; - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("truncate!"))).Apply(Dafny.Sequence.FromElements(_1451_recursiveGen, RAST.Expr.create_ExprFromType(_1454_v))); - RAST._IExpr _out208; - DCOMP._IOwnership _out209; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out208, out _out209); - r = _out208; - resultingOwnership = _out209; - } - } - if (unmatched71) { - unmatched71 = false; - if (_1448_erase) { - r = _1451_recursiveGen; - } else { - RAST._IType _1455_rhsType; - RAST._IType _out210; - _out210 = (this).GenType(_1443_toTpe, true, false); - _1455_rhsType = _out210; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_1455_rhsType)._ToString(DCOMP.__default.IND), Dafny.Sequence.UnicodeFromString("(")), (_1451_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); - } - RAST._IExpr _out211; - DCOMP._IOwnership _out212; - DCOMP.COMP.FromOwnership(r, _1452_recOwned, expectedOwnership, out _out211, out _out212); - r = _out211; - resultingOwnership = _out212; - } + if (_source71.is_Some) { + RAST._IType _1454_v = _source71.dtor_value; + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("truncate!"))).Apply(Dafny.Sequence.FromElements(_1451_recursiveGen, RAST.Expr.create_ExprFromType(_1454_v))); + RAST._IExpr _out208; + DCOMP._IOwnership _out209; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out208, out _out209); + r = _out208; + resultingOwnership = _out209; + goto after_match27; + } + if (_1448_erase) { + r = _1451_recursiveGen; + } else { + RAST._IType _1455_rhsType; + RAST._IType _out210; + _out210 = (this).GenType(_1443_toTpe, true, false); + _1455_rhsType = _out210; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_1455_rhsType)._ToString(DCOMP.__default.IND), Dafny.Sequence.UnicodeFromString("(")), (_1451_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); + } + RAST._IExpr _out211; + DCOMP._IOwnership _out212; + DCOMP.COMP.FromOwnership(r, _1452_recOwned, expectedOwnership, out _out211, out _out212); + r = _out211; + resultingOwnership = _out212; + after_match27: ; } else { RAST._IExpr _out213; DCOMP._IOwnership _out214; @@ -3199,36 +2914,31 @@ public void GenExprConvertFromNewtype(DAST._IExpression e, Std.Wrappers._IOption _1468_recIdents = _out218; readIdents = _1468_recIdents; Std.Wrappers._IOption _source72 = _1465_nativeFromType; - bool unmatched72 = true; - if (unmatched72) { - if (_source72.is_Some) { - RAST._IType _1469_v = _source72.dtor_value; - unmatched72 = false; - RAST._IType _1470_toTpeRust; - RAST._IType _out219; - _out219 = (this).GenType(_1458_toTpe, false, false); - _1470_toTpeRust = _out219; - r = (((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("Into"))).ApplyType(Dafny.Sequence.FromElements(_1470_toTpeRust))).MSel(Dafny.Sequence.UnicodeFromString("into"))).Apply(Dafny.Sequence.FromElements(_1466_recursiveGen)); - RAST._IExpr _out220; - DCOMP._IOwnership _out221; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out220, out _out221); - r = _out220; - resultingOwnership = _out221; - } - } - if (unmatched72) { - unmatched72 = false; - if (_1463_erase) { - r = _1466_recursiveGen; - } else { - r = (_1466_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("0")); - } - RAST._IExpr _out222; - DCOMP._IOwnership _out223; - DCOMP.COMP.FromOwnership(r, _1467_recOwned, expectedOwnership, out _out222, out _out223); - r = _out222; - resultingOwnership = _out223; - } + if (_source72.is_Some) { + RAST._IType _1469_v = _source72.dtor_value; + RAST._IType _1470_toTpeRust; + RAST._IType _out219; + _out219 = (this).GenType(_1458_toTpe, false, false); + _1470_toTpeRust = _out219; + r = (((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("Into"))).ApplyType(Dafny.Sequence.FromElements(_1470_toTpeRust))).MSel(Dafny.Sequence.UnicodeFromString("into"))).Apply(Dafny.Sequence.FromElements(_1466_recursiveGen)); + RAST._IExpr _out220; + DCOMP._IOwnership _out221; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out220, out _out221); + r = _out220; + resultingOwnership = _out221; + goto after_match28; + } + if (_1463_erase) { + r = _1466_recursiveGen; + } else { + r = (_1466_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("0")); + } + RAST._IExpr _out222; + DCOMP._IOwnership _out223; + DCOMP.COMP.FromOwnership(r, _1467_recOwned, expectedOwnership, out _out222, out _out223); + r = _out222; + resultingOwnership = _out223; + after_match28: ; } else { if ((_1465_nativeFromType).is_Some) { if (object.Equals(_1458_toTpe, DAST.Type.create_Primitive(DAST.Primitive.create_Char()))) { @@ -3327,339 +3037,314 @@ public void GenExprConvert(DAST._IExpression e, Std.Wrappers._IOption _source73 = _System.Tuple2.create(_1484_fromTpe, _1485_toTpe); - bool unmatched73 = true; - if (unmatched73) { - DAST._IType _01 = _source73.dtor__0; - if (_01.is_Nullable) { - unmatched73 = false; + DAST._IType _01 = _source73.dtor__0; + if (_01.is_Nullable) { + { + RAST._IExpr _out244; + DCOMP._IOwnership _out245; + Dafny.ISet> _out246; + (this).GenExprConvertFromNullable(e, selfIdent, env, expectedOwnership, out _out244, out _out245, out _out246); + r = _out244; + resultingOwnership = _out245; + readIdents = _out246; + } + goto after_match29; + } + DAST._IType _11 = _source73.dtor__1; + if (_11.is_Nullable) { + { + RAST._IExpr _out247; + DCOMP._IOwnership _out248; + Dafny.ISet> _out249; + (this).GenExprConvertToNullable(e, selfIdent, env, expectedOwnership, out _out247, out _out248, out _out249); + r = _out247; + resultingOwnership = _out248; + readIdents = _out249; + } + goto after_match29; + } + DAST._IType _12 = _source73.dtor__1; + if (_12.is_Path) { + DAST._IResolvedType resolved1 = _12.dtor_resolved; + if (resolved1.is_Newtype) { + DAST._IType _1489_b = resolved1.dtor_baseType; + DAST._INewtypeRange _1490_range = resolved1.dtor_range; + bool _1491_erase = resolved1.dtor_erase; + Dafny.ISequence _1492_attributes = resolved1.dtor_attributes; { - RAST._IExpr _out244; - DCOMP._IOwnership _out245; - Dafny.ISet> _out246; - (this).GenExprConvertFromNullable(e, selfIdent, env, expectedOwnership, out _out244, out _out245, out _out246); - r = _out244; - resultingOwnership = _out245; - readIdents = _out246; + RAST._IExpr _out250; + DCOMP._IOwnership _out251; + Dafny.ISet> _out252; + (this).GenExprConvertToNewtype(e, selfIdent, env, expectedOwnership, out _out250, out _out251, out _out252); + r = _out250; + resultingOwnership = _out251; + readIdents = _out252; } + goto after_match29; } } - if (unmatched73) { - DAST._IType _11 = _source73.dtor__1; - if (_11.is_Nullable) { - unmatched73 = false; + DAST._IType _02 = _source73.dtor__0; + if (_02.is_Path) { + DAST._IResolvedType resolved2 = _02.dtor_resolved; + if (resolved2.is_Newtype) { + DAST._IType _1493_b = resolved2.dtor_baseType; + DAST._INewtypeRange _1494_range = resolved2.dtor_range; + bool _1495_erase = resolved2.dtor_erase; + Dafny.ISequence _1496_attributes = resolved2.dtor_attributes; { - RAST._IExpr _out247; - DCOMP._IOwnership _out248; - Dafny.ISet> _out249; - (this).GenExprConvertToNullable(e, selfIdent, env, expectedOwnership, out _out247, out _out248, out _out249); - r = _out247; - resultingOwnership = _out248; - readIdents = _out249; + RAST._IExpr _out253; + DCOMP._IOwnership _out254; + Dafny.ISet> _out255; + (this).GenExprConvertFromNewtype(e, selfIdent, env, expectedOwnership, out _out253, out _out254, out _out255); + r = _out253; + resultingOwnership = _out254; + readIdents = _out255; } + goto after_match29; } } - if (unmatched73) { - DAST._IType _12 = _source73.dtor__1; - if (_12.is_Path) { - DAST._IResolvedType resolved1 = _12.dtor_resolved; - if (resolved1.is_Newtype) { - DAST._IType _1489_b = resolved1.dtor_baseType; - DAST._INewtypeRange _1490_range = resolved1.dtor_range; - bool _1491_erase = resolved1.dtor_erase; - Dafny.ISequence _1492_attributes = resolved1.dtor_attributes; - unmatched73 = false; - { - RAST._IExpr _out250; - DCOMP._IOwnership _out251; - Dafny.ISet> _out252; - (this).GenExprConvertToNewtype(e, selfIdent, env, expectedOwnership, out _out250, out _out251, out _out252); - r = _out250; - resultingOwnership = _out251; - readIdents = _out252; + DAST._IType _03 = _source73.dtor__0; + if (_03.is_Primitive) { + DAST._IPrimitive _h82 = _03.dtor_Primitive_a0; + if (_h82.is_Int) { + DAST._IType _13 = _source73.dtor__1; + if (_13.is_Primitive) { + DAST._IPrimitive _h83 = _13.dtor_Primitive_a0; + if (_h83.is_Real) { + { + RAST._IExpr _1497_recursiveGen; + DCOMP._IOwnership _1498___v94; + Dafny.ISet> _1499_recIdents; + RAST._IExpr _out256; + DCOMP._IOwnership _out257; + Dafny.ISet> _out258; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out256, out _out257, out _out258); + _1497_recursiveGen = _out256; + _1498___v94 = _out257; + _1499_recIdents = _out258; + r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::from_integer("), (_1497_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")))); + RAST._IExpr _out259; + DCOMP._IOwnership _out260; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out259, out _out260); + r = _out259; + resultingOwnership = _out260; + readIdents = _1499_recIdents; + } + goto after_match29; } } } } - if (unmatched73) { - DAST._IType _02 = _source73.dtor__0; - if (_02.is_Path) { - DAST._IResolvedType resolved2 = _02.dtor_resolved; - if (resolved2.is_Newtype) { - DAST._IType _1493_b = resolved2.dtor_baseType; - DAST._INewtypeRange _1494_range = resolved2.dtor_range; - bool _1495_erase = resolved2.dtor_erase; - Dafny.ISequence _1496_attributes = resolved2.dtor_attributes; - unmatched73 = false; - { - RAST._IExpr _out253; - DCOMP._IOwnership _out254; - Dafny.ISet> _out255; - (this).GenExprConvertFromNewtype(e, selfIdent, env, expectedOwnership, out _out253, out _out254, out _out255); - r = _out253; - resultingOwnership = _out254; - readIdents = _out255; + DAST._IType _04 = _source73.dtor__0; + if (_04.is_Primitive) { + DAST._IPrimitive _h84 = _04.dtor_Primitive_a0; + if (_h84.is_Real) { + DAST._IType _14 = _source73.dtor__1; + if (_14.is_Primitive) { + DAST._IPrimitive _h85 = _14.dtor_Primitive_a0; + if (_h85.is_Int) { + { + RAST._IExpr _1500_recursiveGen; + DCOMP._IOwnership _1501___v95; + Dafny.ISet> _1502_recIdents; + RAST._IExpr _out261; + DCOMP._IOwnership _out262; + Dafny.ISet> _out263; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out261, out _out262, out _out263); + _1500_recursiveGen = _out261; + _1501___v95 = _out262; + _1502_recIdents = _out263; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::dafny_rational_to_int("), (_1500_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); + RAST._IExpr _out264; + DCOMP._IOwnership _out265; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out264, out _out265); + r = _out264; + resultingOwnership = _out265; + readIdents = _1502_recIdents; + } + goto after_match29; } } } } - if (unmatched73) { - DAST._IType _03 = _source73.dtor__0; - if (_03.is_Primitive) { - DAST._IPrimitive _h82 = _03.dtor_Primitive_a0; - if (_h82.is_Int) { - DAST._IType _13 = _source73.dtor__1; - if (_13.is_Primitive) { - DAST._IPrimitive _h83 = _13.dtor_Primitive_a0; - if (_h83.is_Real) { - unmatched73 = false; - { - RAST._IExpr _1497_recursiveGen; - DCOMP._IOwnership _1498___v94; - Dafny.ISet> _1499_recIdents; - RAST._IExpr _out256; - DCOMP._IOwnership _out257; - Dafny.ISet> _out258; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out256, out _out257, out _out258); - _1497_recursiveGen = _out256; - _1498___v94 = _out257; - _1499_recIdents = _out258; - r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::from_integer("), (_1497_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")))); - RAST._IExpr _out259; - DCOMP._IOwnership _out260; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out259, out _out260); - r = _out259; - resultingOwnership = _out260; - readIdents = _1499_recIdents; - } - } + DAST._IType _05 = _source73.dtor__0; + if (_05.is_Primitive) { + DAST._IPrimitive _h86 = _05.dtor_Primitive_a0; + if (_h86.is_Int) { + DAST._IType _15 = _source73.dtor__1; + if (_15.is_Passthrough) { + { + RAST._IType _1503_rhsType; + RAST._IType _out266; + _out266 = (this).GenType(_1485_toTpe, true, false); + _1503_rhsType = _out266; + RAST._IExpr _1504_recursiveGen; + DCOMP._IOwnership _1505___v97; + Dafny.ISet> _1506_recIdents; + RAST._IExpr _out267; + DCOMP._IOwnership _out268; + Dafny.ISet> _out269; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out267, out _out268, out _out269); + _1504_recursiveGen = _out267; + _1505___v97 = _out268; + _1506_recIdents = _out269; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1503_rhsType)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as ::dafny_runtime::NumCast>::from(")), (_1504_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()"))); + RAST._IExpr _out270; + DCOMP._IOwnership _out271; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out270, out _out271); + r = _out270; + resultingOwnership = _out271; + readIdents = _1506_recIdents; } + goto after_match29; } } } - if (unmatched73) { - DAST._IType _04 = _source73.dtor__0; - if (_04.is_Primitive) { - DAST._IPrimitive _h84 = _04.dtor_Primitive_a0; - if (_h84.is_Real) { - DAST._IType _14 = _source73.dtor__1; - if (_14.is_Primitive) { - DAST._IPrimitive _h85 = _14.dtor_Primitive_a0; - if (_h85.is_Int) { - unmatched73 = false; - { - RAST._IExpr _1500_recursiveGen; - DCOMP._IOwnership _1501___v95; - Dafny.ISet> _1502_recIdents; - RAST._IExpr _out261; - DCOMP._IOwnership _out262; - Dafny.ISet> _out263; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out261, out _out262, out _out263); - _1500_recursiveGen = _out261; - _1501___v95 = _out262; - _1502_recIdents = _out263; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::dafny_rational_to_int("), (_1500_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); - RAST._IExpr _out264; - DCOMP._IOwnership _out265; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out264, out _out265); - r = _out264; - resultingOwnership = _out265; - readIdents = _1502_recIdents; - } - } + DAST._IType _06 = _source73.dtor__0; + if (_06.is_Passthrough) { + DAST._IType _16 = _source73.dtor__1; + if (_16.is_Primitive) { + DAST._IPrimitive _h87 = _16.dtor_Primitive_a0; + if (_h87.is_Int) { + { + RAST._IType _1507_rhsType; + RAST._IType _out272; + _out272 = (this).GenType(_1484_fromTpe, true, false); + _1507_rhsType = _out272; + RAST._IExpr _1508_recursiveGen; + DCOMP._IOwnership _1509___v99; + Dafny.ISet> _1510_recIdents; + RAST._IExpr _out273; + DCOMP._IOwnership _out274; + Dafny.ISet> _out275; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out273, out _out274, out _out275); + _1508_recursiveGen = _out273; + _1509___v99 = _out274; + _1510_recIdents = _out275; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::DafnyInt{data: ::dafny_runtime::BigInt::from("), (_1508_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")}"))); + RAST._IExpr _out276; + DCOMP._IOwnership _out277; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out276, out _out277); + r = _out276; + resultingOwnership = _out277; + readIdents = _1510_recIdents; } + goto after_match29; } } } - if (unmatched73) { - DAST._IType _05 = _source73.dtor__0; - if (_05.is_Primitive) { - DAST._IPrimitive _h86 = _05.dtor_Primitive_a0; - if (_h86.is_Int) { - DAST._IType _15 = _source73.dtor__1; - if (_15.is_Passthrough) { - unmatched73 = false; + DAST._IType _07 = _source73.dtor__0; + if (_07.is_Primitive) { + DAST._IPrimitive _h88 = _07.dtor_Primitive_a0; + if (_h88.is_Int) { + DAST._IType _17 = _source73.dtor__1; + if (_17.is_Primitive) { + DAST._IPrimitive _h89 = _17.dtor_Primitive_a0; + if (_h89.is_Char) { { - RAST._IType _1503_rhsType; - RAST._IType _out266; - _out266 = (this).GenType(_1485_toTpe, true, false); - _1503_rhsType = _out266; - RAST._IExpr _1504_recursiveGen; - DCOMP._IOwnership _1505___v97; - Dafny.ISet> _1506_recIdents; - RAST._IExpr _out267; - DCOMP._IOwnership _out268; - Dafny.ISet> _out269; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out267, out _out268, out _out269); - _1504_recursiveGen = _out267; - _1505___v97 = _out268; - _1506_recIdents = _out269; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1503_rhsType)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as ::dafny_runtime::NumCast>::from(")), (_1504_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()"))); - RAST._IExpr _out270; - DCOMP._IOwnership _out271; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out270, out _out271); - r = _out270; - resultingOwnership = _out271; - readIdents = _1506_recIdents; + RAST._IType _1511_rhsType; + RAST._IType _out278; + _out278 = (this).GenType(_1485_toTpe, true, false); + _1511_rhsType = _out278; + RAST._IExpr _1512_recursiveGen; + DCOMP._IOwnership _1513___v100; + Dafny.ISet> _1514_recIdents; + RAST._IExpr _out279; + DCOMP._IOwnership _out280; + Dafny.ISet> _out281; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out279, out _out280, out _out281); + _1512_recursiveGen = _out279; + _1513___v100 = _out280; + _1514_recIdents = _out281; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("char::from_u32(::from("), (_1512_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()).unwrap()"))); + RAST._IExpr _out282; + DCOMP._IOwnership _out283; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out282, out _out283); + r = _out282; + resultingOwnership = _out283; + readIdents = _1514_recIdents; } + goto after_match29; } } } } - if (unmatched73) { - DAST._IType _06 = _source73.dtor__0; - if (_06.is_Passthrough) { - DAST._IType _16 = _source73.dtor__1; - if (_16.is_Primitive) { - DAST._IPrimitive _h87 = _16.dtor_Primitive_a0; - if (_h87.is_Int) { - unmatched73 = false; + DAST._IType _08 = _source73.dtor__0; + if (_08.is_Primitive) { + DAST._IPrimitive _h810 = _08.dtor_Primitive_a0; + if (_h810.is_Char) { + DAST._IType _18 = _source73.dtor__1; + if (_18.is_Primitive) { + DAST._IPrimitive _h811 = _18.dtor_Primitive_a0; + if (_h811.is_Int) { { - RAST._IType _1507_rhsType; - RAST._IType _out272; - _out272 = (this).GenType(_1484_fromTpe, true, false); - _1507_rhsType = _out272; - RAST._IExpr _1508_recursiveGen; - DCOMP._IOwnership _1509___v99; - Dafny.ISet> _1510_recIdents; - RAST._IExpr _out273; - DCOMP._IOwnership _out274; - Dafny.ISet> _out275; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out273, out _out274, out _out275); - _1508_recursiveGen = _out273; - _1509___v99 = _out274; - _1510_recIdents = _out275; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::DafnyInt{data: ::dafny_runtime::BigInt::from("), (_1508_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")}"))); - RAST._IExpr _out276; - DCOMP._IOwnership _out277; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out276, out _out277); - r = _out276; - resultingOwnership = _out277; - readIdents = _1510_recIdents; + RAST._IType _1515_rhsType; + RAST._IType _out284; + _out284 = (this).GenType(_1484_fromTpe, true, false); + _1515_rhsType = _out284; + RAST._IExpr _1516_recursiveGen; + DCOMP._IOwnership _1517___v101; + Dafny.ISet> _1518_recIdents; + RAST._IExpr _out285; + DCOMP._IOwnership _out286; + Dafny.ISet> _out287; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out285, out _out286, out _out287); + _1516_recursiveGen = _out285; + _1517___v101 = _out286; + _1518_recIdents = _out287; + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1((_1516_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("0"))); + RAST._IExpr _out288; + DCOMP._IOwnership _out289; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out288, out _out289); + r = _out288; + resultingOwnership = _out289; + readIdents = _1518_recIdents; } + goto after_match29; } } } } - if (unmatched73) { - DAST._IType _07 = _source73.dtor__0; - if (_07.is_Primitive) { - DAST._IPrimitive _h88 = _07.dtor_Primitive_a0; - if (_h88.is_Int) { - DAST._IType _17 = _source73.dtor__1; - if (_17.is_Primitive) { - DAST._IPrimitive _h89 = _17.dtor_Primitive_a0; - if (_h89.is_Char) { - unmatched73 = false; - { - RAST._IType _1511_rhsType; - RAST._IType _out278; - _out278 = (this).GenType(_1485_toTpe, true, false); - _1511_rhsType = _out278; - RAST._IExpr _1512_recursiveGen; - DCOMP._IOwnership _1513___v100; - Dafny.ISet> _1514_recIdents; - RAST._IExpr _out279; - DCOMP._IOwnership _out280; - Dafny.ISet> _out281; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out279, out _out280, out _out281); - _1512_recursiveGen = _out279; - _1513___v100 = _out280; - _1514_recIdents = _out281; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("char::from_u32(::from("), (_1512_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()).unwrap()"))); - RAST._IExpr _out282; - DCOMP._IOwnership _out283; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out282, out _out283); - r = _out282; - resultingOwnership = _out283; - readIdents = _1514_recIdents; - } - } - } - } - } - } - if (unmatched73) { - DAST._IType _08 = _source73.dtor__0; - if (_08.is_Primitive) { - DAST._IPrimitive _h810 = _08.dtor_Primitive_a0; - if (_h810.is_Char) { - DAST._IType _18 = _source73.dtor__1; - if (_18.is_Primitive) { - DAST._IPrimitive _h811 = _18.dtor_Primitive_a0; - if (_h811.is_Int) { - unmatched73 = false; - { - RAST._IType _1515_rhsType; - RAST._IType _out284; - _out284 = (this).GenType(_1484_fromTpe, true, false); - _1515_rhsType = _out284; - RAST._IExpr _1516_recursiveGen; - DCOMP._IOwnership _1517___v101; - Dafny.ISet> _1518_recIdents; - RAST._IExpr _out285; - DCOMP._IOwnership _out286; - Dafny.ISet> _out287; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out285, out _out286, out _out287); - _1516_recursiveGen = _out285; - _1517___v101 = _out286; - _1518_recIdents = _out287; - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1((_1516_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("0"))); - RAST._IExpr _out288; - DCOMP._IOwnership _out289; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out288, out _out289); - r = _out288; - resultingOwnership = _out289; - readIdents = _1518_recIdents; - } - } - } - } - } - } - if (unmatched73) { - DAST._IType _09 = _source73.dtor__0; - if (_09.is_Passthrough) { - DAST._IType _19 = _source73.dtor__1; - if (_19.is_Passthrough) { - unmatched73 = false; - { - RAST._IExpr _1519_recursiveGen; - DCOMP._IOwnership _1520___v104; - Dafny.ISet> _1521_recIdents; - RAST._IExpr _out290; - DCOMP._IOwnership _out291; - Dafny.ISet> _out292; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out290, out _out291, out _out292); - _1519_recursiveGen = _out290; - _1520___v104 = _out291; - _1521_recIdents = _out292; - RAST._IType _1522_toTpeGen; - RAST._IType _out293; - _out293 = (this).GenType(_1485_toTpe, true, false); - _1522_toTpeGen = _out293; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("(("), (_1519_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(") as ")), (_1522_toTpeGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); - RAST._IExpr _out294; - DCOMP._IOwnership _out295; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out294, out _out295); - r = _out294; - resultingOwnership = _out295; - readIdents = _1521_recIdents; - } + DAST._IType _09 = _source73.dtor__0; + if (_09.is_Passthrough) { + DAST._IType _19 = _source73.dtor__1; + if (_19.is_Passthrough) { + { + RAST._IExpr _1519_recursiveGen; + DCOMP._IOwnership _1520___v104; + Dafny.ISet> _1521_recIdents; + RAST._IExpr _out290; + DCOMP._IOwnership _out291; + Dafny.ISet> _out292; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out290, out _out291, out _out292); + _1519_recursiveGen = _out290; + _1520___v104 = _out291; + _1521_recIdents = _out292; + RAST._IType _1522_toTpeGen; + RAST._IType _out293; + _out293 = (this).GenType(_1485_toTpe, true, false); + _1522_toTpeGen = _out293; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("(("), (_1519_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(") as ")), (_1522_toTpeGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); + RAST._IExpr _out294; + DCOMP._IOwnership _out295; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out294, out _out295); + r = _out294; + resultingOwnership = _out295; + readIdents = _1521_recIdents; } + goto after_match29; } } - if (unmatched73) { - unmatched73 = false; - { - RAST._IExpr _out296; - DCOMP._IOwnership _out297; - Dafny.ISet> _out298; - (this).GenExprConvertNotImplemented(e, selfIdent, env, expectedOwnership, out _out296, out _out297, out _out298); - r = _out296; - resultingOwnership = _out297; - readIdents = _out298; - } + { + RAST._IExpr _out296; + DCOMP._IOwnership _out297; + Dafny.ISet> _out298; + (this).GenExprConvertNotImplemented(e, selfIdent, env, expectedOwnership, out _out296, out _out297, out _out298); + r = _out296; + resultingOwnership = _out297; + readIdents = _out298; } + after_match29: ; } return ; } @@ -3706,1842 +3391,1731 @@ public void GenExpr(DAST._IExpression e, Std.Wrappers._IOption>.Empty; DAST._IExpression _source74 = e; - bool unmatched74 = true; - if (unmatched74) { - if (_source74.is_Literal) { - unmatched74 = false; - RAST._IExpr _out299; - DCOMP._IOwnership _out300; - Dafny.ISet> _out301; - (this).GenExprLiteral(e, selfIdent, env, expectedOwnership, out _out299, out _out300, out _out301); - r = _out299; - resultingOwnership = _out300; - readIdents = _out301; - } - } - if (unmatched74) { - if (_source74.is_Ident) { - Dafny.ISequence _1526_name = _source74.dtor_Ident_a0; - unmatched74 = false; - { - RAST._IExpr _out302; - DCOMP._IOwnership _out303; - Dafny.ISet> _out304; - (this).GenIdent(DCOMP.__default.escapeName(_1526_name), selfIdent, env, expectedOwnership, out _out302, out _out303, out _out304); - r = _out302; - resultingOwnership = _out303; - readIdents = _out304; - } - } - } - if (unmatched74) { - if (_source74.is_Companion) { - Dafny.ISequence> _1527_path = _source74.dtor_Companion_a0; - unmatched74 = false; - { - RAST._IExpr _out305; - _out305 = DCOMP.COMP.GenPathExpr(_1527_path); - r = _out305; - if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowed())) { - resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); - } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwned())) { - resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); - } else { - RAST._IExpr _out306; - DCOMP._IOwnership _out307; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out306, out _out307); - r = _out306; - resultingOwnership = _out307; - } - readIdents = Dafny.Set>.FromElements(); - return ; + if (_source74.is_Literal) { + RAST._IExpr _out299; + DCOMP._IOwnership _out300; + Dafny.ISet> _out301; + (this).GenExprLiteral(e, selfIdent, env, expectedOwnership, out _out299, out _out300, out _out301); + r = _out299; + resultingOwnership = _out300; + readIdents = _out301; + goto after_match30; + } + if (_source74.is_Ident) { + Dafny.ISequence _1526_name = _source74.dtor_Ident_a0; + { + RAST._IExpr _out302; + DCOMP._IOwnership _out303; + Dafny.ISet> _out304; + (this).GenIdent(DCOMP.__default.escapeName(_1526_name), selfIdent, env, expectedOwnership, out _out302, out _out303, out _out304); + r = _out302; + resultingOwnership = _out303; + readIdents = _out304; + } + goto after_match30; + } + if (_source74.is_Companion) { + Dafny.ISequence> _1527_path = _source74.dtor_Companion_a0; + { + RAST._IExpr _out305; + _out305 = DCOMP.COMP.GenPathExpr(_1527_path); + r = _out305; + if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowed())) { + resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwned())) { + resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } else { + RAST._IExpr _out306; + DCOMP._IOwnership _out307; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out306, out _out307); + r = _out306; + resultingOwnership = _out307; } + readIdents = Dafny.Set>.FromElements(); + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_InitializationValue) { - DAST._IType _1528_typ = _source74.dtor_typ; - unmatched74 = false; - { - RAST._IType _1529_typExpr; - RAST._IType _out308; - _out308 = (this).GenType(_1528_typ, false, false); - _1529_typExpr = _out308; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1529_typExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as std::default::Default>::default()"))); - RAST._IExpr _out309; - DCOMP._IOwnership _out310; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out309, out _out310); - r = _out309; - resultingOwnership = _out310; - readIdents = Dafny.Set>.FromElements(); - return ; - } + if (_source74.is_InitializationValue) { + DAST._IType _1528_typ = _source74.dtor_typ; + { + RAST._IType _1529_typExpr; + RAST._IType _out308; + _out308 = (this).GenType(_1528_typ, false, false); + _1529_typExpr = _out308; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1529_typExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as std::default::Default>::default()"))); + RAST._IExpr _out309; + DCOMP._IOwnership _out310; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out309, out _out310); + r = _out309; + resultingOwnership = _out310; + readIdents = Dafny.Set>.FromElements(); + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_Tuple) { - Dafny.ISequence _1530_values = _source74.dtor_Tuple_a0; - unmatched74 = false; - { - Dafny.ISequence _1531_exprs; - _1531_exprs = Dafny.Sequence.FromElements(); - readIdents = Dafny.Set>.FromElements(); - BigInteger _hi30 = new BigInteger((_1530_values).Count); - for (BigInteger _1532_i = BigInteger.Zero; _1532_i < _hi30; _1532_i++) { - RAST._IExpr _1533_recursiveGen; - DCOMP._IOwnership _1534___v107; - Dafny.ISet> _1535_recIdents; - RAST._IExpr _out311; - DCOMP._IOwnership _out312; - Dafny.ISet> _out313; - (this).GenExpr((_1530_values).Select(_1532_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out311, out _out312, out _out313); - _1533_recursiveGen = _out311; - _1534___v107 = _out312; - _1535_recIdents = _out313; - _1531_exprs = Dafny.Sequence.Concat(_1531_exprs, Dafny.Sequence.FromElements(_1533_recursiveGen)); - readIdents = Dafny.Set>.Union(readIdents, _1535_recIdents); - } - r = (((new BigInteger((_1530_values).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) ? (RAST.Expr.create_Tuple(_1531_exprs)) : (RAST.__default.SystemTuple(_1531_exprs))); - RAST._IExpr _out314; - DCOMP._IOwnership _out315; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out314, out _out315); - r = _out314; - resultingOwnership = _out315; - return ; + if (_source74.is_Tuple) { + Dafny.ISequence _1530_values = _source74.dtor_Tuple_a0; + { + Dafny.ISequence _1531_exprs; + _1531_exprs = Dafny.Sequence.FromElements(); + readIdents = Dafny.Set>.FromElements(); + BigInteger _hi30 = new BigInteger((_1530_values).Count); + for (BigInteger _1532_i = BigInteger.Zero; _1532_i < _hi30; _1532_i++) { + RAST._IExpr _1533_recursiveGen; + DCOMP._IOwnership _1534___v107; + Dafny.ISet> _1535_recIdents; + RAST._IExpr _out311; + DCOMP._IOwnership _out312; + Dafny.ISet> _out313; + (this).GenExpr((_1530_values).Select(_1532_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out311, out _out312, out _out313); + _1533_recursiveGen = _out311; + _1534___v107 = _out312; + _1535_recIdents = _out313; + _1531_exprs = Dafny.Sequence.Concat(_1531_exprs, Dafny.Sequence.FromElements(_1533_recursiveGen)); + readIdents = Dafny.Set>.Union(readIdents, _1535_recIdents); + } + if ((new BigInteger((_1530_values).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) { + r = RAST.Expr.create_Tuple(_1531_exprs); + } else { + r = RAST.__default.SystemTuple(_1531_exprs); } + RAST._IExpr _out314; + DCOMP._IOwnership _out315; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out314, out _out315); + r = _out314; + resultingOwnership = _out315; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_New) { - Dafny.ISequence> _1536_path = _source74.dtor_path; - Dafny.ISequence _1537_typeArgs = _source74.dtor_typeArgs; - Dafny.ISequence _1538_args = _source74.dtor_args; - unmatched74 = false; - { - RAST._IExpr _out316; - _out316 = DCOMP.COMP.GenPathExpr(_1536_path); - r = _out316; - if ((new BigInteger((_1537_typeArgs).Count)).Sign == 1) { - Dafny.ISequence _1539_typeExprs; - _1539_typeExprs = Dafny.Sequence.FromElements(); - BigInteger _hi31 = new BigInteger((_1537_typeArgs).Count); - for (BigInteger _1540_i = BigInteger.Zero; _1540_i < _hi31; _1540_i++) { - RAST._IType _1541_typeExpr; - RAST._IType _out317; - _out317 = (this).GenType((_1537_typeArgs).Select(_1540_i), false, false); - _1541_typeExpr = _out317; - _1539_typeExprs = Dafny.Sequence.Concat(_1539_typeExprs, Dafny.Sequence.FromElements(_1541_typeExpr)); - } - r = (r).ApplyType(_1539_typeExprs); - } - r = (r).MSel(Dafny.Sequence.UnicodeFromString("new")); - readIdents = Dafny.Set>.FromElements(); - Dafny.ISequence _1542_arguments; - _1542_arguments = Dafny.Sequence.FromElements(); - BigInteger _hi32 = new BigInteger((_1538_args).Count); - for (BigInteger _1543_i = BigInteger.Zero; _1543_i < _hi32; _1543_i++) { - RAST._IExpr _1544_recursiveGen; - DCOMP._IOwnership _1545___v108; - Dafny.ISet> _1546_recIdents; - RAST._IExpr _out318; - DCOMP._IOwnership _out319; - Dafny.ISet> _out320; - (this).GenExpr((_1538_args).Select(_1543_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out318, out _out319, out _out320); - _1544_recursiveGen = _out318; - _1545___v108 = _out319; - _1546_recIdents = _out320; - _1542_arguments = Dafny.Sequence.Concat(_1542_arguments, Dafny.Sequence.FromElements(_1544_recursiveGen)); - readIdents = Dafny.Set>.Union(readIdents, _1546_recIdents); + if (_source74.is_New) { + Dafny.ISequence> _1536_path = _source74.dtor_path; + Dafny.ISequence _1537_typeArgs = _source74.dtor_typeArgs; + Dafny.ISequence _1538_args = _source74.dtor_args; + { + RAST._IExpr _out316; + _out316 = DCOMP.COMP.GenPathExpr(_1536_path); + r = _out316; + if ((new BigInteger((_1537_typeArgs).Count)).Sign == 1) { + Dafny.ISequence _1539_typeExprs; + _1539_typeExprs = Dafny.Sequence.FromElements(); + BigInteger _hi31 = new BigInteger((_1537_typeArgs).Count); + for (BigInteger _1540_i = BigInteger.Zero; _1540_i < _hi31; _1540_i++) { + RAST._IType _1541_typeExpr; + RAST._IType _out317; + _out317 = (this).GenType((_1537_typeArgs).Select(_1540_i), false, false); + _1541_typeExpr = _out317; + _1539_typeExprs = Dafny.Sequence.Concat(_1539_typeExprs, Dafny.Sequence.FromElements(_1541_typeExpr)); } - r = (r).Apply(_1542_arguments); - RAST._IExpr _out321; - DCOMP._IOwnership _out322; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out321, out _out322); - r = _out321; - resultingOwnership = _out322; - return ; + r = (r).ApplyType(_1539_typeExprs); } + r = (r).MSel(Dafny.Sequence.UnicodeFromString("new")); + readIdents = Dafny.Set>.FromElements(); + Dafny.ISequence _1542_arguments; + _1542_arguments = Dafny.Sequence.FromElements(); + BigInteger _hi32 = new BigInteger((_1538_args).Count); + for (BigInteger _1543_i = BigInteger.Zero; _1543_i < _hi32; _1543_i++) { + RAST._IExpr _1544_recursiveGen; + DCOMP._IOwnership _1545___v108; + Dafny.ISet> _1546_recIdents; + RAST._IExpr _out318; + DCOMP._IOwnership _out319; + Dafny.ISet> _out320; + (this).GenExpr((_1538_args).Select(_1543_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out318, out _out319, out _out320); + _1544_recursiveGen = _out318; + _1545___v108 = _out319; + _1546_recIdents = _out320; + _1542_arguments = Dafny.Sequence.Concat(_1542_arguments, Dafny.Sequence.FromElements(_1544_recursiveGen)); + readIdents = Dafny.Set>.Union(readIdents, _1546_recIdents); + } + r = (r).Apply(_1542_arguments); + RAST._IExpr _out321; + DCOMP._IOwnership _out322; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out321, out _out322); + r = _out321; + resultingOwnership = _out322; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_NewArray) { - Dafny.ISequence _1547_dims = _source74.dtor_dims; - DAST._IType _1548_typ = _source74.dtor_typ; - unmatched74 = false; - { - BigInteger _1549_i; - _1549_i = (new BigInteger((_1547_dims).Count)) - (BigInteger.One); - RAST._IType _1550_genTyp; - RAST._IType _out323; - _out323 = (this).GenType(_1548_typ, false, false); - _1550_genTyp = _out323; - Dafny.ISequence _1551_s; - _1551_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1550_genTyp)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as ::std::default::Default>::default()")); - readIdents = Dafny.Set>.FromElements(); - while ((_1549_i).Sign != -1) { - RAST._IExpr _1552_recursiveGen; - DCOMP._IOwnership _1553___v109; - Dafny.ISet> _1554_recIdents; - RAST._IExpr _out324; - DCOMP._IOwnership _out325; - Dafny.ISet> _out326; - (this).GenExpr((_1547_dims).Select(_1549_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out324, out _out325, out _out326); - _1552_recursiveGen = _out324; - _1553___v109 = _out325; - _1554_recIdents = _out326; - _1551_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::new(::std::cell::RefCell::new(vec!["), _1551_s), Dafny.Sequence.UnicodeFromString("; ::from(")), (_1552_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()]))")); - readIdents = Dafny.Set>.Union(readIdents, _1554_recIdents); - _1549_i = (_1549_i) - (BigInteger.One); - } - r = RAST.Expr.create_RawExpr(_1551_s); - RAST._IExpr _out327; - DCOMP._IOwnership _out328; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out327, out _out328); - r = _out327; - resultingOwnership = _out328; - return ; - } + if (_source74.is_NewArray) { + Dafny.ISequence _1547_dims = _source74.dtor_dims; + DAST._IType _1548_typ = _source74.dtor_typ; + { + BigInteger _1549_i; + _1549_i = (new BigInteger((_1547_dims).Count)) - (BigInteger.One); + RAST._IType _1550_genTyp; + RAST._IType _out323; + _out323 = (this).GenType(_1548_typ, false, false); + _1550_genTyp = _out323; + Dafny.ISequence _1551_s; + _1551_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1550_genTyp)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as ::std::default::Default>::default()")); + readIdents = Dafny.Set>.FromElements(); + while ((_1549_i).Sign != -1) { + RAST._IExpr _1552_recursiveGen; + DCOMP._IOwnership _1553___v109; + Dafny.ISet> _1554_recIdents; + RAST._IExpr _out324; + DCOMP._IOwnership _out325; + Dafny.ISet> _out326; + (this).GenExpr((_1547_dims).Select(_1549_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out324, out _out325, out _out326); + _1552_recursiveGen = _out324; + _1553___v109 = _out325; + _1554_recIdents = _out326; + _1551_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::new(::std::cell::RefCell::new(vec!["), _1551_s), Dafny.Sequence.UnicodeFromString("; ::from(")), (_1552_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()]))")); + readIdents = Dafny.Set>.Union(readIdents, _1554_recIdents); + _1549_i = (_1549_i) - (BigInteger.One); + } + r = RAST.Expr.create_RawExpr(_1551_s); + RAST._IExpr _out327; + DCOMP._IOwnership _out328; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out327, out _out328); + r = _out327; + resultingOwnership = _out328; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_DatatypeValue) { - DAST._IDatatypeType _1555_datatypeType = _source74.dtor_datatypeType; - Dafny.ISequence _1556_typeArgs = _source74.dtor_typeArgs; - Dafny.ISequence _1557_variant = _source74.dtor_variant; - bool _1558_isCo = _source74.dtor_isCo; - Dafny.ISequence<_System._ITuple2, DAST._IExpression>> _1559_values = _source74.dtor_contents; - unmatched74 = false; - { - RAST._IExpr _out329; - _out329 = DCOMP.COMP.GenPathExpr((_1555_datatypeType).dtor_path); - r = _out329; - Dafny.ISequence _1560_genTypeArgs; - _1560_genTypeArgs = Dafny.Sequence.FromElements(); - BigInteger _hi33 = new BigInteger((_1556_typeArgs).Count); - for (BigInteger _1561_i = BigInteger.Zero; _1561_i < _hi33; _1561_i++) { - RAST._IType _1562_typeExpr; - RAST._IType _out330; - _out330 = (this).GenType((_1556_typeArgs).Select(_1561_i), false, false); - _1562_typeExpr = _out330; - _1560_genTypeArgs = Dafny.Sequence.Concat(_1560_genTypeArgs, Dafny.Sequence.FromElements(_1562_typeExpr)); - } - if ((new BigInteger((_1556_typeArgs).Count)).Sign == 1) { - r = (r).ApplyType(_1560_genTypeArgs); - } - r = (r).MSel(DCOMP.__default.escapeName(_1557_variant)); - readIdents = Dafny.Set>.FromElements(); - Dafny.ISequence _1563_assignments; - _1563_assignments = Dafny.Sequence.FromElements(); - BigInteger _hi34 = new BigInteger((_1559_values).Count); - for (BigInteger _1564_i = BigInteger.Zero; _1564_i < _hi34; _1564_i++) { - _System._ITuple2, DAST._IExpression> _let_tmp_rhs63 = (_1559_values).Select(_1564_i); - Dafny.ISequence _1565_name = _let_tmp_rhs63.dtor__0; - DAST._IExpression _1566_value = _let_tmp_rhs63.dtor__1; - if (_1558_isCo) { - RAST._IExpr _1567_recursiveGen; - DCOMP._IOwnership _1568___v110; - Dafny.ISet> _1569_recIdents; - RAST._IExpr _out331; - DCOMP._IOwnership _out332; - Dafny.ISet> _out333; - (this).GenExpr(_1566_value, selfIdent, DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out331, out _out332, out _out333); - _1567_recursiveGen = _out331; - _1568___v110 = _out332; - _1569_recIdents = _out333; - readIdents = Dafny.Set>.Union(readIdents, _1569_recIdents); - Dafny.ISequence _1570_allReadCloned; - _1570_allReadCloned = Dafny.Sequence.UnicodeFromString(""); - while (!(_1569_recIdents).Equals(Dafny.Set>.FromElements())) { - Dafny.ISequence _1571_next; - foreach (Dafny.ISequence _assign_such_that_2 in (_1569_recIdents).Elements) { - _1571_next = (Dafny.ISequence)_assign_such_that_2; - if ((_1569_recIdents).Contains(_1571_next)) { - goto after__ASSIGN_SUCH_THAT_2; - } + if (_source74.is_DatatypeValue) { + DAST._IDatatypeType _1555_datatypeType = _source74.dtor_datatypeType; + Dafny.ISequence _1556_typeArgs = _source74.dtor_typeArgs; + Dafny.ISequence _1557_variant = _source74.dtor_variant; + bool _1558_isCo = _source74.dtor_isCo; + Dafny.ISequence<_System._ITuple2, DAST._IExpression>> _1559_values = _source74.dtor_contents; + { + RAST._IExpr _out329; + _out329 = DCOMP.COMP.GenPathExpr((_1555_datatypeType).dtor_path); + r = _out329; + Dafny.ISequence _1560_genTypeArgs; + _1560_genTypeArgs = Dafny.Sequence.FromElements(); + BigInteger _hi33 = new BigInteger((_1556_typeArgs).Count); + for (BigInteger _1561_i = BigInteger.Zero; _1561_i < _hi33; _1561_i++) { + RAST._IType _1562_typeExpr; + RAST._IType _out330; + _out330 = (this).GenType((_1556_typeArgs).Select(_1561_i), false, false); + _1562_typeExpr = _out330; + _1560_genTypeArgs = Dafny.Sequence.Concat(_1560_genTypeArgs, Dafny.Sequence.FromElements(_1562_typeExpr)); + } + if ((new BigInteger((_1556_typeArgs).Count)).Sign == 1) { + r = (r).ApplyType(_1560_genTypeArgs); + } + r = (r).MSel(DCOMP.__default.escapeName(_1557_variant)); + readIdents = Dafny.Set>.FromElements(); + Dafny.ISequence _1563_assignments; + _1563_assignments = Dafny.Sequence.FromElements(); + BigInteger _hi34 = new BigInteger((_1559_values).Count); + for (BigInteger _1564_i = BigInteger.Zero; _1564_i < _hi34; _1564_i++) { + _System._ITuple2, DAST._IExpression> _let_tmp_rhs63 = (_1559_values).Select(_1564_i); + Dafny.ISequence _1565_name = _let_tmp_rhs63.dtor__0; + DAST._IExpression _1566_value = _let_tmp_rhs63.dtor__1; + if (_1558_isCo) { + RAST._IExpr _1567_recursiveGen; + DCOMP._IOwnership _1568___v110; + Dafny.ISet> _1569_recIdents; + RAST._IExpr _out331; + DCOMP._IOwnership _out332; + Dafny.ISet> _out333; + (this).GenExpr(_1566_value, selfIdent, DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out331, out _out332, out _out333); + _1567_recursiveGen = _out331; + _1568___v110 = _out332; + _1569_recIdents = _out333; + readIdents = Dafny.Set>.Union(readIdents, _1569_recIdents); + Dafny.ISequence _1570_allReadCloned; + _1570_allReadCloned = Dafny.Sequence.UnicodeFromString(""); + while (!(_1569_recIdents).Equals(Dafny.Set>.FromElements())) { + Dafny.ISequence _1571_next; + foreach (Dafny.ISequence _assign_such_that_2 in (_1569_recIdents).Elements) { + _1571_next = (Dafny.ISequence)_assign_such_that_2; + if ((_1569_recIdents).Contains(_1571_next)) { + goto after__ASSIGN_SUCH_THAT_2; } - throw new System.Exception("assign-such-that search produced no value (line 3271)"); - after__ASSIGN_SUCH_THAT_2: ; - _1570_allReadCloned = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1570_allReadCloned, Dafny.Sequence.UnicodeFromString("let ")), _1571_next), Dafny.Sequence.UnicodeFromString(" = ")), _1571_next), Dafny.Sequence.UnicodeFromString(".clone();\n")); - _1569_recIdents = Dafny.Set>.Difference(_1569_recIdents, Dafny.Set>.FromElements(_1571_next)); } - Dafny.ISequence _1572_wasAssigned; - _1572_wasAssigned = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::LazyFieldWrapper(::dafny_runtime::Lazy::new(::std::boxed::Box::new({\n"), _1570_allReadCloned), Dafny.Sequence.UnicodeFromString("move || (")), (_1567_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")})))")); - _1563_assignments = Dafny.Sequence.Concat(_1563_assignments, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1565_name, RAST.Expr.create_RawExpr(_1572_wasAssigned)))); - } else { - RAST._IExpr _1573_recursiveGen; - DCOMP._IOwnership _1574___v111; - Dafny.ISet> _1575_recIdents; - RAST._IExpr _out334; - DCOMP._IOwnership _out335; - Dafny.ISet> _out336; - (this).GenExpr(_1566_value, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out334, out _out335, out _out336); - _1573_recursiveGen = _out334; - _1574___v111 = _out335; - _1575_recIdents = _out336; - _1563_assignments = Dafny.Sequence.Concat(_1563_assignments, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1565_name, _1573_recursiveGen))); - readIdents = Dafny.Set>.Union(readIdents, _1575_recIdents); + throw new System.Exception("assign-such-that search produced no value (line 3271)"); + after__ASSIGN_SUCH_THAT_2: ; + _1570_allReadCloned = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1570_allReadCloned, Dafny.Sequence.UnicodeFromString("let ")), _1571_next), Dafny.Sequence.UnicodeFromString(" = ")), _1571_next), Dafny.Sequence.UnicodeFromString(".clone();\n")); + _1569_recIdents = Dafny.Set>.Difference(_1569_recIdents, Dafny.Set>.FromElements(_1571_next)); } + Dafny.ISequence _1572_wasAssigned; + _1572_wasAssigned = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::LazyFieldWrapper(::dafny_runtime::Lazy::new(::std::boxed::Box::new({\n"), _1570_allReadCloned), Dafny.Sequence.UnicodeFromString("move || (")), (_1567_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")})))")); + _1563_assignments = Dafny.Sequence.Concat(_1563_assignments, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1565_name, RAST.Expr.create_RawExpr(_1572_wasAssigned)))); + } else { + RAST._IExpr _1573_recursiveGen; + DCOMP._IOwnership _1574___v111; + Dafny.ISet> _1575_recIdents; + RAST._IExpr _out334; + DCOMP._IOwnership _out335; + Dafny.ISet> _out336; + (this).GenExpr(_1566_value, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out334, out _out335, out _out336); + _1573_recursiveGen = _out334; + _1574___v111 = _out335; + _1575_recIdents = _out336; + _1563_assignments = Dafny.Sequence.Concat(_1563_assignments, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1565_name, _1573_recursiveGen))); + readIdents = Dafny.Set>.Union(readIdents, _1575_recIdents); } - r = RAST.Expr.create_StructBuild(r, _1563_assignments); - if ((this).IsRcWrapped((_1555_datatypeType).dtor_attributes)) { - r = RAST.__default.RcNew(r); - } - RAST._IExpr _out337; - DCOMP._IOwnership _out338; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out337, out _out338); - r = _out337; - resultingOwnership = _out338; - return ; } + r = RAST.Expr.create_StructBuild(r, _1563_assignments); + if ((this).IsRcWrapped((_1555_datatypeType).dtor_attributes)) { + r = RAST.__default.RcNew(r); + } + RAST._IExpr _out337; + DCOMP._IOwnership _out338; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out337, out _out338); + r = _out337; + resultingOwnership = _out338; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_Convert) { - unmatched74 = false; - { - RAST._IExpr _out339; - DCOMP._IOwnership _out340; - Dafny.ISet> _out341; - (this).GenExprConvert(e, selfIdent, env, expectedOwnership, out _out339, out _out340, out _out341); - r = _out339; - resultingOwnership = _out340; - readIdents = _out341; - } + if (_source74.is_Convert) { + { + RAST._IExpr _out339; + DCOMP._IOwnership _out340; + Dafny.ISet> _out341; + (this).GenExprConvert(e, selfIdent, env, expectedOwnership, out _out339, out _out340, out _out341); + r = _out339; + resultingOwnership = _out340; + readIdents = _out341; + } + goto after_match30; + } + if (_source74.is_SeqConstruct) { + DAST._IExpression _1576_length = _source74.dtor_length; + DAST._IExpression _1577_expr = _source74.dtor_elem; + { + RAST._IExpr _1578_recursiveGen; + DCOMP._IOwnership _1579___v115; + Dafny.ISet> _1580_recIdents; + RAST._IExpr _out342; + DCOMP._IOwnership _out343; + Dafny.ISet> _out344; + (this).GenExpr(_1577_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out342, out _out343, out _out344); + _1578_recursiveGen = _out342; + _1579___v115 = _out343; + _1580_recIdents = _out344; + RAST._IExpr _1581_lengthGen; + DCOMP._IOwnership _1582___v116; + Dafny.ISet> _1583_lengthIdents; + RAST._IExpr _out345; + DCOMP._IOwnership _out346; + Dafny.ISet> _out347; + (this).GenExpr(_1576_length, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out345, out _out346, out _out347); + _1581_lengthGen = _out345; + _1582___v116 = _out346; + _1583_lengthIdents = _out347; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\nlet _initializer = "), (_1578_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";\n::dafny_runtime::integer_range(::dafny_runtime::Zero::zero(), ")), (_1581_lengthGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").map(|i| _initializer(&i)).collect::<::dafny_runtime::Sequence<_>>()\n}"))); + readIdents = Dafny.Set>.Union(_1580_recIdents, _1583_lengthIdents); + RAST._IExpr _out348; + DCOMP._IOwnership _out349; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out348, out _out349); + r = _out348; + resultingOwnership = _out349; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_SeqConstruct) { - DAST._IExpression _1576_length = _source74.dtor_length; - DAST._IExpression _1577_expr = _source74.dtor_elem; - unmatched74 = false; - { - RAST._IExpr _1578_recursiveGen; - DCOMP._IOwnership _1579___v115; - Dafny.ISet> _1580_recIdents; - RAST._IExpr _out342; - DCOMP._IOwnership _out343; - Dafny.ISet> _out344; - (this).GenExpr(_1577_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out342, out _out343, out _out344); - _1578_recursiveGen = _out342; - _1579___v115 = _out343; - _1580_recIdents = _out344; - RAST._IExpr _1581_lengthGen; - DCOMP._IOwnership _1582___v116; - Dafny.ISet> _1583_lengthIdents; - RAST._IExpr _out345; - DCOMP._IOwnership _out346; - Dafny.ISet> _out347; - (this).GenExpr(_1576_length, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out345, out _out346, out _out347); - _1581_lengthGen = _out345; - _1582___v116 = _out346; - _1583_lengthIdents = _out347; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\nlet _initializer = "), (_1578_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";\n::dafny_runtime::integer_range(::dafny_runtime::Zero::zero(), ")), (_1581_lengthGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").map(|i| _initializer(&i)).collect::<::dafny_runtime::Sequence<_>>()\n}"))); - readIdents = Dafny.Set>.Union(_1580_recIdents, _1583_lengthIdents); - RAST._IExpr _out348; - DCOMP._IOwnership _out349; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out348, out _out349); - r = _out348; - resultingOwnership = _out349; - return ; - } + if (_source74.is_SeqValue) { + Dafny.ISequence _1584_exprs = _source74.dtor_elements; + DAST._IType _1585_typ = _source74.dtor_typ; + { + readIdents = Dafny.Set>.FromElements(); + RAST._IType _1586_genTpe; + RAST._IType _out350; + _out350 = (this).GenType(_1585_typ, false, false); + _1586_genTpe = _out350; + BigInteger _1587_i; + _1587_i = BigInteger.Zero; + Dafny.ISequence _1588_args; + _1588_args = Dafny.Sequence.FromElements(); + while ((_1587_i) < (new BigInteger((_1584_exprs).Count))) { + RAST._IExpr _1589_recursiveGen; + DCOMP._IOwnership _1590___v117; + Dafny.ISet> _1591_recIdents; + RAST._IExpr _out351; + DCOMP._IOwnership _out352; + Dafny.ISet> _out353; + (this).GenExpr((_1584_exprs).Select(_1587_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out351, out _out352, out _out353); + _1589_recursiveGen = _out351; + _1590___v117 = _out352; + _1591_recIdents = _out353; + readIdents = Dafny.Set>.Union(readIdents, _1591_recIdents); + _1588_args = Dafny.Sequence.Concat(_1588_args, Dafny.Sequence.FromElements(_1589_recursiveGen)); + _1587_i = (_1587_i) + (BigInteger.One); + } + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("seq!"))).Apply(_1588_args); + if ((new BigInteger((_1588_args).Count)).Sign == 0) { + r = RAST.Expr.create_TypeAscription(r, ((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence"))).Apply1(_1586_genTpe)); + } + RAST._IExpr _out354; + DCOMP._IOwnership _out355; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out354, out _out355); + r = _out354; + resultingOwnership = _out355; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_SeqValue) { - Dafny.ISequence _1584_exprs = _source74.dtor_elements; - DAST._IType _1585_typ = _source74.dtor_typ; - unmatched74 = false; - { - readIdents = Dafny.Set>.FromElements(); - RAST._IType _1586_genTpe; - RAST._IType _out350; - _out350 = (this).GenType(_1585_typ, false, false); - _1586_genTpe = _out350; - BigInteger _1587_i; - _1587_i = BigInteger.Zero; - Dafny.ISequence _1588_args; - _1588_args = Dafny.Sequence.FromElements(); - while ((_1587_i) < (new BigInteger((_1584_exprs).Count))) { - RAST._IExpr _1589_recursiveGen; - DCOMP._IOwnership _1590___v117; - Dafny.ISet> _1591_recIdents; - RAST._IExpr _out351; - DCOMP._IOwnership _out352; - Dafny.ISet> _out353; - (this).GenExpr((_1584_exprs).Select(_1587_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out351, out _out352, out _out353); - _1589_recursiveGen = _out351; - _1590___v117 = _out352; - _1591_recIdents = _out353; - readIdents = Dafny.Set>.Union(readIdents, _1591_recIdents); - _1588_args = Dafny.Sequence.Concat(_1588_args, Dafny.Sequence.FromElements(_1589_recursiveGen)); - _1587_i = (_1587_i) + (BigInteger.One); - } - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("seq!"))).Apply(_1588_args); - if ((new BigInteger((_1588_args).Count)).Sign == 0) { - r = RAST.Expr.create_TypeAscription(r, ((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence"))).Apply1(_1586_genTpe)); - } - RAST._IExpr _out354; - DCOMP._IOwnership _out355; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out354, out _out355); - r = _out354; - resultingOwnership = _out355; - return ; - } + if (_source74.is_SetValue) { + Dafny.ISequence _1592_exprs = _source74.dtor_elements; + { + Dafny.ISequence _1593_generatedValues; + _1593_generatedValues = Dafny.Sequence.FromElements(); + readIdents = Dafny.Set>.FromElements(); + BigInteger _1594_i; + _1594_i = BigInteger.Zero; + while ((_1594_i) < (new BigInteger((_1592_exprs).Count))) { + RAST._IExpr _1595_recursiveGen; + DCOMP._IOwnership _1596___v118; + Dafny.ISet> _1597_recIdents; + RAST._IExpr _out356; + DCOMP._IOwnership _out357; + Dafny.ISet> _out358; + (this).GenExpr((_1592_exprs).Select(_1594_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out356, out _out357, out _out358); + _1595_recursiveGen = _out356; + _1596___v118 = _out357; + _1597_recIdents = _out358; + _1593_generatedValues = Dafny.Sequence.Concat(_1593_generatedValues, Dafny.Sequence.FromElements(_1595_recursiveGen)); + readIdents = Dafny.Set>.Union(readIdents, _1597_recIdents); + _1594_i = (_1594_i) + (BigInteger.One); + } + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("set!"))).Apply(_1593_generatedValues); + RAST._IExpr _out359; + DCOMP._IOwnership _out360; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out359, out _out360); + r = _out359; + resultingOwnership = _out360; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_SetValue) { - Dafny.ISequence _1592_exprs = _source74.dtor_elements; - unmatched74 = false; - { - Dafny.ISequence _1593_generatedValues; - _1593_generatedValues = Dafny.Sequence.FromElements(); - readIdents = Dafny.Set>.FromElements(); - BigInteger _1594_i; - _1594_i = BigInteger.Zero; - while ((_1594_i) < (new BigInteger((_1592_exprs).Count))) { - RAST._IExpr _1595_recursiveGen; - DCOMP._IOwnership _1596___v118; - Dafny.ISet> _1597_recIdents; - RAST._IExpr _out356; - DCOMP._IOwnership _out357; - Dafny.ISet> _out358; - (this).GenExpr((_1592_exprs).Select(_1594_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out356, out _out357, out _out358); - _1595_recursiveGen = _out356; - _1596___v118 = _out357; - _1597_recIdents = _out358; - _1593_generatedValues = Dafny.Sequence.Concat(_1593_generatedValues, Dafny.Sequence.FromElements(_1595_recursiveGen)); - readIdents = Dafny.Set>.Union(readIdents, _1597_recIdents); - _1594_i = (_1594_i) + (BigInteger.One); - } - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("set!"))).Apply(_1593_generatedValues); - RAST._IExpr _out359; - DCOMP._IOwnership _out360; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out359, out _out360); - r = _out359; - resultingOwnership = _out360; - return ; - } + if (_source74.is_MultisetValue) { + Dafny.ISequence _1598_exprs = _source74.dtor_elements; + { + Dafny.ISequence _1599_generatedValues; + _1599_generatedValues = Dafny.Sequence.FromElements(); + readIdents = Dafny.Set>.FromElements(); + BigInteger _1600_i; + _1600_i = BigInteger.Zero; + while ((_1600_i) < (new BigInteger((_1598_exprs).Count))) { + RAST._IExpr _1601_recursiveGen; + DCOMP._IOwnership _1602___v119; + Dafny.ISet> _1603_recIdents; + RAST._IExpr _out361; + DCOMP._IOwnership _out362; + Dafny.ISet> _out363; + (this).GenExpr((_1598_exprs).Select(_1600_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out361, out _out362, out _out363); + _1601_recursiveGen = _out361; + _1602___v119 = _out362; + _1603_recIdents = _out363; + _1599_generatedValues = Dafny.Sequence.Concat(_1599_generatedValues, Dafny.Sequence.FromElements(_1601_recursiveGen)); + readIdents = Dafny.Set>.Union(readIdents, _1603_recIdents); + _1600_i = (_1600_i) + (BigInteger.One); + } + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("multiset!"))).Apply(_1599_generatedValues); + RAST._IExpr _out364; + DCOMP._IOwnership _out365; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out364, out _out365); + r = _out364; + resultingOwnership = _out365; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_MultisetValue) { - Dafny.ISequence _1598_exprs = _source74.dtor_elements; - unmatched74 = false; - { - Dafny.ISequence _1599_generatedValues; - _1599_generatedValues = Dafny.Sequence.FromElements(); - readIdents = Dafny.Set>.FromElements(); - BigInteger _1600_i; - _1600_i = BigInteger.Zero; - while ((_1600_i) < (new BigInteger((_1598_exprs).Count))) { - RAST._IExpr _1601_recursiveGen; - DCOMP._IOwnership _1602___v119; - Dafny.ISet> _1603_recIdents; - RAST._IExpr _out361; - DCOMP._IOwnership _out362; - Dafny.ISet> _out363; - (this).GenExpr((_1598_exprs).Select(_1600_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out361, out _out362, out _out363); - _1601_recursiveGen = _out361; - _1602___v119 = _out362; - _1603_recIdents = _out363; - _1599_generatedValues = Dafny.Sequence.Concat(_1599_generatedValues, Dafny.Sequence.FromElements(_1601_recursiveGen)); - readIdents = Dafny.Set>.Union(readIdents, _1603_recIdents); - _1600_i = (_1600_i) + (BigInteger.One); - } - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("multiset!"))).Apply(_1599_generatedValues); - RAST._IExpr _out364; - DCOMP._IOwnership _out365; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out364, out _out365); - r = _out364; - resultingOwnership = _out365; - return ; - } + if (_source74.is_ToMultiset) { + DAST._IExpression _1604_expr = _source74.dtor_ToMultiset_a0; + { + RAST._IExpr _1605_recursiveGen; + DCOMP._IOwnership _1606___v120; + Dafny.ISet> _1607_recIdents; + RAST._IExpr _out366; + DCOMP._IOwnership _out367; + Dafny.ISet> _out368; + (this).GenExpr(_1604_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out366, out _out367, out _out368); + _1605_recursiveGen = _out366; + _1606___v120 = _out367; + _1607_recIdents = _out368; + r = ((_1605_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("as_dafny_multiset"))).Apply(Dafny.Sequence.FromElements()); + readIdents = _1607_recIdents; + RAST._IExpr _out369; + DCOMP._IOwnership _out370; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out369, out _out370); + r = _out369; + resultingOwnership = _out370; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_ToMultiset) { - DAST._IExpression _1604_expr = _source74.dtor_ToMultiset_a0; - unmatched74 = false; - { - RAST._IExpr _1605_recursiveGen; - DCOMP._IOwnership _1606___v120; - Dafny.ISet> _1607_recIdents; - RAST._IExpr _out366; - DCOMP._IOwnership _out367; - Dafny.ISet> _out368; - (this).GenExpr(_1604_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out366, out _out367, out _out368); - _1605_recursiveGen = _out366; - _1606___v120 = _out367; - _1607_recIdents = _out368; - r = ((_1605_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("as_dafny_multiset"))).Apply(Dafny.Sequence.FromElements()); - readIdents = _1607_recIdents; - RAST._IExpr _out369; - DCOMP._IOwnership _out370; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out369, out _out370); - r = _out369; - resultingOwnership = _out370; - return ; - } + if (_source74.is_MapValue) { + Dafny.ISequence<_System._ITuple2> _1608_mapElems = _source74.dtor_mapElems; + { + Dafny.ISequence<_System._ITuple2> _1609_generatedValues; + _1609_generatedValues = Dafny.Sequence<_System._ITuple2>.FromElements(); + readIdents = Dafny.Set>.FromElements(); + BigInteger _1610_i; + _1610_i = BigInteger.Zero; + while ((_1610_i) < (new BigInteger((_1608_mapElems).Count))) { + RAST._IExpr _1611_recursiveGenKey; + DCOMP._IOwnership _1612___v121; + Dafny.ISet> _1613_recIdentsKey; + RAST._IExpr _out371; + DCOMP._IOwnership _out372; + Dafny.ISet> _out373; + (this).GenExpr(((_1608_mapElems).Select(_1610_i)).dtor__0, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out371, out _out372, out _out373); + _1611_recursiveGenKey = _out371; + _1612___v121 = _out372; + _1613_recIdentsKey = _out373; + RAST._IExpr _1614_recursiveGenValue; + DCOMP._IOwnership _1615___v122; + Dafny.ISet> _1616_recIdentsValue; + RAST._IExpr _out374; + DCOMP._IOwnership _out375; + Dafny.ISet> _out376; + (this).GenExpr(((_1608_mapElems).Select(_1610_i)).dtor__1, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out374, out _out375, out _out376); + _1614_recursiveGenValue = _out374; + _1615___v122 = _out375; + _1616_recIdentsValue = _out376; + _1609_generatedValues = Dafny.Sequence<_System._ITuple2>.Concat(_1609_generatedValues, Dafny.Sequence<_System._ITuple2>.FromElements(_System.Tuple2.create(_1611_recursiveGenKey, _1614_recursiveGenValue))); + readIdents = Dafny.Set>.Union(Dafny.Set>.Union(readIdents, _1613_recIdentsKey), _1616_recIdentsValue); + _1610_i = (_1610_i) + (BigInteger.One); + } + _1610_i = BigInteger.Zero; + Dafny.ISequence _1617_arguments; + _1617_arguments = Dafny.Sequence.FromElements(); + while ((_1610_i) < (new BigInteger((_1609_generatedValues).Count))) { + RAST._IExpr _1618_genKey; + _1618_genKey = ((_1609_generatedValues).Select(_1610_i)).dtor__0; + RAST._IExpr _1619_genValue; + _1619_genValue = ((_1609_generatedValues).Select(_1610_i)).dtor__1; + _1617_arguments = Dafny.Sequence.Concat(_1617_arguments, Dafny.Sequence.FromElements(RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("=>"), _1618_genKey, _1619_genValue, DAST.Format.BinaryOpFormat.create_NoFormat()))); + _1610_i = (_1610_i) + (BigInteger.One); + } + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("map!"))).Apply(_1617_arguments); + RAST._IExpr _out377; + DCOMP._IOwnership _out378; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out377, out _out378); + r = _out377; + resultingOwnership = _out378; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_MapValue) { - Dafny.ISequence<_System._ITuple2> _1608_mapElems = _source74.dtor_mapElems; - unmatched74 = false; + if (_source74.is_SeqUpdate) { + DAST._IExpression _1620_expr = _source74.dtor_expr; + DAST._IExpression _1621_index = _source74.dtor_indexExpr; + DAST._IExpression _1622_value = _source74.dtor_value; + { + RAST._IExpr _1623_exprR; + DCOMP._IOwnership _1624___v123; + Dafny.ISet> _1625_exprIdents; + RAST._IExpr _out379; + DCOMP._IOwnership _out380; + Dafny.ISet> _out381; + (this).GenExpr(_1620_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out379, out _out380, out _out381); + _1623_exprR = _out379; + _1624___v123 = _out380; + _1625_exprIdents = _out381; + RAST._IExpr _1626_indexR; + DCOMP._IOwnership _1627_indexOwnership; + Dafny.ISet> _1628_indexIdents; + RAST._IExpr _out382; + DCOMP._IOwnership _out383; + Dafny.ISet> _out384; + (this).GenExpr(_1621_index, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out382, out _out383, out _out384); + _1626_indexR = _out382; + _1627_indexOwnership = _out383; + _1628_indexIdents = _out384; + RAST._IExpr _1629_valueR; + DCOMP._IOwnership _1630_valueOwnership; + Dafny.ISet> _1631_valueIdents; + RAST._IExpr _out385; + DCOMP._IOwnership _out386; + Dafny.ISet> _out387; + (this).GenExpr(_1622_value, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out385, out _out386, out _out387); + _1629_valueR = _out385; + _1630_valueOwnership = _out386; + _1631_valueIdents = _out387; + r = ((_1623_exprR).Sel(Dafny.Sequence.UnicodeFromString("update_index"))).Apply(Dafny.Sequence.FromElements(_1626_indexR, _1629_valueR)); + RAST._IExpr _out388; + DCOMP._IOwnership _out389; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out388, out _out389); + r = _out388; + resultingOwnership = _out389; + readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1625_exprIdents, _1628_indexIdents), _1631_valueIdents); + return ; + } + goto after_match30; + } + if (_source74.is_MapUpdate) { + DAST._IExpression _1632_expr = _source74.dtor_expr; + DAST._IExpression _1633_index = _source74.dtor_indexExpr; + DAST._IExpression _1634_value = _source74.dtor_value; + { + RAST._IExpr _1635_exprR; + DCOMP._IOwnership _1636___v124; + Dafny.ISet> _1637_exprIdents; + RAST._IExpr _out390; + DCOMP._IOwnership _out391; + Dafny.ISet> _out392; + (this).GenExpr(_1632_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out390, out _out391, out _out392); + _1635_exprR = _out390; + _1636___v124 = _out391; + _1637_exprIdents = _out392; + RAST._IExpr _1638_indexR; + DCOMP._IOwnership _1639_indexOwnership; + Dafny.ISet> _1640_indexIdents; + RAST._IExpr _out393; + DCOMP._IOwnership _out394; + Dafny.ISet> _out395; + (this).GenExpr(_1633_index, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out393, out _out394, out _out395); + _1638_indexR = _out393; + _1639_indexOwnership = _out394; + _1640_indexIdents = _out395; + RAST._IExpr _1641_valueR; + DCOMP._IOwnership _1642_valueOwnership; + Dafny.ISet> _1643_valueIdents; + RAST._IExpr _out396; + DCOMP._IOwnership _out397; + Dafny.ISet> _out398; + (this).GenExpr(_1634_value, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out396, out _out397, out _out398); + _1641_valueR = _out396; + _1642_valueOwnership = _out397; + _1643_valueIdents = _out398; + r = ((_1635_exprR).Sel(Dafny.Sequence.UnicodeFromString("update_index"))).Apply(Dafny.Sequence.FromElements(_1638_indexR, _1641_valueR)); + RAST._IExpr _out399; + DCOMP._IOwnership _out400; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out399, out _out400); + r = _out399; + resultingOwnership = _out400; + readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1637_exprIdents, _1640_indexIdents), _1643_valueIdents); + return ; + } + goto after_match30; + } + if (_source74.is_This) { + { + Std.Wrappers._IOption> _source75 = selfIdent; + if (_source75.is_Some) { + Dafny.ISequence _1644_id = _source75.dtor_value; + { + r = RAST.Expr.create_Identifier(_1644_id); + if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwned())) { + r = RAST.__default.Clone(r); + resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwnedBox())) { + r = RAST.__default.BoxNew(RAST.__default.Clone(r)); + resultingOwnership = DCOMP.Ownership.create_OwnershipOwnedBox(); + } else if ((object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowed())) || (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipAutoBorrowed()))) { + if (!(_1644_id).Equals(Dafny.Sequence.UnicodeFromString("self"))) { + r = RAST.__default.Borrow(r); + } + resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else { + if (!(_1644_id).Equals(Dafny.Sequence.UnicodeFromString("self"))) { + r = RAST.__default.BorrowMut(r); + } + resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowedMut(); + } + readIdents = Dafny.Set>.FromElements(_1644_id); + } + goto after_match31; + } { - Dafny.ISequence<_System._ITuple2> _1609_generatedValues; - _1609_generatedValues = Dafny.Sequence<_System._ITuple2>.FromElements(); + r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("panic!(\"this outside of a method\")")); + RAST._IExpr _out401; + DCOMP._IOwnership _out402; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out401, out _out402); + r = _out401; + resultingOwnership = _out402; readIdents = Dafny.Set>.FromElements(); - BigInteger _1610_i; - _1610_i = BigInteger.Zero; - while ((_1610_i) < (new BigInteger((_1608_mapElems).Count))) { - RAST._IExpr _1611_recursiveGenKey; - DCOMP._IOwnership _1612___v121; - Dafny.ISet> _1613_recIdentsKey; - RAST._IExpr _out371; - DCOMP._IOwnership _out372; - Dafny.ISet> _out373; - (this).GenExpr(((_1608_mapElems).Select(_1610_i)).dtor__0, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out371, out _out372, out _out373); - _1611_recursiveGenKey = _out371; - _1612___v121 = _out372; - _1613_recIdentsKey = _out373; - RAST._IExpr _1614_recursiveGenValue; - DCOMP._IOwnership _1615___v122; - Dafny.ISet> _1616_recIdentsValue; - RAST._IExpr _out374; - DCOMP._IOwnership _out375; - Dafny.ISet> _out376; - (this).GenExpr(((_1608_mapElems).Select(_1610_i)).dtor__1, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out374, out _out375, out _out376); - _1614_recursiveGenValue = _out374; - _1615___v122 = _out375; - _1616_recIdentsValue = _out376; - _1609_generatedValues = Dafny.Sequence<_System._ITuple2>.Concat(_1609_generatedValues, Dafny.Sequence<_System._ITuple2>.FromElements(_System.Tuple2.create(_1611_recursiveGenKey, _1614_recursiveGenValue))); - readIdents = Dafny.Set>.Union(Dafny.Set>.Union(readIdents, _1613_recIdentsKey), _1616_recIdentsValue); - _1610_i = (_1610_i) + (BigInteger.One); - } - _1610_i = BigInteger.Zero; - Dafny.ISequence _1617_arguments; - _1617_arguments = Dafny.Sequence.FromElements(); - while ((_1610_i) < (new BigInteger((_1609_generatedValues).Count))) { - RAST._IExpr _1618_genKey; - _1618_genKey = ((_1609_generatedValues).Select(_1610_i)).dtor__0; - RAST._IExpr _1619_genValue; - _1619_genValue = ((_1609_generatedValues).Select(_1610_i)).dtor__1; - _1617_arguments = Dafny.Sequence.Concat(_1617_arguments, Dafny.Sequence.FromElements(RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("=>"), _1618_genKey, _1619_genValue, DAST.Format.BinaryOpFormat.create_NoFormat()))); - _1610_i = (_1610_i) + (BigInteger.One); - } - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("map!"))).Apply(_1617_arguments); - RAST._IExpr _out377; - DCOMP._IOwnership _out378; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out377, out _out378); - r = _out377; - resultingOwnership = _out378; - return ; } + after_match31: ; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_SeqUpdate) { - DAST._IExpression _1620_expr = _source74.dtor_expr; - DAST._IExpression _1621_index = _source74.dtor_indexExpr; - DAST._IExpression _1622_value = _source74.dtor_value; - unmatched74 = false; - { - RAST._IExpr _1623_exprR; - DCOMP._IOwnership _1624___v123; - Dafny.ISet> _1625_exprIdents; - RAST._IExpr _out379; - DCOMP._IOwnership _out380; - Dafny.ISet> _out381; - (this).GenExpr(_1620_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out379, out _out380, out _out381); - _1623_exprR = _out379; - _1624___v123 = _out380; - _1625_exprIdents = _out381; - RAST._IExpr _1626_indexR; - DCOMP._IOwnership _1627_indexOwnership; - Dafny.ISet> _1628_indexIdents; - RAST._IExpr _out382; - DCOMP._IOwnership _out383; - Dafny.ISet> _out384; - (this).GenExpr(_1621_index, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out382, out _out383, out _out384); - _1626_indexR = _out382; - _1627_indexOwnership = _out383; - _1628_indexIdents = _out384; - RAST._IExpr _1629_valueR; - DCOMP._IOwnership _1630_valueOwnership; - Dafny.ISet> _1631_valueIdents; - RAST._IExpr _out385; - DCOMP._IOwnership _out386; - Dafny.ISet> _out387; - (this).GenExpr(_1622_value, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out385, out _out386, out _out387); - _1629_valueR = _out385; - _1630_valueOwnership = _out386; - _1631_valueIdents = _out387; - r = ((_1623_exprR).Sel(Dafny.Sequence.UnicodeFromString("update_index"))).Apply(Dafny.Sequence.FromElements(_1626_indexR, _1629_valueR)); - RAST._IExpr _out388; - DCOMP._IOwnership _out389; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out388, out _out389); - r = _out388; - resultingOwnership = _out389; - readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1625_exprIdents, _1628_indexIdents), _1631_valueIdents); - return ; - } + if (_source74.is_Ite) { + DAST._IExpression _1645_cond = _source74.dtor_cond; + DAST._IExpression _1646_t = _source74.dtor_thn; + DAST._IExpression _1647_f = _source74.dtor_els; + { + RAST._IExpr _1648_cond; + DCOMP._IOwnership _1649___v125; + Dafny.ISet> _1650_recIdentsCond; + RAST._IExpr _out403; + DCOMP._IOwnership _out404; + Dafny.ISet> _out405; + (this).GenExpr(_1645_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out403, out _out404, out _out405); + _1648_cond = _out403; + _1649___v125 = _out404; + _1650_recIdentsCond = _out405; + Dafny.ISequence _1651_condString; + _1651_condString = (_1648_cond)._ToString(DCOMP.__default.IND); + RAST._IExpr _1652___v126; + DCOMP._IOwnership _1653_tHasToBeOwned; + Dafny.ISet> _1654___v127; + RAST._IExpr _out406; + DCOMP._IOwnership _out407; + Dafny.ISet> _out408; + (this).GenExpr(_1646_t, selfIdent, env, expectedOwnership, out _out406, out _out407, out _out408); + _1652___v126 = _out406; + _1653_tHasToBeOwned = _out407; + _1654___v127 = _out408; + RAST._IExpr _1655_fExpr; + DCOMP._IOwnership _1656_fOwned; + Dafny.ISet> _1657_recIdentsF; + RAST._IExpr _out409; + DCOMP._IOwnership _out410; + Dafny.ISet> _out411; + (this).GenExpr(_1647_f, selfIdent, env, _1653_tHasToBeOwned, out _out409, out _out410, out _out411); + _1655_fExpr = _out409; + _1656_fOwned = _out410; + _1657_recIdentsF = _out411; + Dafny.ISequence _1658_fString; + _1658_fString = (_1655_fExpr)._ToString(DCOMP.__default.IND); + RAST._IExpr _1659_tExpr; + DCOMP._IOwnership _1660___v128; + Dafny.ISet> _1661_recIdentsT; + RAST._IExpr _out412; + DCOMP._IOwnership _out413; + Dafny.ISet> _out414; + (this).GenExpr(_1646_t, selfIdent, env, _1656_fOwned, out _out412, out _out413, out _out414); + _1659_tExpr = _out412; + _1660___v128 = _out413; + _1661_recIdentsT = _out414; + Dafny.ISequence _1662_tString; + _1662_tString = (_1659_tExpr)._ToString(DCOMP.__default.IND); + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("(if "), _1651_condString), Dafny.Sequence.UnicodeFromString(" {\n")), _1662_tString), Dafny.Sequence.UnicodeFromString("\n} else {\n")), _1658_fString), Dafny.Sequence.UnicodeFromString("\n})"))); + RAST._IExpr _out415; + DCOMP._IOwnership _out416; + DCOMP.COMP.FromOwnership(r, _1656_fOwned, expectedOwnership, out _out415, out _out416); + r = _out415; + resultingOwnership = _out416; + readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1650_recIdentsCond, _1661_recIdentsT), _1657_recIdentsF); + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_MapUpdate) { - DAST._IExpression _1632_expr = _source74.dtor_expr; - DAST._IExpression _1633_index = _source74.dtor_indexExpr; - DAST._IExpression _1634_value = _source74.dtor_value; - unmatched74 = false; + if (_source74.is_UnOp) { + DAST._IUnaryOp unOp0 = _source74.dtor_unOp; + if (unOp0.is_Not) { + DAST._IExpression _1663_e = _source74.dtor_expr; + DAST.Format._IUnaryOpFormat _1664_format = _source74.dtor_format1; { - RAST._IExpr _1635_exprR; - DCOMP._IOwnership _1636___v124; - Dafny.ISet> _1637_exprIdents; - RAST._IExpr _out390; - DCOMP._IOwnership _out391; - Dafny.ISet> _out392; - (this).GenExpr(_1632_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out390, out _out391, out _out392); - _1635_exprR = _out390; - _1636___v124 = _out391; - _1637_exprIdents = _out392; - RAST._IExpr _1638_indexR; - DCOMP._IOwnership _1639_indexOwnership; - Dafny.ISet> _1640_indexIdents; - RAST._IExpr _out393; - DCOMP._IOwnership _out394; - Dafny.ISet> _out395; - (this).GenExpr(_1633_index, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out393, out _out394, out _out395); - _1638_indexR = _out393; - _1639_indexOwnership = _out394; - _1640_indexIdents = _out395; - RAST._IExpr _1641_valueR; - DCOMP._IOwnership _1642_valueOwnership; - Dafny.ISet> _1643_valueIdents; - RAST._IExpr _out396; - DCOMP._IOwnership _out397; - Dafny.ISet> _out398; - (this).GenExpr(_1634_value, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out396, out _out397, out _out398); - _1641_valueR = _out396; - _1642_valueOwnership = _out397; - _1643_valueIdents = _out398; - r = ((_1635_exprR).Sel(Dafny.Sequence.UnicodeFromString("update_index"))).Apply(Dafny.Sequence.FromElements(_1638_indexR, _1641_valueR)); - RAST._IExpr _out399; - DCOMP._IOwnership _out400; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out399, out _out400); - r = _out399; - resultingOwnership = _out400; - readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1637_exprIdents, _1640_indexIdents), _1643_valueIdents); + RAST._IExpr _1665_recursiveGen; + DCOMP._IOwnership _1666___v129; + Dafny.ISet> _1667_recIdents; + RAST._IExpr _out417; + DCOMP._IOwnership _out418; + Dafny.ISet> _out419; + (this).GenExpr(_1663_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out417, out _out418, out _out419); + _1665_recursiveGen = _out417; + _1666___v129 = _out418; + _1667_recIdents = _out419; + r = RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("!"), _1665_recursiveGen, _1664_format); + RAST._IExpr _out420; + DCOMP._IOwnership _out421; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out420, out _out421); + r = _out420; + resultingOwnership = _out421; + readIdents = _1667_recIdents; return ; } + goto after_match30; } } - if (unmatched74) { - if (_source74.is_This) { - unmatched74 = false; + if (_source74.is_UnOp) { + DAST._IUnaryOp unOp1 = _source74.dtor_unOp; + if (unOp1.is_BitwiseNot) { + DAST._IExpression _1668_e = _source74.dtor_expr; + DAST.Format._IUnaryOpFormat _1669_format = _source74.dtor_format1; { - Std.Wrappers._IOption> _source75 = selfIdent; - bool unmatched75 = true; - if (unmatched75) { - if (_source75.is_Some) { - Dafny.ISequence _1644_id = _source75.dtor_value; - unmatched75 = false; - { - r = RAST.Expr.create_Identifier(_1644_id); - if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwned())) { - r = RAST.__default.Clone(r); - resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); - } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwnedBox())) { - r = RAST.__default.BoxNew(RAST.__default.Clone(r)); - resultingOwnership = DCOMP.Ownership.create_OwnershipOwnedBox(); - } else if ((object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowed())) || (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipAutoBorrowed()))) { - if (!(_1644_id).Equals(Dafny.Sequence.UnicodeFromString("self"))) { - r = RAST.__default.Borrow(r); - } - resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); - } else { - if (!(_1644_id).Equals(Dafny.Sequence.UnicodeFromString("self"))) { - r = RAST.__default.BorrowMut(r); - } - resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowedMut(); - } - readIdents = Dafny.Set>.FromElements(_1644_id); - } - } - } - if (unmatched75) { - unmatched75 = false; - { - r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("panic!(\"this outside of a method\")")); - RAST._IExpr _out401; - DCOMP._IOwnership _out402; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out401, out _out402); - r = _out401; - resultingOwnership = _out402; - readIdents = Dafny.Set>.FromElements(); - } - } + RAST._IExpr _1670_recursiveGen; + DCOMP._IOwnership _1671___v130; + Dafny.ISet> _1672_recIdents; + RAST._IExpr _out422; + DCOMP._IOwnership _out423; + Dafny.ISet> _out424; + (this).GenExpr(_1668_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out422, out _out423, out _out424); + _1670_recursiveGen = _out422; + _1671___v130 = _out423; + _1672_recIdents = _out424; + r = RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("~"), _1670_recursiveGen, _1669_format); + RAST._IExpr _out425; + DCOMP._IOwnership _out426; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out425, out _out426); + r = _out425; + resultingOwnership = _out426; + readIdents = _1672_recIdents; return ; } + goto after_match30; } } - if (unmatched74) { - if (_source74.is_Ite) { - DAST._IExpression _1645_cond = _source74.dtor_cond; - DAST._IExpression _1646_t = _source74.dtor_thn; - DAST._IExpression _1647_f = _source74.dtor_els; - unmatched74 = false; + if (_source74.is_UnOp) { + DAST._IUnaryOp unOp2 = _source74.dtor_unOp; + if (unOp2.is_Cardinality) { + DAST._IExpression _1673_e = _source74.dtor_expr; + DAST.Format._IUnaryOpFormat _1674_format = _source74.dtor_format1; { - RAST._IExpr _1648_cond; - DCOMP._IOwnership _1649___v125; - Dafny.ISet> _1650_recIdentsCond; - RAST._IExpr _out403; - DCOMP._IOwnership _out404; - Dafny.ISet> _out405; - (this).GenExpr(_1645_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out403, out _out404, out _out405); - _1648_cond = _out403; - _1649___v125 = _out404; - _1650_recIdentsCond = _out405; - Dafny.ISequence _1651_condString; - _1651_condString = (_1648_cond)._ToString(DCOMP.__default.IND); - RAST._IExpr _1652___v126; - DCOMP._IOwnership _1653_tHasToBeOwned; - Dafny.ISet> _1654___v127; - RAST._IExpr _out406; - DCOMP._IOwnership _out407; - Dafny.ISet> _out408; - (this).GenExpr(_1646_t, selfIdent, env, expectedOwnership, out _out406, out _out407, out _out408); - _1652___v126 = _out406; - _1653_tHasToBeOwned = _out407; - _1654___v127 = _out408; - RAST._IExpr _1655_fExpr; - DCOMP._IOwnership _1656_fOwned; - Dafny.ISet> _1657_recIdentsF; - RAST._IExpr _out409; - DCOMP._IOwnership _out410; - Dafny.ISet> _out411; - (this).GenExpr(_1647_f, selfIdent, env, _1653_tHasToBeOwned, out _out409, out _out410, out _out411); - _1655_fExpr = _out409; - _1656_fOwned = _out410; - _1657_recIdentsF = _out411; - Dafny.ISequence _1658_fString; - _1658_fString = (_1655_fExpr)._ToString(DCOMP.__default.IND); - RAST._IExpr _1659_tExpr; - DCOMP._IOwnership _1660___v128; - Dafny.ISet> _1661_recIdentsT; - RAST._IExpr _out412; - DCOMP._IOwnership _out413; - Dafny.ISet> _out414; - (this).GenExpr(_1646_t, selfIdent, env, _1656_fOwned, out _out412, out _out413, out _out414); - _1659_tExpr = _out412; - _1660___v128 = _out413; - _1661_recIdentsT = _out414; - Dafny.ISequence _1662_tString; - _1662_tString = (_1659_tExpr)._ToString(DCOMP.__default.IND); - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("(if "), _1651_condString), Dafny.Sequence.UnicodeFromString(" {\n")), _1662_tString), Dafny.Sequence.UnicodeFromString("\n} else {\n")), _1658_fString), Dafny.Sequence.UnicodeFromString("\n})"))); - RAST._IExpr _out415; - DCOMP._IOwnership _out416; - DCOMP.COMP.FromOwnership(r, _1656_fOwned, expectedOwnership, out _out415, out _out416); - r = _out415; - resultingOwnership = _out416; - readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1650_recIdentsCond, _1661_recIdentsT), _1657_recIdentsF); + RAST._IExpr _1675_recursiveGen; + DCOMP._IOwnership _1676_recOwned; + Dafny.ISet> _1677_recIdents; + RAST._IExpr _out427; + DCOMP._IOwnership _out428; + Dafny.ISet> _out429; + (this).GenExpr(_1673_e, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out427, out _out428, out _out429); + _1675_recursiveGen = _out427; + _1676_recOwned = _out428; + _1677_recIdents = _out429; + r = ((_1675_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("cardinality"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out430; + DCOMP._IOwnership _out431; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out430, out _out431); + r = _out430; + resultingOwnership = _out431; + readIdents = _1677_recIdents; return ; } + goto after_match30; } } - if (unmatched74) { - if (_source74.is_UnOp) { - DAST._IUnaryOp unOp0 = _source74.dtor_unOp; - if (unOp0.is_Not) { - DAST._IExpression _1663_e = _source74.dtor_expr; - DAST.Format._IUnaryOpFormat _1664_format = _source74.dtor_format1; - unmatched74 = false; - { - RAST._IExpr _1665_recursiveGen; - DCOMP._IOwnership _1666___v129; - Dafny.ISet> _1667_recIdents; - RAST._IExpr _out417; - DCOMP._IOwnership _out418; - Dafny.ISet> _out419; - (this).GenExpr(_1663_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out417, out _out418, out _out419); - _1665_recursiveGen = _out417; - _1666___v129 = _out418; - _1667_recIdents = _out419; - r = RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("!"), _1665_recursiveGen, _1664_format); - RAST._IExpr _out420; - DCOMP._IOwnership _out421; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out420, out _out421); - r = _out420; - resultingOwnership = _out421; - readIdents = _1667_recIdents; - return ; - } - } - } + if (_source74.is_BinOp) { + RAST._IExpr _out432; + DCOMP._IOwnership _out433; + Dafny.ISet> _out434; + (this).GenExprBinary(e, selfIdent, env, expectedOwnership, out _out432, out _out433, out _out434); + r = _out432; + resultingOwnership = _out433; + readIdents = _out434; + goto after_match30; } - if (unmatched74) { - if (_source74.is_UnOp) { - DAST._IUnaryOp unOp1 = _source74.dtor_unOp; - if (unOp1.is_BitwiseNot) { - DAST._IExpression _1668_e = _source74.dtor_expr; - DAST.Format._IUnaryOpFormat _1669_format = _source74.dtor_format1; - unmatched74 = false; - { - RAST._IExpr _1670_recursiveGen; - DCOMP._IOwnership _1671___v130; - Dafny.ISet> _1672_recIdents; - RAST._IExpr _out422; - DCOMP._IOwnership _out423; - Dafny.ISet> _out424; - (this).GenExpr(_1668_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out422, out _out423, out _out424); - _1670_recursiveGen = _out422; - _1671___v130 = _out423; - _1672_recIdents = _out424; - r = RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("~"), _1670_recursiveGen, _1669_format); - RAST._IExpr _out425; - DCOMP._IOwnership _out426; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out425, out _out426); - r = _out425; - resultingOwnership = _out426; - readIdents = _1672_recIdents; - return ; + if (_source74.is_ArrayLen) { + DAST._IExpression _1678_expr = _source74.dtor_expr; + BigInteger _1679_dim = _source74.dtor_dim; + { + RAST._IExpr _1680_recursiveGen; + DCOMP._IOwnership _1681___v135; + Dafny.ISet> _1682_recIdents; + RAST._IExpr _out435; + DCOMP._IOwnership _out436; + Dafny.ISet> _out437; + (this).GenExpr(_1678_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out435, out _out436, out _out437); + _1680_recursiveGen = _out435; + _1681___v135 = _out436; + _1682_recIdents = _out437; + if ((_1679_dim).Sign == 0) { + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigInt::from(("), (_1680_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").borrow().len())"))); + } else { + Dafny.ISequence _1683_s; + _1683_s = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigInt::from(m.borrow().len())")))._ToString(DCOMP.__default.IND); + BigInteger _1684_i; + _1684_i = BigInteger.One; + while ((_1684_i) < (_1679_dim)) { + _1683_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("m.borrow().get(0).map(|m| "), _1683_s), Dafny.Sequence.UnicodeFromString(").unwrap_or(::dafny_runtime::BigInt::from(0))")); + _1684_i = (_1684_i) + (BigInteger.One); } - } + r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), (_1680_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")), Dafny.Sequence.UnicodeFromString(".borrow().get(0).map(|m| ")), _1683_s), Dafny.Sequence.UnicodeFromString(").unwrap_or(::dafny_runtime::BigInt::from(0))")))); + } + RAST._IExpr _out438; + DCOMP._IOwnership _out439; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out438, out _out439); + r = _out438; + resultingOwnership = _out439; + readIdents = _1682_recIdents; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_UnOp) { - DAST._IUnaryOp unOp2 = _source74.dtor_unOp; - if (unOp2.is_Cardinality) { - DAST._IExpression _1673_e = _source74.dtor_expr; - DAST.Format._IUnaryOpFormat _1674_format = _source74.dtor_format1; - unmatched74 = false; - { - RAST._IExpr _1675_recursiveGen; - DCOMP._IOwnership _1676_recOwned; - Dafny.ISet> _1677_recIdents; - RAST._IExpr _out427; - DCOMP._IOwnership _out428; - Dafny.ISet> _out429; - (this).GenExpr(_1673_e, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out427, out _out428, out _out429); - _1675_recursiveGen = _out427; - _1676_recOwned = _out428; - _1677_recIdents = _out429; - r = ((_1675_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("cardinality"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out430; - DCOMP._IOwnership _out431; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out430, out _out431); - r = _out430; - resultingOwnership = _out431; - readIdents = _1677_recIdents; - return ; - } - } + if (_source74.is_MapKeys) { + DAST._IExpression _1685_expr = _source74.dtor_expr; + { + RAST._IExpr _1686_recursiveGen; + DCOMP._IOwnership _1687___v136; + Dafny.ISet> _1688_recIdents; + RAST._IExpr _out440; + DCOMP._IOwnership _out441; + Dafny.ISet> _out442; + (this).GenExpr(_1685_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out440, out _out441, out _out442); + _1686_recursiveGen = _out440; + _1687___v136 = _out441; + _1688_recIdents = _out442; + readIdents = _1688_recIdents; + r = ((_1686_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("keys"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out443; + DCOMP._IOwnership _out444; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out443, out _out444); + r = _out443; + resultingOwnership = _out444; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_BinOp) { - unmatched74 = false; - RAST._IExpr _out432; - DCOMP._IOwnership _out433; - Dafny.ISet> _out434; - (this).GenExprBinary(e, selfIdent, env, expectedOwnership, out _out432, out _out433, out _out434); - r = _out432; - resultingOwnership = _out433; - readIdents = _out434; + if (_source74.is_MapValues) { + DAST._IExpression _1689_expr = _source74.dtor_expr; + { + RAST._IExpr _1690_recursiveGen; + DCOMP._IOwnership _1691___v137; + Dafny.ISet> _1692_recIdents; + RAST._IExpr _out445; + DCOMP._IOwnership _out446; + Dafny.ISet> _out447; + (this).GenExpr(_1689_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out445, out _out446, out _out447); + _1690_recursiveGen = _out445; + _1691___v137 = _out446; + _1692_recIdents = _out447; + readIdents = _1692_recIdents; + r = ((_1690_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("values"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out448; + DCOMP._IOwnership _out449; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out448, out _out449); + r = _out448; + resultingOwnership = _out449; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_ArrayLen) { - DAST._IExpression _1678_expr = _source74.dtor_expr; - BigInteger _1679_dim = _source74.dtor_dim; - unmatched74 = false; - { - RAST._IExpr _1680_recursiveGen; - DCOMP._IOwnership _1681___v135; - Dafny.ISet> _1682_recIdents; - RAST._IExpr _out435; - DCOMP._IOwnership _out436; - Dafny.ISet> _out437; - (this).GenExpr(_1678_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out435, out _out436, out _out437); - _1680_recursiveGen = _out435; - _1681___v135 = _out436; - _1682_recIdents = _out437; - if ((_1679_dim).Sign == 0) { - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigInt::from(("), (_1680_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").borrow().len())"))); - } else { - Dafny.ISequence _1683_s; - _1683_s = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigInt::from(m.borrow().len())")))._ToString(DCOMP.__default.IND); - BigInteger _1684_i; - _1684_i = BigInteger.One; - while ((_1684_i) < (_1679_dim)) { - _1683_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("m.borrow().get(0).map(|m| "), _1683_s), Dafny.Sequence.UnicodeFromString(").unwrap_or(::dafny_runtime::BigInt::from(0))")); - _1684_i = (_1684_i) + (BigInteger.One); + if (_source74.is_SelectFn) { + DAST._IExpression _1693_on = _source74.dtor_expr; + Dafny.ISequence _1694_field = _source74.dtor_field; + bool _1695_isDatatype = _source74.dtor_onDatatype; + bool _1696_isStatic = _source74.dtor_isStatic; + BigInteger _1697_arity = _source74.dtor_arity; + { + RAST._IExpr _1698_onExpr; + DCOMP._IOwnership _1699_onOwned; + Dafny.ISet> _1700_recIdents; + RAST._IExpr _out450; + DCOMP._IOwnership _out451; + Dafny.ISet> _out452; + (this).GenExpr(_1693_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out450, out _out451, out _out452); + _1698_onExpr = _out450; + _1699_onOwned = _out451; + _1700_recIdents = _out452; + Dafny.ISequence _1701_s = Dafny.Sequence.Empty; + Dafny.ISequence _1702_onString; + _1702_onString = (_1698_onExpr)._ToString(DCOMP.__default.IND); + if (_1696_isStatic) { + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1702_onString, Dafny.Sequence.UnicodeFromString("::")), DCOMP.__default.escapeName(_1694_field)); + } else { + _1701_s = Dafny.Sequence.UnicodeFromString("{\n"); + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("let callTarget = (")), _1702_onString), ((object.Equals(_1699_onOwned, DCOMP.Ownership.create_OwnershipOwned())) ? (Dafny.Sequence.UnicodeFromString(")")) : (Dafny.Sequence.UnicodeFromString(").clone()")))), Dafny.Sequence.UnicodeFromString(";\n")); + Dafny.ISequence _1703_args; + _1703_args = Dafny.Sequence.UnicodeFromString(""); + BigInteger _1704_i; + _1704_i = BigInteger.Zero; + while ((_1704_i) < (_1697_arity)) { + if ((_1704_i).Sign == 1) { + _1703_args = Dafny.Sequence.Concat(_1703_args, Dafny.Sequence.UnicodeFromString(", ")); } - r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), (_1680_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")), Dafny.Sequence.UnicodeFromString(".borrow().get(0).map(|m| ")), _1683_s), Dafny.Sequence.UnicodeFromString(").unwrap_or(::dafny_runtime::BigInt::from(0))")))); + _1703_args = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1703_args, Dafny.Sequence.UnicodeFromString("arg")), Std.Strings.__default.OfNat(_1704_i)); + _1704_i = (_1704_i) + (BigInteger.One); } - RAST._IExpr _out438; - DCOMP._IOwnership _out439; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out438, out _out439); - r = _out438; - resultingOwnership = _out439; - readIdents = _1682_recIdents; - return ; - } - } - } - if (unmatched74) { - if (_source74.is_MapKeys) { - DAST._IExpression _1685_expr = _source74.dtor_expr; - unmatched74 = false; - { - RAST._IExpr _1686_recursiveGen; - DCOMP._IOwnership _1687___v136; - Dafny.ISet> _1688_recIdents; - RAST._IExpr _out440; - DCOMP._IOwnership _out441; - Dafny.ISet> _out442; - (this).GenExpr(_1685_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out440, out _out441, out _out442); - _1686_recursiveGen = _out440; - _1687___v136 = _out441; - _1688_recIdents = _out442; - readIdents = _1688_recIdents; - r = ((_1686_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("keys"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out443; - DCOMP._IOwnership _out444; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out443, out _out444); - r = _out443; - resultingOwnership = _out444; - return ; - } + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("move |")), _1703_args), Dafny.Sequence.UnicodeFromString("| {\n")); + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("callTarget.")), DCOMP.__default.escapeName(_1694_field)), Dafny.Sequence.UnicodeFromString("(")), _1703_args), Dafny.Sequence.UnicodeFromString(")\n")); + _1701_s = Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("}\n")); + _1701_s = Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("}")); + } + Dafny.ISequence _1705_typeShape; + _1705_typeShape = Dafny.Sequence.UnicodeFromString("dyn ::std::ops::Fn("); + BigInteger _1706_i; + _1706_i = BigInteger.Zero; + while ((_1706_i) < (_1697_arity)) { + if ((_1706_i).Sign == 1) { + _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString(", ")); + } + _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString("&_")); + _1706_i = (_1706_i) + (BigInteger.One); + } + _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString(") -> _")); + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::new("), _1701_s), Dafny.Sequence.UnicodeFromString(") as ::std::rc::Rc<")), _1705_typeShape), Dafny.Sequence.UnicodeFromString(">")); + r = RAST.Expr.create_RawExpr(_1701_s); + RAST._IExpr _out453; + DCOMP._IOwnership _out454; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out453, out _out454); + r = _out453; + resultingOwnership = _out454; + readIdents = _1700_recIdents; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_MapValues) { - DAST._IExpression _1689_expr = _source74.dtor_expr; - unmatched74 = false; + if (_source74.is_Select) { + DAST._IExpression expr0 = _source74.dtor_expr; + if (expr0.is_Companion) { + Dafny.ISequence> _1707_c = expr0.dtor_Companion_a0; + Dafny.ISequence _1708_field = _source74.dtor_field; + bool _1709_isConstant = _source74.dtor_isConstant; + bool _1710_isDatatype = _source74.dtor_onDatatype; + DAST._IType _1711_fieldType = _source74.dtor_fieldType; { - RAST._IExpr _1690_recursiveGen; - DCOMP._IOwnership _1691___v137; - Dafny.ISet> _1692_recIdents; - RAST._IExpr _out445; - DCOMP._IOwnership _out446; - Dafny.ISet> _out447; - (this).GenExpr(_1689_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out445, out _out446, out _out447); - _1690_recursiveGen = _out445; - _1691___v137 = _out446; - _1692_recIdents = _out447; - readIdents = _1692_recIdents; - r = ((_1690_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("values"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out448; - DCOMP._IOwnership _out449; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out448, out _out449); - r = _out448; - resultingOwnership = _out449; + RAST._IExpr _1712_onExpr; + DCOMP._IOwnership _1713_onOwned; + Dafny.ISet> _1714_recIdents; + RAST._IExpr _out455; + DCOMP._IOwnership _out456; + Dafny.ISet> _out457; + (this).GenExpr(DAST.Expression.create_Companion(_1707_c), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out455, out _out456, out _out457); + _1712_onExpr = _out455; + _1713_onOwned = _out456; + _1714_recIdents = _out457; + r = ((_1712_onExpr).MSel(DCOMP.__default.escapeName(_1708_field))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out458; + DCOMP._IOwnership _out459; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out458, out _out459); + r = _out458; + resultingOwnership = _out459; + readIdents = _1714_recIdents; return ; } + goto after_match30; } } - if (unmatched74) { - if (_source74.is_SelectFn) { - DAST._IExpression _1693_on = _source74.dtor_expr; - Dafny.ISequence _1694_field = _source74.dtor_field; - bool _1695_isDatatype = _source74.dtor_onDatatype; - bool _1696_isStatic = _source74.dtor_isStatic; - BigInteger _1697_arity = _source74.dtor_arity; - unmatched74 = false; - { - RAST._IExpr _1698_onExpr; - DCOMP._IOwnership _1699_onOwned; - Dafny.ISet> _1700_recIdents; - RAST._IExpr _out450; - DCOMP._IOwnership _out451; - Dafny.ISet> _out452; - (this).GenExpr(_1693_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out450, out _out451, out _out452); - _1698_onExpr = _out450; - _1699_onOwned = _out451; - _1700_recIdents = _out452; - Dafny.ISequence _1701_s = Dafny.Sequence.Empty; - Dafny.ISequence _1702_onString; - _1702_onString = (_1698_onExpr)._ToString(DCOMP.__default.IND); - if (_1696_isStatic) { - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1702_onString, Dafny.Sequence.UnicodeFromString("::")), DCOMP.__default.escapeName(_1694_field)); + if (_source74.is_Select) { + DAST._IExpression _1715_on = _source74.dtor_expr; + Dafny.ISequence _1716_field = _source74.dtor_field; + bool _1717_isConstant = _source74.dtor_isConstant; + bool _1718_isDatatype = _source74.dtor_onDatatype; + DAST._IType _1719_fieldType = _source74.dtor_fieldType; + { + if (_1718_isDatatype) { + RAST._IExpr _1720_onExpr; + DCOMP._IOwnership _1721_onOwned; + Dafny.ISet> _1722_recIdents; + RAST._IExpr _out460; + DCOMP._IOwnership _out461; + Dafny.ISet> _out462; + (this).GenExpr(_1715_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out460, out _out461, out _out462); + _1720_onExpr = _out460; + _1721_onOwned = _out461; + _1722_recIdents = _out462; + r = ((_1720_onExpr).Sel(DCOMP.__default.escapeName(_1716_field))).Apply(Dafny.Sequence.FromElements()); + RAST._IType _1723_typ; + RAST._IType _out463; + _out463 = (this).GenType(_1719_fieldType, false, false); + _1723_typ = _out463; + RAST._IExpr _out464; + DCOMP._IOwnership _out465; + DCOMP.COMP.FromOwnership(r, DCOMP.Ownership.create_OwnershipBorrowed(), expectedOwnership, out _out464, out _out465); + r = _out464; + resultingOwnership = _out465; + readIdents = _1722_recIdents; + } else { + RAST._IExpr _1724_onExpr; + DCOMP._IOwnership _1725_onOwned; + Dafny.ISet> _1726_recIdents; + RAST._IExpr _out466; + DCOMP._IOwnership _out467; + Dafny.ISet> _out468; + (this).GenExpr(_1715_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out466, out _out467, out _out468); + _1724_onExpr = _out466; + _1725_onOwned = _out467; + _1726_recIdents = _out468; + r = _1724_onExpr; + r = (r).Sel(DCOMP.__default.escapeName(_1716_field)); + if (_1717_isConstant) { + r = (r).Apply(Dafny.Sequence.FromElements()); } else { - _1701_s = Dafny.Sequence.UnicodeFromString("{\n"); - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("let callTarget = (")), _1702_onString), ((object.Equals(_1699_onOwned, DCOMP.Ownership.create_OwnershipOwned())) ? (Dafny.Sequence.UnicodeFromString(")")) : (Dafny.Sequence.UnicodeFromString(").clone()")))), Dafny.Sequence.UnicodeFromString(";\n")); - Dafny.ISequence _1703_args; - _1703_args = Dafny.Sequence.UnicodeFromString(""); - BigInteger _1704_i; - _1704_i = BigInteger.Zero; - while ((_1704_i) < (_1697_arity)) { - if ((_1704_i).Sign == 1) { - _1703_args = Dafny.Sequence.Concat(_1703_args, Dafny.Sequence.UnicodeFromString(", ")); - } - _1703_args = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1703_args, Dafny.Sequence.UnicodeFromString("arg")), Std.Strings.__default.OfNat(_1704_i)); - _1704_i = (_1704_i) + (BigInteger.One); - } - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("move |")), _1703_args), Dafny.Sequence.UnicodeFromString("| {\n")); - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("callTarget.")), DCOMP.__default.escapeName(_1694_field)), Dafny.Sequence.UnicodeFromString("(")), _1703_args), Dafny.Sequence.UnicodeFromString(")\n")); - _1701_s = Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("}\n")); - _1701_s = Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("}")); + Dafny.ISequence _1727_s; + _1727_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Deref::deref(&(("), (_1724_onExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")), Dafny.Sequence.UnicodeFromString(".")), DCOMP.__default.escapeName(_1716_field)), Dafny.Sequence.UnicodeFromString(".borrow()))")); + r = RAST.Expr.create_RawExpr(_1727_s); } - Dafny.ISequence _1705_typeShape; - _1705_typeShape = Dafny.Sequence.UnicodeFromString("dyn ::std::ops::Fn("); - BigInteger _1706_i; - _1706_i = BigInteger.Zero; - while ((_1706_i) < (_1697_arity)) { - if ((_1706_i).Sign == 1) { - _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString(", ")); - } - _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString("&_")); - _1706_i = (_1706_i) + (BigInteger.One); + DCOMP._IOwnership _1728_fromOwnership; + if (_1717_isConstant) { + _1728_fromOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } else { + _1728_fromOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); } - _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString(") -> _")); - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::new("), _1701_s), Dafny.Sequence.UnicodeFromString(") as ::std::rc::Rc<")), _1705_typeShape), Dafny.Sequence.UnicodeFromString(">")); - r = RAST.Expr.create_RawExpr(_1701_s); - RAST._IExpr _out453; - DCOMP._IOwnership _out454; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out453, out _out454); - r = _out453; - resultingOwnership = _out454; - readIdents = _1700_recIdents; - return ; + RAST._IExpr _out469; + DCOMP._IOwnership _out470; + DCOMP.COMP.FromOwnership(r, _1728_fromOwnership, expectedOwnership, out _out469, out _out470); + r = _out469; + resultingOwnership = _out470; + readIdents = _1726_recIdents; } + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_Select) { - DAST._IExpression expr0 = _source74.dtor_expr; - if (expr0.is_Companion) { - Dafny.ISequence> _1707_c = expr0.dtor_Companion_a0; - Dafny.ISequence _1708_field = _source74.dtor_field; - bool _1709_isConstant = _source74.dtor_isConstant; - bool _1710_isDatatype = _source74.dtor_onDatatype; - DAST._IType _1711_fieldType = _source74.dtor_fieldType; - unmatched74 = false; - { - RAST._IExpr _1712_onExpr; - DCOMP._IOwnership _1713_onOwned; - Dafny.ISet> _1714_recIdents; - RAST._IExpr _out455; - DCOMP._IOwnership _out456; - Dafny.ISet> _out457; - (this).GenExpr(DAST.Expression.create_Companion(_1707_c), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out455, out _out456, out _out457); - _1712_onExpr = _out455; - _1713_onOwned = _out456; - _1714_recIdents = _out457; - r = ((_1712_onExpr).MSel(DCOMP.__default.escapeName(_1708_field))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out458; - DCOMP._IOwnership _out459; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out458, out _out459); - r = _out458; - resultingOwnership = _out459; - readIdents = _1714_recIdents; - return ; + if (_source74.is_Index) { + DAST._IExpression _1729_on = _source74.dtor_expr; + DAST._ICollKind _1730_collKind = _source74.dtor_collKind; + Dafny.ISequence _1731_indices = _source74.dtor_indices; + { + RAST._IExpr _1732_onExpr; + DCOMP._IOwnership _1733_onOwned; + Dafny.ISet> _1734_recIdents; + RAST._IExpr _out471; + DCOMP._IOwnership _out472; + Dafny.ISet> _out473; + (this).GenExpr(_1729_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out471, out _out472, out _out473); + _1732_onExpr = _out471; + _1733_onOwned = _out472; + _1734_recIdents = _out473; + readIdents = _1734_recIdents; + r = _1732_onExpr; + BigInteger _1735_i; + _1735_i = BigInteger.Zero; + while ((_1735_i) < (new BigInteger((_1731_indices).Count))) { + if (object.Equals(_1730_collKind, DAST.CollKind.create_Array())) { + r = ((r).Sel(Dafny.Sequence.UnicodeFromString("borrow"))).Apply(Dafny.Sequence.FromElements()); } - } + RAST._IExpr _1736_idx; + DCOMP._IOwnership _1737_idxOwned; + Dafny.ISet> _1738_recIdentsIdx; + RAST._IExpr _out474; + DCOMP._IOwnership _out475; + Dafny.ISet> _out476; + (this).GenExpr((_1731_indices).Select(_1735_i), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out474, out _out475, out _out476); + _1736_idx = _out474; + _1737_idxOwned = _out475; + _1738_recIdentsIdx = _out476; + r = ((r).Sel(Dafny.Sequence.UnicodeFromString("get"))).Apply1(_1736_idx); + readIdents = Dafny.Set>.Union(readIdents, _1738_recIdentsIdx); + _1735_i = (_1735_i) + (BigInteger.One); + } + RAST._IExpr _out477; + DCOMP._IOwnership _out478; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out477, out _out478); + r = _out477; + resultingOwnership = _out478; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_Select) { - DAST._IExpression _1715_on = _source74.dtor_expr; - Dafny.ISequence _1716_field = _source74.dtor_field; - bool _1717_isConstant = _source74.dtor_isConstant; - bool _1718_isDatatype = _source74.dtor_onDatatype; - DAST._IType _1719_fieldType = _source74.dtor_fieldType; - unmatched74 = false; - { - if (_1718_isDatatype) { - RAST._IExpr _1720_onExpr; - DCOMP._IOwnership _1721_onOwned; - Dafny.ISet> _1722_recIdents; - RAST._IExpr _out460; - DCOMP._IOwnership _out461; - Dafny.ISet> _out462; - (this).GenExpr(_1715_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out460, out _out461, out _out462); - _1720_onExpr = _out460; - _1721_onOwned = _out461; - _1722_recIdents = _out462; - r = ((_1720_onExpr).Sel(DCOMP.__default.escapeName(_1716_field))).Apply(Dafny.Sequence.FromElements()); - RAST._IType _1723_typ; - RAST._IType _out463; - _out463 = (this).GenType(_1719_fieldType, false, false); - _1723_typ = _out463; - RAST._IExpr _out464; - DCOMP._IOwnership _out465; - DCOMP.COMP.FromOwnership(r, DCOMP.Ownership.create_OwnershipBorrowed(), expectedOwnership, out _out464, out _out465); - r = _out464; - resultingOwnership = _out465; - readIdents = _1722_recIdents; + if (_source74.is_IndexRange) { + DAST._IExpression _1739_on = _source74.dtor_expr; + bool _1740_isArray = _source74.dtor_isArray; + Std.Wrappers._IOption _1741_low = _source74.dtor_low; + Std.Wrappers._IOption _1742_high = _source74.dtor_high; + { + RAST._IExpr _1743_onExpr; + DCOMP._IOwnership _1744_onOwned; + Dafny.ISet> _1745_recIdents; + RAST._IExpr _out479; + DCOMP._IOwnership _out480; + Dafny.ISet> _out481; + (this).GenExpr(_1739_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out479, out _out480, out _out481); + _1743_onExpr = _out479; + _1744_onOwned = _out480; + _1745_recIdents = _out481; + readIdents = _1745_recIdents; + Dafny.ISequence _1746_methodName; + if ((_1741_low).is_Some) { + if ((_1742_high).is_Some) { + _1746_methodName = Dafny.Sequence.UnicodeFromString("slice"); } else { - RAST._IExpr _1724_onExpr; - DCOMP._IOwnership _1725_onOwned; - Dafny.ISet> _1726_recIdents; - RAST._IExpr _out466; - DCOMP._IOwnership _out467; - Dafny.ISet> _out468; - (this).GenExpr(_1715_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out466, out _out467, out _out468); - _1724_onExpr = _out466; - _1725_onOwned = _out467; - _1726_recIdents = _out468; - r = _1724_onExpr; - r = (r).Sel(DCOMP.__default.escapeName(_1716_field)); - if (_1717_isConstant) { - r = (r).Apply(Dafny.Sequence.FromElements()); - } else { - Dafny.ISequence _1727_s; - _1727_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Deref::deref(&(("), (_1724_onExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")), Dafny.Sequence.UnicodeFromString(".")), DCOMP.__default.escapeName(_1716_field)), Dafny.Sequence.UnicodeFromString(".borrow()))")); - r = RAST.Expr.create_RawExpr(_1727_s); - } - DCOMP._IOwnership _1728_fromOwnership; - _1728_fromOwnership = ((_1717_isConstant) ? (DCOMP.Ownership.create_OwnershipOwned()) : (DCOMP.Ownership.create_OwnershipBorrowed())); - RAST._IExpr _out469; - DCOMP._IOwnership _out470; - DCOMP.COMP.FromOwnership(r, _1728_fromOwnership, expectedOwnership, out _out469, out _out470); - r = _out469; - resultingOwnership = _out470; - readIdents = _1726_recIdents; + _1746_methodName = Dafny.Sequence.UnicodeFromString("drop"); } - return ; + } else if ((_1742_high).is_Some) { + _1746_methodName = Dafny.Sequence.UnicodeFromString("take"); + } else { + _1746_methodName = Dafny.Sequence.UnicodeFromString(""); } - } - } - if (unmatched74) { - if (_source74.is_Index) { - DAST._IExpression _1729_on = _source74.dtor_expr; - DAST._ICollKind _1730_collKind = _source74.dtor_collKind; - Dafny.ISequence _1731_indices = _source74.dtor_indices; - unmatched74 = false; - { - RAST._IExpr _1732_onExpr; - DCOMP._IOwnership _1733_onOwned; - Dafny.ISet> _1734_recIdents; - RAST._IExpr _out471; - DCOMP._IOwnership _out472; - Dafny.ISet> _out473; - (this).GenExpr(_1729_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out471, out _out472, out _out473); - _1732_onExpr = _out471; - _1733_onOwned = _out472; - _1734_recIdents = _out473; - readIdents = _1734_recIdents; - r = _1732_onExpr; - BigInteger _1735_i; - _1735_i = BigInteger.Zero; - while ((_1735_i) < (new BigInteger((_1731_indices).Count))) { - if (object.Equals(_1730_collKind, DAST.CollKind.create_Array())) { - r = ((r).Sel(Dafny.Sequence.UnicodeFromString("borrow"))).Apply(Dafny.Sequence.FromElements()); - } - RAST._IExpr _1736_idx; - DCOMP._IOwnership _1737_idxOwned; - Dafny.ISet> _1738_recIdentsIdx; - RAST._IExpr _out474; - DCOMP._IOwnership _out475; - Dafny.ISet> _out476; - (this).GenExpr((_1731_indices).Select(_1735_i), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out474, out _out475, out _out476); - _1736_idx = _out474; - _1737_idxOwned = _out475; - _1738_recIdentsIdx = _out476; - r = ((r).Sel(Dafny.Sequence.UnicodeFromString("get"))).Apply1(_1736_idx); - readIdents = Dafny.Set>.Union(readIdents, _1738_recIdentsIdx); - _1735_i = (_1735_i) + (BigInteger.One); + Dafny.ISequence _1747_arguments; + _1747_arguments = Dafny.Sequence.FromElements(); + Std.Wrappers._IOption _source76 = _1741_low; + if (_source76.is_Some) { + DAST._IExpression _1748_l = _source76.dtor_value; + { + RAST._IExpr _1749_lExpr; + DCOMP._IOwnership _1750___v138; + Dafny.ISet> _1751_recIdentsL; + RAST._IExpr _out482; + DCOMP._IOwnership _out483; + Dafny.ISet> _out484; + (this).GenExpr(_1748_l, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out482, out _out483, out _out484); + _1749_lExpr = _out482; + _1750___v138 = _out483; + _1751_recIdentsL = _out484; + _1747_arguments = Dafny.Sequence.Concat(_1747_arguments, Dafny.Sequence.FromElements(_1749_lExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1751_recIdentsL); } - RAST._IExpr _out477; - DCOMP._IOwnership _out478; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out477, out _out478); - r = _out477; - resultingOwnership = _out478; - return ; + goto after_match32; } - } - } - if (unmatched74) { - if (_source74.is_IndexRange) { - DAST._IExpression _1739_on = _source74.dtor_expr; - bool _1740_isArray = _source74.dtor_isArray; - Std.Wrappers._IOption _1741_low = _source74.dtor_low; - Std.Wrappers._IOption _1742_high = _source74.dtor_high; - unmatched74 = false; - { - RAST._IExpr _1743_onExpr; - DCOMP._IOwnership _1744_onOwned; - Dafny.ISet> _1745_recIdents; - RAST._IExpr _out479; - DCOMP._IOwnership _out480; - Dafny.ISet> _out481; - (this).GenExpr(_1739_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out479, out _out480, out _out481); - _1743_onExpr = _out479; - _1744_onOwned = _out480; - _1745_recIdents = _out481; - readIdents = _1745_recIdents; - Dafny.ISequence _1746_methodName; - _1746_methodName = (((_1741_low).is_Some) ? ((((_1742_high).is_Some) ? (Dafny.Sequence.UnicodeFromString("slice")) : (Dafny.Sequence.UnicodeFromString("drop")))) : ((((_1742_high).is_Some) ? (Dafny.Sequence.UnicodeFromString("take")) : (Dafny.Sequence.UnicodeFromString(""))))); - Dafny.ISequence _1747_arguments; - _1747_arguments = Dafny.Sequence.FromElements(); - Std.Wrappers._IOption _source76 = _1741_low; - bool unmatched76 = true; - if (unmatched76) { - if (_source76.is_Some) { - DAST._IExpression _1748_l = _source76.dtor_value; - unmatched76 = false; - { - RAST._IExpr _1749_lExpr; - DCOMP._IOwnership _1750___v138; - Dafny.ISet> _1751_recIdentsL; - RAST._IExpr _out482; - DCOMP._IOwnership _out483; - Dafny.ISet> _out484; - (this).GenExpr(_1748_l, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out482, out _out483, out _out484); - _1749_lExpr = _out482; - _1750___v138 = _out483; - _1751_recIdentsL = _out484; - _1747_arguments = Dafny.Sequence.Concat(_1747_arguments, Dafny.Sequence.FromElements(_1749_lExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1751_recIdentsL); - } - } - } - if (unmatched76) { - unmatched76 = false; - } - Std.Wrappers._IOption _source77 = _1742_high; - bool unmatched77 = true; - if (unmatched77) { - if (_source77.is_Some) { - DAST._IExpression _1752_h = _source77.dtor_value; - unmatched77 = false; - { - RAST._IExpr _1753_hExpr; - DCOMP._IOwnership _1754___v139; - Dafny.ISet> _1755_recIdentsH; - RAST._IExpr _out485; - DCOMP._IOwnership _out486; - Dafny.ISet> _out487; - (this).GenExpr(_1752_h, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out485, out _out486, out _out487); - _1753_hExpr = _out485; - _1754___v139 = _out486; - _1755_recIdentsH = _out487; - _1747_arguments = Dafny.Sequence.Concat(_1747_arguments, Dafny.Sequence.FromElements(_1753_hExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1755_recIdentsH); - } - } + after_match32: ; + Std.Wrappers._IOption _source77 = _1742_high; + if (_source77.is_Some) { + DAST._IExpression _1752_h = _source77.dtor_value; + { + RAST._IExpr _1753_hExpr; + DCOMP._IOwnership _1754___v139; + Dafny.ISet> _1755_recIdentsH; + RAST._IExpr _out485; + DCOMP._IOwnership _out486; + Dafny.ISet> _out487; + (this).GenExpr(_1752_h, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out485, out _out486, out _out487); + _1753_hExpr = _out485; + _1754___v139 = _out486; + _1755_recIdentsH = _out487; + _1747_arguments = Dafny.Sequence.Concat(_1747_arguments, Dafny.Sequence.FromElements(_1753_hExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1755_recIdentsH); } - if (unmatched77) { - unmatched77 = false; + goto after_match33; + } + after_match33: ; + r = _1743_onExpr; + if (_1740_isArray) { + if (!(_1746_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { + _1746_methodName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _1746_methodName); } - r = _1743_onExpr; - if (_1740_isArray) { - if (!(_1746_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { - _1746_methodName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _1746_methodName); - } - r = ((RAST.__default.dafny__runtime__Sequence).MSel(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("from_array"), _1746_methodName))).Apply(_1747_arguments); - } else { - if (!(_1746_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { - r = ((r).Sel(_1746_methodName)).Apply(_1747_arguments); - } + r = ((RAST.__default.dafny__runtime__Sequence).MSel(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("from_array"), _1746_methodName))).Apply(_1747_arguments); + } else { + if (!(_1746_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { + r = ((r).Sel(_1746_methodName)).Apply(_1747_arguments); } - RAST._IExpr _out488; - DCOMP._IOwnership _out489; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out488, out _out489); - r = _out488; - resultingOwnership = _out489; - return ; } + RAST._IExpr _out488; + DCOMP._IOwnership _out489; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out488, out _out489); + r = _out488; + resultingOwnership = _out489; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_TupleSelect) { - DAST._IExpression _1756_on = _source74.dtor_expr; - BigInteger _1757_idx = _source74.dtor_index; - DAST._IType _1758_fieldType = _source74.dtor_fieldType; - unmatched74 = false; - { - RAST._IExpr _1759_onExpr; - DCOMP._IOwnership _1760_onOwnership; - Dafny.ISet> _1761_recIdents; - RAST._IExpr _out490; - DCOMP._IOwnership _out491; - Dafny.ISet> _out492; - (this).GenExpr(_1756_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out490, out _out491, out _out492); - _1759_onExpr = _out490; - _1760_onOwnership = _out491; - _1761_recIdents = _out492; - Dafny.ISequence _1762_selName; - _1762_selName = Std.Strings.__default.OfNat(_1757_idx); - DAST._IType _source78 = _1758_fieldType; - bool unmatched78 = true; - if (unmatched78) { - if (_source78.is_Tuple) { - Dafny.ISequence _1763_tps = _source78.dtor_Tuple_a0; - unmatched78 = false; - if (((_1758_fieldType).is_Tuple) && ((new BigInteger((_1763_tps).Count)) > (RAST.__default.MAX__TUPLE__SIZE))) { - _1762_selName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _1762_selName); - } - } - } - if (unmatched78) { - unmatched78 = false; + if (_source74.is_TupleSelect) { + DAST._IExpression _1756_on = _source74.dtor_expr; + BigInteger _1757_idx = _source74.dtor_index; + DAST._IType _1758_fieldType = _source74.dtor_fieldType; + { + RAST._IExpr _1759_onExpr; + DCOMP._IOwnership _1760_onOwnership; + Dafny.ISet> _1761_recIdents; + RAST._IExpr _out490; + DCOMP._IOwnership _out491; + Dafny.ISet> _out492; + (this).GenExpr(_1756_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out490, out _out491, out _out492); + _1759_onExpr = _out490; + _1760_onOwnership = _out491; + _1761_recIdents = _out492; + Dafny.ISequence _1762_selName; + _1762_selName = Std.Strings.__default.OfNat(_1757_idx); + DAST._IType _source78 = _1758_fieldType; + if (_source78.is_Tuple) { + Dafny.ISequence _1763_tps = _source78.dtor_Tuple_a0; + if (((_1758_fieldType).is_Tuple) && ((new BigInteger((_1763_tps).Count)) > (RAST.__default.MAX__TUPLE__SIZE))) { + _1762_selName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _1762_selName); } - r = (_1759_onExpr).Sel(_1762_selName); - RAST._IExpr _out493; - DCOMP._IOwnership _out494; - DCOMP.COMP.FromOwnership(r, _1760_onOwnership, expectedOwnership, out _out493, out _out494); - r = _out493; - resultingOwnership = _out494; - readIdents = _1761_recIdents; - return ; - } + goto after_match34; + } + after_match34: ; + r = (_1759_onExpr).Sel(_1762_selName); + RAST._IExpr _out493; + DCOMP._IOwnership _out494; + DCOMP.COMP.FromOwnership(r, _1760_onOwnership, expectedOwnership, out _out493, out _out494); + r = _out493; + resultingOwnership = _out494; + readIdents = _1761_recIdents; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_Call) { - DAST._IExpression _1764_on = _source74.dtor_on; - DAST._ICallName _1765_name = _source74.dtor_callName; - Dafny.ISequence _1766_typeArgs = _source74.dtor_typeArgs; - Dafny.ISequence _1767_args = _source74.dtor_args; - unmatched74 = false; - { - readIdents = Dafny.Set>.FromElements(); - RAST._IExpr _1768_onExpr; - DCOMP._IOwnership _1769___v141; - Dafny.ISet> _1770_recIdents; - RAST._IExpr _out495; - DCOMP._IOwnership _out496; - Dafny.ISet> _out497; - (this).GenExpr(_1764_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out495, out _out496, out _out497); - _1768_onExpr = _out495; - _1769___v141 = _out496; - _1770_recIdents = _out497; - Dafny.ISequence _1771_typeExprs; - _1771_typeExprs = Dafny.Sequence.FromElements(); - if ((new BigInteger((_1766_typeArgs).Count)) >= (BigInteger.One)) { - BigInteger _hi35 = new BigInteger((_1766_typeArgs).Count); - for (BigInteger _1772_typeI = BigInteger.Zero; _1772_typeI < _hi35; _1772_typeI++) { - RAST._IType _1773_typeExpr; - RAST._IType _out498; - _out498 = (this).GenType((_1766_typeArgs).Select(_1772_typeI), false, false); - _1773_typeExpr = _out498; - _1771_typeExprs = Dafny.Sequence.Concat(_1771_typeExprs, Dafny.Sequence.FromElements(_1773_typeExpr)); - } - } - Dafny.ISequence _1774_argExprs; - _1774_argExprs = Dafny.Sequence.FromElements(); - BigInteger _hi36 = new BigInteger((_1767_args).Count); - for (BigInteger _1775_i = BigInteger.Zero; _1775_i < _hi36; _1775_i++) { - DCOMP._IOwnership _1776_argOwnership; - _1776_argOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); - if (((_1765_name).is_CallName) && ((_1775_i) < (new BigInteger((((_1765_name).dtor_signature)).Count)))) { - RAST._IType _1777_tpe; - RAST._IType _out499; - _out499 = (this).GenType(((((_1765_name).dtor_signature)).Select(_1775_i)).dtor_typ, false, false); - _1777_tpe = _out499; - if ((_1777_tpe).CanReadWithoutClone()) { - _1776_argOwnership = DCOMP.Ownership.create_OwnershipOwned(); - } - } - RAST._IExpr _1778_argExpr; - DCOMP._IOwnership _1779___v142; - Dafny.ISet> _1780_argIdents; - RAST._IExpr _out500; - DCOMP._IOwnership _out501; - Dafny.ISet> _out502; - (this).GenExpr((_1767_args).Select(_1775_i), selfIdent, env, _1776_argOwnership, out _out500, out _out501, out _out502); - _1778_argExpr = _out500; - _1779___v142 = _out501; - _1780_argIdents = _out502; - _1774_argExprs = Dafny.Sequence.Concat(_1774_argExprs, Dafny.Sequence.FromElements(_1778_argExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1780_argIdents); - } - readIdents = Dafny.Set>.Union(readIdents, _1770_recIdents); - Dafny.ISequence _1781_renderedName; - _1781_renderedName = ((System.Func>)(() => { - DAST._ICallName _source79 = _1765_name; - bool unmatched79 = true; - if (unmatched79) { - if (_source79.is_CallName) { - Dafny.ISequence _1782_ident = _source79.dtor_name; - unmatched79 = false; - return DCOMP.__default.escapeName(_1782_ident); - } - } - if (unmatched79) { - bool disjunctiveMatch12 = false; - if (_source79.is_MapBuilderAdd) { - disjunctiveMatch12 = true; - } - if (_source79.is_SetBuilderAdd) { - disjunctiveMatch12 = true; - } - if (disjunctiveMatch12) { - unmatched79 = false; - return Dafny.Sequence.UnicodeFromString("add"); - } - } - if (unmatched79) { - bool disjunctiveMatch13 = false; - disjunctiveMatch13 = true; - disjunctiveMatch13 = true; - if (disjunctiveMatch13) { - unmatched79 = false; - return Dafny.Sequence.UnicodeFromString("build"); - } - } - throw new System.Exception("unexpected control point"); - }))(); - DAST._IExpression _source80 = _1764_on; - bool unmatched80 = true; - if (unmatched80) { - if (_source80.is_Companion) { - unmatched80 = false; - { - _1768_onExpr = (_1768_onExpr).MSel(_1781_renderedName); - } - } + if (_source74.is_Call) { + DAST._IExpression _1764_on = _source74.dtor_on; + DAST._ICallName _1765_name = _source74.dtor_callName; + Dafny.ISequence _1766_typeArgs = _source74.dtor_typeArgs; + Dafny.ISequence _1767_args = _source74.dtor_args; + { + readIdents = Dafny.Set>.FromElements(); + RAST._IExpr _1768_onExpr; + DCOMP._IOwnership _1769___v141; + Dafny.ISet> _1770_recIdents; + RAST._IExpr _out495; + DCOMP._IOwnership _out496; + Dafny.ISet> _out497; + (this).GenExpr(_1764_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out495, out _out496, out _out497); + _1768_onExpr = _out495; + _1769___v141 = _out496; + _1770_recIdents = _out497; + Dafny.ISequence _1771_typeExprs; + _1771_typeExprs = Dafny.Sequence.FromElements(); + if ((new BigInteger((_1766_typeArgs).Count)) >= (BigInteger.One)) { + BigInteger _hi35 = new BigInteger((_1766_typeArgs).Count); + for (BigInteger _1772_typeI = BigInteger.Zero; _1772_typeI < _hi35; _1772_typeI++) { + RAST._IType _1773_typeExpr; + RAST._IType _out498; + _out498 = (this).GenType((_1766_typeArgs).Select(_1772_typeI), false, false); + _1773_typeExpr = _out498; + _1771_typeExprs = Dafny.Sequence.Concat(_1771_typeExprs, Dafny.Sequence.FromElements(_1773_typeExpr)); } - if (unmatched80) { - unmatched80 = false; - { - _1768_onExpr = (_1768_onExpr).Sel(_1781_renderedName); + } + Dafny.ISequence _1774_argExprs; + _1774_argExprs = Dafny.Sequence.FromElements(); + BigInteger _hi36 = new BigInteger((_1767_args).Count); + for (BigInteger _1775_i = BigInteger.Zero; _1775_i < _hi36; _1775_i++) { + DCOMP._IOwnership _1776_argOwnership; + _1776_argOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + if (((_1765_name).is_CallName) && ((_1775_i) < (new BigInteger((((_1765_name).dtor_signature)).Count)))) { + RAST._IType _1777_tpe; + RAST._IType _out499; + _out499 = (this).GenType(((((_1765_name).dtor_signature)).Select(_1775_i)).dtor_typ, false, false); + _1777_tpe = _out499; + if ((_1777_tpe).CanReadWithoutClone()) { + _1776_argOwnership = DCOMP.Ownership.create_OwnershipOwned(); } } - r = _1768_onExpr; - if ((new BigInteger((_1771_typeExprs).Count)).Sign == 1) { - r = (r).ApplyType(_1771_typeExprs); + RAST._IExpr _1778_argExpr; + DCOMP._IOwnership _1779___v142; + Dafny.ISet> _1780_argIdents; + RAST._IExpr _out500; + DCOMP._IOwnership _out501; + Dafny.ISet> _out502; + (this).GenExpr((_1767_args).Select(_1775_i), selfIdent, env, _1776_argOwnership, out _out500, out _out501, out _out502); + _1778_argExpr = _out500; + _1779___v142 = _out501; + _1780_argIdents = _out502; + _1774_argExprs = Dafny.Sequence.Concat(_1774_argExprs, Dafny.Sequence.FromElements(_1778_argExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1780_argIdents); + } + readIdents = Dafny.Set>.Union(readIdents, _1770_recIdents); + Dafny.ISequence _1781_renderedName; + DAST._ICallName _source79 = _1765_name; + if (_source79.is_CallName) { + Dafny.ISequence _1782_ident = _source79.dtor_name; + _1781_renderedName = DCOMP.__default.escapeName(_1782_ident); + goto after_match35; + } + bool disjunctiveMatch11 = false; + if (_source79.is_MapBuilderAdd) { + disjunctiveMatch11 = true; + } + if (_source79.is_SetBuilderAdd) { + disjunctiveMatch11 = true; + } + if (disjunctiveMatch11) { + _1781_renderedName = Dafny.Sequence.UnicodeFromString("add"); + goto after_match35; + } + _1781_renderedName = Dafny.Sequence.UnicodeFromString("build"); + after_match35: ; + DAST._IExpression _source80 = _1764_on; + if (_source80.is_Companion) { + { + _1768_onExpr = (_1768_onExpr).MSel(_1781_renderedName); } - r = (r).Apply(_1774_argExprs); - RAST._IExpr _out503; - DCOMP._IOwnership _out504; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out503, out _out504); - r = _out503; - resultingOwnership = _out504; - return ; + goto after_match36; } + { + _1768_onExpr = (_1768_onExpr).Sel(_1781_renderedName); + } + after_match36: ; + r = _1768_onExpr; + if ((new BigInteger((_1771_typeExprs).Count)).Sign == 1) { + r = (r).ApplyType(_1771_typeExprs); + } + r = (r).Apply(_1774_argExprs); + RAST._IExpr _out503; + DCOMP._IOwnership _out504; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out503, out _out504); + r = _out503; + resultingOwnership = _out504; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_Lambda) { - Dafny.ISequence _1783_paramsDafny = _source74.dtor_params; - DAST._IType _1784_retType = _source74.dtor_retType; - Dafny.ISequence _1785_body = _source74.dtor_body; - unmatched74 = false; - { - Dafny.ISequence _1786_params; - Dafny.ISequence _out505; - _out505 = (this).GenParams(_1783_paramsDafny); - _1786_params = _out505; - Dafny.ISequence> _1787_paramNames; - _1787_paramNames = Dafny.Sequence>.FromElements(); - Dafny.IMap,RAST._IType> _1788_paramTypesMap; - _1788_paramTypesMap = Dafny.Map, RAST._IType>.FromElements(); - BigInteger _hi37 = new BigInteger((_1786_params).Count); - for (BigInteger _1789_i = BigInteger.Zero; _1789_i < _hi37; _1789_i++) { - Dafny.ISequence _1790_name; - _1790_name = ((_1786_params).Select(_1789_i)).dtor_name; - _1787_paramNames = Dafny.Sequence>.Concat(_1787_paramNames, Dafny.Sequence>.FromElements(_1790_name)); - _1788_paramTypesMap = Dafny.Map, RAST._IType>.Update(_1788_paramTypesMap, _1790_name, ((_1786_params).Select(_1789_i)).dtor_tpe); - } - DCOMP._IEnvironment _1791_env; - _1791_env = DCOMP.Environment.create(_1787_paramNames, _1788_paramTypesMap); - RAST._IExpr _1792_recursiveGen; - Dafny.ISet> _1793_recIdents; - DCOMP._IEnvironment _1794___v147; - RAST._IExpr _out506; - Dafny.ISet> _out507; - DCOMP._IEnvironment _out508; - (this).GenStmts(_1785_body, ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) ? (Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("_this"))) : (Std.Wrappers.Option>.create_None())), _1791_env, true, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")), out _out506, out _out507, out _out508); - _1792_recursiveGen = _out506; - _1793_recIdents = _out507; - _1794___v147 = _out508; - readIdents = Dafny.Set>.FromElements(); - _1793_recIdents = Dafny.Set>.Difference(_1793_recIdents, Dafny.Helpers.Id>, Dafny.ISet>>>((_1795_paramNames) => ((System.Func>>)(() => { - var _coll6 = new System.Collections.Generic.List>(); - foreach (Dafny.ISequence _compr_6 in (_1795_paramNames).CloneAsArray()) { - Dafny.ISequence _1796_name = (Dafny.ISequence)_compr_6; - if ((_1795_paramNames).Contains(_1796_name)) { - _coll6.Add(_1796_name); - } - } - return Dafny.Set>.FromCollection(_coll6); - }))())(_1787_paramNames)); - RAST._IExpr _1797_allReadCloned; - _1797_allReadCloned = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); - while (!(_1793_recIdents).Equals(Dafny.Set>.FromElements())) { - Dafny.ISequence _1798_next; - foreach (Dafny.ISequence _assign_such_that_3 in (_1793_recIdents).Elements) { - _1798_next = (Dafny.ISequence)_assign_such_that_3; - if ((_1793_recIdents).Contains(_1798_next)) { - goto after__ASSIGN_SUCH_THAT_3; - } - } - throw new System.Exception("assign-such-that search produced no value (line 3735)"); - after__ASSIGN_SUCH_THAT_3: ; - if ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) && ((_1798_next).Equals(Dafny.Sequence.UnicodeFromString("_this")))) { - if (!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) { - _1797_allReadCloned = (_1797_allReadCloned).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), Dafny.Sequence.UnicodeFromString("_this"), Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.__default.self).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); - } - } else if (!((_1787_paramNames).Contains(_1798_next))) { - _1797_allReadCloned = (_1797_allReadCloned).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), _1798_next, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.Expr.create_Identifier(_1798_next)).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); - readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.FromElements(_1798_next)); + if (_source74.is_Lambda) { + Dafny.ISequence _1783_paramsDafny = _source74.dtor_params; + DAST._IType _1784_retType = _source74.dtor_retType; + Dafny.ISequence _1785_body = _source74.dtor_body; + { + Dafny.ISequence _1786_params; + Dafny.ISequence _out505; + _out505 = (this).GenParams(_1783_paramsDafny); + _1786_params = _out505; + Dafny.ISequence> _1787_paramNames; + _1787_paramNames = Dafny.Sequence>.FromElements(); + Dafny.IMap,RAST._IType> _1788_paramTypesMap; + _1788_paramTypesMap = Dafny.Map, RAST._IType>.FromElements(); + BigInteger _hi37 = new BigInteger((_1786_params).Count); + for (BigInteger _1789_i = BigInteger.Zero; _1789_i < _hi37; _1789_i++) { + Dafny.ISequence _1790_name; + _1790_name = ((_1786_params).Select(_1789_i)).dtor_name; + _1787_paramNames = Dafny.Sequence>.Concat(_1787_paramNames, Dafny.Sequence>.FromElements(_1790_name)); + _1788_paramTypesMap = Dafny.Map, RAST._IType>.Update(_1788_paramTypesMap, _1790_name, ((_1786_params).Select(_1789_i)).dtor_tpe); + } + DCOMP._IEnvironment _1791_env; + _1791_env = DCOMP.Environment.create(_1787_paramNames, _1788_paramTypesMap); + RAST._IExpr _1792_recursiveGen; + Dafny.ISet> _1793_recIdents; + DCOMP._IEnvironment _1794___v147; + RAST._IExpr _out506; + Dafny.ISet> _out507; + DCOMP._IEnvironment _out508; + (this).GenStmts(_1785_body, ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) ? (Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("_this"))) : (Std.Wrappers.Option>.create_None())), _1791_env, true, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")), out _out506, out _out507, out _out508); + _1792_recursiveGen = _out506; + _1793_recIdents = _out507; + _1794___v147 = _out508; + readIdents = Dafny.Set>.FromElements(); + _1793_recIdents = Dafny.Set>.Difference(_1793_recIdents, Dafny.Helpers.Id>, Dafny.ISet>>>((_1795_paramNames) => ((System.Func>>)(() => { + var _coll6 = new System.Collections.Generic.List>(); + foreach (Dafny.ISequence _compr_6 in (_1795_paramNames).CloneAsArray()) { + Dafny.ISequence _1796_name = (Dafny.ISequence)_compr_6; + if ((_1795_paramNames).Contains(_1796_name)) { + _coll6.Add(_1796_name); } - _1793_recIdents = Dafny.Set>.Difference(_1793_recIdents, Dafny.Set>.FromElements(_1798_next)); } - RAST._IType _1799_retTypeGen; - RAST._IType _out509; - _out509 = (this).GenType(_1784_retType, false, true); - _1799_retTypeGen = _out509; - r = RAST.Expr.create_Block((_1797_allReadCloned).Then(RAST.__default.RcNew(RAST.Expr.create_Lambda(_1786_params, Std.Wrappers.Option.create_Some(_1799_retTypeGen), RAST.Expr.create_Block(_1792_recursiveGen))))); - RAST._IExpr _out510; - DCOMP._IOwnership _out511; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out510, out _out511); - r = _out510; - resultingOwnership = _out511; - return ; - } - } - } - if (unmatched74) { - if (_source74.is_BetaRedex) { - Dafny.ISequence<_System._ITuple2> _1800_values = _source74.dtor_values; - DAST._IType _1801_retType = _source74.dtor_retType; - DAST._IExpression _1802_expr = _source74.dtor_expr; - unmatched74 = false; - { - Dafny.ISequence> _1803_paramNames; - _1803_paramNames = Dafny.Sequence>.FromElements(); - Dafny.ISequence _1804_paramFormals; - Dafny.ISequence _out512; - _out512 = (this).GenParams(Std.Collections.Seq.__default.Map<_System._ITuple2, DAST._IFormal>(((System.Func<_System._ITuple2, DAST._IFormal>)((_1805_value) => { - return (_1805_value).dtor__0; - })), _1800_values)); - _1804_paramFormals = _out512; - Dafny.IMap,RAST._IType> _1806_paramTypes; - _1806_paramTypes = Dafny.Map, RAST._IType>.FromElements(); - Dafny.ISet> _1807_paramNamesSet; - _1807_paramNamesSet = Dafny.Set>.FromElements(); - BigInteger _hi38 = new BigInteger((_1800_values).Count); - for (BigInteger _1808_i = BigInteger.Zero; _1808_i < _hi38; _1808_i++) { - Dafny.ISequence _1809_name; - _1809_name = (((_1800_values).Select(_1808_i)).dtor__0).dtor_name; - Dafny.ISequence _1810_rName; - _1810_rName = DCOMP.__default.escapeName(_1809_name); - _1803_paramNames = Dafny.Sequence>.Concat(_1803_paramNames, Dafny.Sequence>.FromElements(_1810_rName)); - _1806_paramTypes = Dafny.Map, RAST._IType>.Update(_1806_paramTypes, _1810_rName, ((_1804_paramFormals).Select(_1808_i)).dtor_tpe); - _1807_paramNamesSet = Dafny.Set>.Union(_1807_paramNamesSet, Dafny.Set>.FromElements(_1810_rName)); + return Dafny.Set>.FromCollection(_coll6); + }))())(_1787_paramNames)); + RAST._IExpr _1797_allReadCloned; + _1797_allReadCloned = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); + while (!(_1793_recIdents).Equals(Dafny.Set>.FromElements())) { + Dafny.ISequence _1798_next; + foreach (Dafny.ISequence _assign_such_that_3 in (_1793_recIdents).Elements) { + _1798_next = (Dafny.ISequence)_assign_such_that_3; + if ((_1793_recIdents).Contains(_1798_next)) { + goto after__ASSIGN_SUCH_THAT_3; + } } - readIdents = Dafny.Set>.FromElements(); - r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); - BigInteger _hi39 = new BigInteger((_1800_values).Count); - for (BigInteger _1811_i = BigInteger.Zero; _1811_i < _hi39; _1811_i++) { - RAST._IType _1812_typeGen; - RAST._IType _out513; - _out513 = (this).GenType((((_1800_values).Select(_1811_i)).dtor__0).dtor_typ, false, true); - _1812_typeGen = _out513; - RAST._IExpr _1813_valueGen; - DCOMP._IOwnership _1814___v148; - Dafny.ISet> _1815_recIdents; - RAST._IExpr _out514; - DCOMP._IOwnership _out515; - Dafny.ISet> _out516; - (this).GenExpr(((_1800_values).Select(_1811_i)).dtor__1, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out514, out _out515, out _out516); - _1813_valueGen = _out514; - _1814___v148 = _out515; - _1815_recIdents = _out516; - r = (r).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), DCOMP.__default.escapeName((((_1800_values).Select(_1811_i)).dtor__0).dtor_name), Std.Wrappers.Option.create_Some(_1812_typeGen), Std.Wrappers.Option.create_Some(_1813_valueGen))); - readIdents = Dafny.Set>.Union(readIdents, _1815_recIdents); + throw new System.Exception("assign-such-that search produced no value (line 3735)"); + after__ASSIGN_SUCH_THAT_3: ; + if ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) && ((_1798_next).Equals(Dafny.Sequence.UnicodeFromString("_this")))) { + if (!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) { + _1797_allReadCloned = (_1797_allReadCloned).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), Dafny.Sequence.UnicodeFromString("_this"), Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.__default.self).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); + } + } else if (!((_1787_paramNames).Contains(_1798_next))) { + _1797_allReadCloned = (_1797_allReadCloned).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), _1798_next, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.Expr.create_Identifier(_1798_next)).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); + readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.FromElements(_1798_next)); } - DCOMP._IEnvironment _1816_newEnv; - _1816_newEnv = DCOMP.Environment.create(_1803_paramNames, _1806_paramTypes); - RAST._IExpr _1817_recGen; - DCOMP._IOwnership _1818_recOwned; - Dafny.ISet> _1819_recIdents; - RAST._IExpr _out517; - DCOMP._IOwnership _out518; - Dafny.ISet> _out519; - (this).GenExpr(_1802_expr, selfIdent, _1816_newEnv, expectedOwnership, out _out517, out _out518, out _out519); - _1817_recGen = _out517; - _1818_recOwned = _out518; - _1819_recIdents = _out519; - readIdents = Dafny.Set>.Difference(_1819_recIdents, _1807_paramNamesSet); - r = RAST.Expr.create_Block((r).Then(_1817_recGen)); - RAST._IExpr _out520; - DCOMP._IOwnership _out521; - DCOMP.COMP.FromOwnership(r, _1818_recOwned, expectedOwnership, out _out520, out _out521); - r = _out520; - resultingOwnership = _out521; - return ; - } + _1793_recIdents = Dafny.Set>.Difference(_1793_recIdents, Dafny.Set>.FromElements(_1798_next)); + } + RAST._IType _1799_retTypeGen; + RAST._IType _out509; + _out509 = (this).GenType(_1784_retType, false, true); + _1799_retTypeGen = _out509; + r = RAST.Expr.create_Block((_1797_allReadCloned).Then(RAST.__default.RcNew(RAST.Expr.create_Lambda(_1786_params, Std.Wrappers.Option.create_Some(_1799_retTypeGen), RAST.Expr.create_Block(_1792_recursiveGen))))); + RAST._IExpr _out510; + DCOMP._IOwnership _out511; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out510, out _out511); + r = _out510; + resultingOwnership = _out511; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_IIFE) { - Dafny.ISequence _1820_name = _source74.dtor_name; - DAST._IType _1821_tpe = _source74.dtor_typ; - DAST._IExpression _1822_value = _source74.dtor_value; - DAST._IExpression _1823_iifeBody = _source74.dtor_iifeBody; - unmatched74 = false; - { - RAST._IExpr _1824_valueGen; - DCOMP._IOwnership _1825___v149; - Dafny.ISet> _1826_recIdents; - RAST._IExpr _out522; - DCOMP._IOwnership _out523; - Dafny.ISet> _out524; - (this).GenExpr(_1822_value, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out522, out _out523, out _out524); - _1824_valueGen = _out522; - _1825___v149 = _out523; - _1826_recIdents = _out524; - readIdents = _1826_recIdents; - RAST._IType _1827_valueTypeGen; - RAST._IType _out525; - _out525 = (this).GenType(_1821_tpe, false, true); - _1827_valueTypeGen = _out525; - RAST._IExpr _1828_bodyGen; - DCOMP._IOwnership _1829___v150; - Dafny.ISet> _1830_bodyIdents; - RAST._IExpr _out526; - DCOMP._IOwnership _out527; - Dafny.ISet> _out528; - (this).GenExpr(_1823_iifeBody, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out526, out _out527, out _out528); - _1828_bodyGen = _out526; - _1829___v150 = _out527; - _1830_bodyIdents = _out528; - readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.Difference(_1830_bodyIdents, Dafny.Set>.FromElements(DCOMP.__default.escapeName((_1820_name))))); - r = RAST.Expr.create_Block((RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), DCOMP.__default.escapeName((_1820_name)), Std.Wrappers.Option.create_Some(_1827_valueTypeGen), Std.Wrappers.Option.create_Some(_1824_valueGen))).Then(_1828_bodyGen)); - RAST._IExpr _out529; - DCOMP._IOwnership _out530; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out529, out _out530); - r = _out529; - resultingOwnership = _out530; - return ; + if (_source74.is_BetaRedex) { + Dafny.ISequence<_System._ITuple2> _1800_values = _source74.dtor_values; + DAST._IType _1801_retType = _source74.dtor_retType; + DAST._IExpression _1802_expr = _source74.dtor_expr; + { + Dafny.ISequence> _1803_paramNames; + _1803_paramNames = Dafny.Sequence>.FromElements(); + Dafny.ISequence _1804_paramFormals; + Dafny.ISequence _out512; + _out512 = (this).GenParams(Std.Collections.Seq.__default.Map<_System._ITuple2, DAST._IFormal>(((System.Func<_System._ITuple2, DAST._IFormal>)((_1805_value) => { + return (_1805_value).dtor__0; + })), _1800_values)); + _1804_paramFormals = _out512; + Dafny.IMap,RAST._IType> _1806_paramTypes; + _1806_paramTypes = Dafny.Map, RAST._IType>.FromElements(); + Dafny.ISet> _1807_paramNamesSet; + _1807_paramNamesSet = Dafny.Set>.FromElements(); + BigInteger _hi38 = new BigInteger((_1800_values).Count); + for (BigInteger _1808_i = BigInteger.Zero; _1808_i < _hi38; _1808_i++) { + Dafny.ISequence _1809_name; + _1809_name = (((_1800_values).Select(_1808_i)).dtor__0).dtor_name; + Dafny.ISequence _1810_rName; + _1810_rName = DCOMP.__default.escapeName(_1809_name); + _1803_paramNames = Dafny.Sequence>.Concat(_1803_paramNames, Dafny.Sequence>.FromElements(_1810_rName)); + _1806_paramTypes = Dafny.Map, RAST._IType>.Update(_1806_paramTypes, _1810_rName, ((_1804_paramFormals).Select(_1808_i)).dtor_tpe); + _1807_paramNamesSet = Dafny.Set>.Union(_1807_paramNamesSet, Dafny.Set>.FromElements(_1810_rName)); } + readIdents = Dafny.Set>.FromElements(); + r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); + BigInteger _hi39 = new BigInteger((_1800_values).Count); + for (BigInteger _1811_i = BigInteger.Zero; _1811_i < _hi39; _1811_i++) { + RAST._IType _1812_typeGen; + RAST._IType _out513; + _out513 = (this).GenType((((_1800_values).Select(_1811_i)).dtor__0).dtor_typ, false, true); + _1812_typeGen = _out513; + RAST._IExpr _1813_valueGen; + DCOMP._IOwnership _1814___v148; + Dafny.ISet> _1815_recIdents; + RAST._IExpr _out514; + DCOMP._IOwnership _out515; + Dafny.ISet> _out516; + (this).GenExpr(((_1800_values).Select(_1811_i)).dtor__1, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out514, out _out515, out _out516); + _1813_valueGen = _out514; + _1814___v148 = _out515; + _1815_recIdents = _out516; + r = (r).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), DCOMP.__default.escapeName((((_1800_values).Select(_1811_i)).dtor__0).dtor_name), Std.Wrappers.Option.create_Some(_1812_typeGen), Std.Wrappers.Option.create_Some(_1813_valueGen))); + readIdents = Dafny.Set>.Union(readIdents, _1815_recIdents); + } + DCOMP._IEnvironment _1816_newEnv; + _1816_newEnv = DCOMP.Environment.create(_1803_paramNames, _1806_paramTypes); + RAST._IExpr _1817_recGen; + DCOMP._IOwnership _1818_recOwned; + Dafny.ISet> _1819_recIdents; + RAST._IExpr _out517; + DCOMP._IOwnership _out518; + Dafny.ISet> _out519; + (this).GenExpr(_1802_expr, selfIdent, _1816_newEnv, expectedOwnership, out _out517, out _out518, out _out519); + _1817_recGen = _out517; + _1818_recOwned = _out518; + _1819_recIdents = _out519; + readIdents = Dafny.Set>.Difference(_1819_recIdents, _1807_paramNamesSet); + r = RAST.Expr.create_Block((r).Then(_1817_recGen)); + RAST._IExpr _out520; + DCOMP._IOwnership _out521; + DCOMP.COMP.FromOwnership(r, _1818_recOwned, expectedOwnership, out _out520, out _out521); + r = _out520; + resultingOwnership = _out521; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_Apply) { - DAST._IExpression _1831_func = _source74.dtor_expr; - Dafny.ISequence _1832_args = _source74.dtor_args; - unmatched74 = false; - { - RAST._IExpr _1833_funcExpr; - DCOMP._IOwnership _1834___v151; - Dafny.ISet> _1835_recIdents; - RAST._IExpr _out531; - DCOMP._IOwnership _out532; - Dafny.ISet> _out533; - (this).GenExpr(_1831_func, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out531, out _out532, out _out533); - _1833_funcExpr = _out531; - _1834___v151 = _out532; - _1835_recIdents = _out533; - readIdents = _1835_recIdents; - Dafny.ISequence _1836_rArgs; - _1836_rArgs = Dafny.Sequence.FromElements(); - BigInteger _hi40 = new BigInteger((_1832_args).Count); - for (BigInteger _1837_i = BigInteger.Zero; _1837_i < _hi40; _1837_i++) { - RAST._IExpr _1838_argExpr; - DCOMP._IOwnership _1839_argOwned; - Dafny.ISet> _1840_argIdents; - RAST._IExpr _out534; - DCOMP._IOwnership _out535; - Dafny.ISet> _out536; - (this).GenExpr((_1832_args).Select(_1837_i), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out534, out _out535, out _out536); - _1838_argExpr = _out534; - _1839_argOwned = _out535; - _1840_argIdents = _out536; - _1836_rArgs = Dafny.Sequence.Concat(_1836_rArgs, Dafny.Sequence.FromElements(_1838_argExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1840_argIdents); - } - r = (_1833_funcExpr).Apply(_1836_rArgs); - RAST._IExpr _out537; - DCOMP._IOwnership _out538; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out537, out _out538); - r = _out537; - resultingOwnership = _out538; - return ; - } + if (_source74.is_IIFE) { + Dafny.ISequence _1820_name = _source74.dtor_name; + DAST._IType _1821_tpe = _source74.dtor_typ; + DAST._IExpression _1822_value = _source74.dtor_value; + DAST._IExpression _1823_iifeBody = _source74.dtor_iifeBody; + { + RAST._IExpr _1824_valueGen; + DCOMP._IOwnership _1825___v149; + Dafny.ISet> _1826_recIdents; + RAST._IExpr _out522; + DCOMP._IOwnership _out523; + Dafny.ISet> _out524; + (this).GenExpr(_1822_value, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out522, out _out523, out _out524); + _1824_valueGen = _out522; + _1825___v149 = _out523; + _1826_recIdents = _out524; + readIdents = _1826_recIdents; + RAST._IType _1827_valueTypeGen; + RAST._IType _out525; + _out525 = (this).GenType(_1821_tpe, false, true); + _1827_valueTypeGen = _out525; + RAST._IExpr _1828_bodyGen; + DCOMP._IOwnership _1829___v150; + Dafny.ISet> _1830_bodyIdents; + RAST._IExpr _out526; + DCOMP._IOwnership _out527; + Dafny.ISet> _out528; + (this).GenExpr(_1823_iifeBody, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out526, out _out527, out _out528); + _1828_bodyGen = _out526; + _1829___v150 = _out527; + _1830_bodyIdents = _out528; + readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.Difference(_1830_bodyIdents, Dafny.Set>.FromElements(DCOMP.__default.escapeName((_1820_name))))); + r = RAST.Expr.create_Block((RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), DCOMP.__default.escapeName((_1820_name)), Std.Wrappers.Option.create_Some(_1827_valueTypeGen), Std.Wrappers.Option.create_Some(_1824_valueGen))).Then(_1828_bodyGen)); + RAST._IExpr _out529; + DCOMP._IOwnership _out530; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out529, out _out530); + r = _out529; + resultingOwnership = _out530; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_TypeTest) { - DAST._IExpression _1841_on = _source74.dtor_on; - Dafny.ISequence> _1842_dType = _source74.dtor_dType; - Dafny.ISequence _1843_variant = _source74.dtor_variant; - unmatched74 = false; - { - RAST._IExpr _1844_exprGen; - DCOMP._IOwnership _1845___v152; - Dafny.ISet> _1846_recIdents; - RAST._IExpr _out539; - DCOMP._IOwnership _out540; - Dafny.ISet> _out541; - (this).GenExpr(_1841_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out539, out _out540, out _out541); - _1844_exprGen = _out539; - _1845___v152 = _out540; - _1846_recIdents = _out541; - RAST._IType _1847_dTypePath; - RAST._IType _out542; - _out542 = DCOMP.COMP.GenPath(_1842_dType); - _1847_dTypePath = _out542; - r = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("matches!"))).Apply(Dafny.Sequence.FromElements(((_1844_exprGen).Sel(Dafny.Sequence.UnicodeFromString("as_ref"))).Apply(Dafny.Sequence.FromElements()), RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(((_1847_dTypePath).MSel(DCOMP.__default.escapeName(_1843_variant)))._ToString(DCOMP.__default.IND), Dafny.Sequence.UnicodeFromString("{ .. }"))))); - RAST._IExpr _out543; - DCOMP._IOwnership _out544; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out543, out _out544); - r = _out543; - resultingOwnership = _out544; - readIdents = _1846_recIdents; - return ; - } + if (_source74.is_Apply) { + DAST._IExpression _1831_func = _source74.dtor_expr; + Dafny.ISequence _1832_args = _source74.dtor_args; + { + RAST._IExpr _1833_funcExpr; + DCOMP._IOwnership _1834___v151; + Dafny.ISet> _1835_recIdents; + RAST._IExpr _out531; + DCOMP._IOwnership _out532; + Dafny.ISet> _out533; + (this).GenExpr(_1831_func, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out531, out _out532, out _out533); + _1833_funcExpr = _out531; + _1834___v151 = _out532; + _1835_recIdents = _out533; + readIdents = _1835_recIdents; + Dafny.ISequence _1836_rArgs; + _1836_rArgs = Dafny.Sequence.FromElements(); + BigInteger _hi40 = new BigInteger((_1832_args).Count); + for (BigInteger _1837_i = BigInteger.Zero; _1837_i < _hi40; _1837_i++) { + RAST._IExpr _1838_argExpr; + DCOMP._IOwnership _1839_argOwned; + Dafny.ISet> _1840_argIdents; + RAST._IExpr _out534; + DCOMP._IOwnership _out535; + Dafny.ISet> _out536; + (this).GenExpr((_1832_args).Select(_1837_i), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out534, out _out535, out _out536); + _1838_argExpr = _out534; + _1839_argOwned = _out535; + _1840_argIdents = _out536; + _1836_rArgs = Dafny.Sequence.Concat(_1836_rArgs, Dafny.Sequence.FromElements(_1838_argExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1840_argIdents); + } + r = (_1833_funcExpr).Apply(_1836_rArgs); + RAST._IExpr _out537; + DCOMP._IOwnership _out538; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out537, out _out538); + r = _out537; + resultingOwnership = _out538; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_BoolBoundedPool) { - unmatched74 = false; - { - r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("[false, true]")); - RAST._IExpr _out545; - DCOMP._IOwnership _out546; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out545, out _out546); - r = _out545; - resultingOwnership = _out546; - readIdents = Dafny.Set>.FromElements(); - return ; - } + if (_source74.is_TypeTest) { + DAST._IExpression _1841_on = _source74.dtor_on; + Dafny.ISequence> _1842_dType = _source74.dtor_dType; + Dafny.ISequence _1843_variant = _source74.dtor_variant; + { + RAST._IExpr _1844_exprGen; + DCOMP._IOwnership _1845___v152; + Dafny.ISet> _1846_recIdents; + RAST._IExpr _out539; + DCOMP._IOwnership _out540; + Dafny.ISet> _out541; + (this).GenExpr(_1841_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out539, out _out540, out _out541); + _1844_exprGen = _out539; + _1845___v152 = _out540; + _1846_recIdents = _out541; + RAST._IType _1847_dTypePath; + RAST._IType _out542; + _out542 = DCOMP.COMP.GenPath(_1842_dType); + _1847_dTypePath = _out542; + r = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("matches!"))).Apply(Dafny.Sequence.FromElements(((_1844_exprGen).Sel(Dafny.Sequence.UnicodeFromString("as_ref"))).Apply(Dafny.Sequence.FromElements()), RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(((_1847_dTypePath).MSel(DCOMP.__default.escapeName(_1843_variant)))._ToString(DCOMP.__default.IND), Dafny.Sequence.UnicodeFromString("{ .. }"))))); + RAST._IExpr _out543; + DCOMP._IOwnership _out544; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out543, out _out544); + r = _out543; + resultingOwnership = _out544; + readIdents = _1846_recIdents; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_SetBoundedPool) { - DAST._IExpression _1848_of = _source74.dtor_of; - unmatched74 = false; - { - RAST._IExpr _1849_exprGen; - DCOMP._IOwnership _1850___v153; - Dafny.ISet> _1851_recIdents; - RAST._IExpr _out547; - DCOMP._IOwnership _out548; - Dafny.ISet> _out549; - (this).GenExpr(_1848_of, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out547, out _out548, out _out549); - _1849_exprGen = _out547; - _1850___v153 = _out548; - _1851_recIdents = _out549; - r = ((((_1849_exprGen).Sel(Dafny.Sequence.UnicodeFromString("iter"))).Apply(Dafny.Sequence.FromElements())).Sel(Dafny.Sequence.UnicodeFromString("cloned"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out550; - DCOMP._IOwnership _out551; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out550, out _out551); - r = _out550; - resultingOwnership = _out551; - readIdents = _1851_recIdents; - return ; - } + if (_source74.is_BoolBoundedPool) { + { + r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("[false, true]")); + RAST._IExpr _out545; + DCOMP._IOwnership _out546; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out545, out _out546); + r = _out545; + resultingOwnership = _out546; + readIdents = Dafny.Set>.FromElements(); + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_SeqBoundedPool) { - DAST._IExpression _1852_of = _source74.dtor_of; - bool _1853_includeDuplicates = _source74.dtor_includeDuplicates; - unmatched74 = false; - { - RAST._IExpr _1854_exprGen; - DCOMP._IOwnership _1855___v154; - Dafny.ISet> _1856_recIdents; - RAST._IExpr _out552; - DCOMP._IOwnership _out553; - Dafny.ISet> _out554; - (this).GenExpr(_1852_of, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out552, out _out553, out _out554); - _1854_exprGen = _out552; - _1855___v154 = _out553; - _1856_recIdents = _out554; - r = ((_1854_exprGen).Sel(Dafny.Sequence.UnicodeFromString("iter"))).Apply(Dafny.Sequence.FromElements()); - if (!(_1853_includeDuplicates)) { - r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("itertools"))).MSel(Dafny.Sequence.UnicodeFromString("Itertools"))).MSel(Dafny.Sequence.UnicodeFromString("unique"))).Apply1(r); - } - RAST._IExpr _out555; - DCOMP._IOwnership _out556; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out555, out _out556); - r = _out555; - resultingOwnership = _out556; - readIdents = _1856_recIdents; - return ; - } + if (_source74.is_SetBoundedPool) { + DAST._IExpression _1848_of = _source74.dtor_of; + { + RAST._IExpr _1849_exprGen; + DCOMP._IOwnership _1850___v153; + Dafny.ISet> _1851_recIdents; + RAST._IExpr _out547; + DCOMP._IOwnership _out548; + Dafny.ISet> _out549; + (this).GenExpr(_1848_of, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out547, out _out548, out _out549); + _1849_exprGen = _out547; + _1850___v153 = _out548; + _1851_recIdents = _out549; + r = ((((_1849_exprGen).Sel(Dafny.Sequence.UnicodeFromString("iter"))).Apply(Dafny.Sequence.FromElements())).Sel(Dafny.Sequence.UnicodeFromString("cloned"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out550; + DCOMP._IOwnership _out551; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out550, out _out551); + r = _out550; + resultingOwnership = _out551; + readIdents = _1851_recIdents; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_IntRange) { - DAST._IExpression _1857_lo = _source74.dtor_lo; - DAST._IExpression _1858_hi = _source74.dtor_hi; - unmatched74 = false; - { - RAST._IExpr _1859_lo; - DCOMP._IOwnership _1860___v155; - Dafny.ISet> _1861_recIdentsLo; - RAST._IExpr _out557; - DCOMP._IOwnership _out558; - Dafny.ISet> _out559; - (this).GenExpr(_1857_lo, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out557, out _out558, out _out559); - _1859_lo = _out557; - _1860___v155 = _out558; - _1861_recIdentsLo = _out559; - RAST._IExpr _1862_hi; - DCOMP._IOwnership _1863___v156; - Dafny.ISet> _1864_recIdentsHi; - RAST._IExpr _out560; - DCOMP._IOwnership _out561; - Dafny.ISet> _out562; - (this).GenExpr(_1858_hi, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out560, out _out561, out _out562); - _1862_hi = _out560; - _1863___v156 = _out561; - _1864_recIdentsHi = _out562; - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("integer_range"))).Apply(Dafny.Sequence.FromElements(_1859_lo, _1862_hi)); - RAST._IExpr _out563; - DCOMP._IOwnership _out564; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out563, out _out564); - r = _out563; - resultingOwnership = _out564; - readIdents = Dafny.Set>.Union(_1861_recIdentsLo, _1864_recIdentsHi); - return ; - } + if (_source74.is_SeqBoundedPool) { + DAST._IExpression _1852_of = _source74.dtor_of; + bool _1853_includeDuplicates = _source74.dtor_includeDuplicates; + { + RAST._IExpr _1854_exprGen; + DCOMP._IOwnership _1855___v154; + Dafny.ISet> _1856_recIdents; + RAST._IExpr _out552; + DCOMP._IOwnership _out553; + Dafny.ISet> _out554; + (this).GenExpr(_1852_of, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out552, out _out553, out _out554); + _1854_exprGen = _out552; + _1855___v154 = _out553; + _1856_recIdents = _out554; + r = ((_1854_exprGen).Sel(Dafny.Sequence.UnicodeFromString("iter"))).Apply(Dafny.Sequence.FromElements()); + if (!(_1853_includeDuplicates)) { + r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("itertools"))).MSel(Dafny.Sequence.UnicodeFromString("Itertools"))).MSel(Dafny.Sequence.UnicodeFromString("unique"))).Apply1(r); + } + RAST._IExpr _out555; + DCOMP._IOwnership _out556; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out555, out _out556); + r = _out555; + resultingOwnership = _out556; + readIdents = _1856_recIdents; + return ; } + goto after_match30; } - if (unmatched74) { - if (_source74.is_MapBuilder) { - DAST._IType _1865_keyType = _source74.dtor_keyType; - DAST._IType _1866_valueType = _source74.dtor_valueType; - unmatched74 = false; - { - RAST._IType _1867_kType; - RAST._IType _out565; - _out565 = (this).GenType(_1865_keyType, false, false); - _1867_kType = _out565; - RAST._IType _1868_vType; - RAST._IType _out566; - _out566 = (this).GenType(_1866_valueType, false, false); - _1868_vType = _out566; - r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder"))).ApplyType(Dafny.Sequence.FromElements(_1867_kType, _1868_vType))).MSel(Dafny.Sequence.UnicodeFromString("new"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out567; - DCOMP._IOwnership _out568; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out567, out _out568); - r = _out567; - resultingOwnership = _out568; - readIdents = Dafny.Set>.FromElements(); - return ; - } + if (_source74.is_IntRange) { + DAST._IExpression _1857_lo = _source74.dtor_lo; + DAST._IExpression _1858_hi = _source74.dtor_hi; + { + RAST._IExpr _1859_lo; + DCOMP._IOwnership _1860___v155; + Dafny.ISet> _1861_recIdentsLo; + RAST._IExpr _out557; + DCOMP._IOwnership _out558; + Dafny.ISet> _out559; + (this).GenExpr(_1857_lo, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out557, out _out558, out _out559); + _1859_lo = _out557; + _1860___v155 = _out558; + _1861_recIdentsLo = _out559; + RAST._IExpr _1862_hi; + DCOMP._IOwnership _1863___v156; + Dafny.ISet> _1864_recIdentsHi; + RAST._IExpr _out560; + DCOMP._IOwnership _out561; + Dafny.ISet> _out562; + (this).GenExpr(_1858_hi, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out560, out _out561, out _out562); + _1862_hi = _out560; + _1863___v156 = _out561; + _1864_recIdentsHi = _out562; + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("integer_range"))).Apply(Dafny.Sequence.FromElements(_1859_lo, _1862_hi)); + RAST._IExpr _out563; + DCOMP._IOwnership _out564; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out563, out _out564); + r = _out563; + resultingOwnership = _out564; + readIdents = Dafny.Set>.Union(_1861_recIdentsLo, _1864_recIdentsHi); + return ; } + goto after_match30; } - if (unmatched74) { - DAST._IType _1869_elemType = _source74.dtor_elemType; - unmatched74 = false; + if (_source74.is_MapBuilder) { + DAST._IType _1865_keyType = _source74.dtor_keyType; + DAST._IType _1866_valueType = _source74.dtor_valueType; { - RAST._IType _1870_eType; - RAST._IType _out569; - _out569 = (this).GenType(_1869_elemType, false, false); - _1870_eType = _out569; + RAST._IType _1867_kType; + RAST._IType _out565; + _out565 = (this).GenType(_1865_keyType, false, false); + _1867_kType = _out565; + RAST._IType _1868_vType; + RAST._IType _out566; + _out566 = (this).GenType(_1866_valueType, false, false); + _1868_vType = _out566; + r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder"))).ApplyType(Dafny.Sequence.FromElements(_1867_kType, _1868_vType))).MSel(Dafny.Sequence.UnicodeFromString("new"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out567; + DCOMP._IOwnership _out568; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out567, out _out568); + r = _out567; + resultingOwnership = _out568; readIdents = Dafny.Set>.FromElements(); - r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder"))).ApplyType(Dafny.Sequence.FromElements(_1870_eType))).MSel(Dafny.Sequence.UnicodeFromString("new"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out570; - DCOMP._IOwnership _out571; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out570, out _out571); - r = _out570; - resultingOwnership = _out571; return ; } + goto after_match30; + } + DAST._IType _1869_elemType = _source74.dtor_elemType; + { + RAST._IType _1870_eType; + RAST._IType _out569; + _out569 = (this).GenType(_1869_elemType, false, false); + _1870_eType = _out569; + readIdents = Dafny.Set>.FromElements(); + r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder"))).ApplyType(Dafny.Sequence.FromElements(_1870_eType))).MSel(Dafny.Sequence.UnicodeFromString("new"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out570; + DCOMP._IOwnership _out571; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out570, out _out571); + r = _out570; + resultingOwnership = _out571; + return ; } + after_match30: ; } public Dafny.ISequence Compile(Dafny.ISequence p) { diff --git a/Source/DafnyCore/GeneratedFromDafny/RAST.cs b/Source/DafnyCore/GeneratedFromDafny/RAST.cs index 06d44a01585..fe12d66eaa9 100644 --- a/Source/DafnyCore/GeneratedFromDafny/RAST.cs +++ b/Source/DafnyCore/GeneratedFromDafny/RAST.cs @@ -53,39 +53,35 @@ public static RAST._IExpr BoxNew(RAST._IExpr content) { public static bool IsImmutableConversion(RAST._IType fromTpe, RAST._IType toTpe) { _System._ITuple2 _source25 = _System.Tuple2.create(fromTpe, toTpe); - bool unmatched25 = true; - if (unmatched25) { - RAST._IType _00 = _source25.dtor__0; - if (_00.is_TypeApp) { - RAST._IType baseName0 = _00.dtor_baseName; - if (baseName0.is_TMemberSelect) { - RAST._IType base0 = baseName0.dtor_base; - if (base0.is_TMemberSelect) { - RAST._IType base1 = base0.dtor_base; - if (base1.is_TIdentifier) { - Dafny.ISequence name0 = base1.dtor_name; - if (object.Equals(name0, Dafny.Sequence.UnicodeFromString(""))) { - Dafny.ISequence name1 = base0.dtor_name; - if (object.Equals(name1, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { - Dafny.ISequence _761_tpe1 = baseName0.dtor_name; - Dafny.ISequence _762_elems1 = _00.dtor_arguments; - RAST._IType _10 = _source25.dtor__1; - if (_10.is_TypeApp) { - RAST._IType baseName1 = _10.dtor_baseName; - if (baseName1.is_TMemberSelect) { - RAST._IType base2 = baseName1.dtor_base; - if (base2.is_TMemberSelect) { - RAST._IType base3 = base2.dtor_base; - if (base3.is_TIdentifier) { - Dafny.ISequence name2 = base3.dtor_name; - if (object.Equals(name2, Dafny.Sequence.UnicodeFromString(""))) { - Dafny.ISequence name3 = base2.dtor_name; - if (object.Equals(name3, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { - Dafny.ISequence _763_tpe2 = baseName1.dtor_name; - Dafny.ISequence _764_elems2 = _10.dtor_arguments; - unmatched25 = false; - return ((_761_tpe1).Equals(_763_tpe2)) && (((((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Set"))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Sequence")))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Multiset")))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Map")))); - } + RAST._IType _00 = _source25.dtor__0; + if (_00.is_TypeApp) { + RAST._IType baseName0 = _00.dtor_baseName; + if (baseName0.is_TMemberSelect) { + RAST._IType base0 = baseName0.dtor_base; + if (base0.is_TMemberSelect) { + RAST._IType base1 = base0.dtor_base; + if (base1.is_TIdentifier) { + Dafny.ISequence name0 = base1.dtor_name; + if (object.Equals(name0, Dafny.Sequence.UnicodeFromString(""))) { + Dafny.ISequence name1 = base0.dtor_name; + if (object.Equals(name1, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { + Dafny.ISequence _761_tpe1 = baseName0.dtor_name; + Dafny.ISequence _762_elems1 = _00.dtor_arguments; + RAST._IType _10 = _source25.dtor__1; + if (_10.is_TypeApp) { + RAST._IType baseName1 = _10.dtor_baseName; + if (baseName1.is_TMemberSelect) { + RAST._IType base2 = baseName1.dtor_base; + if (base2.is_TMemberSelect) { + RAST._IType base3 = base2.dtor_base; + if (base3.is_TIdentifier) { + Dafny.ISequence name2 = base3.dtor_name; + if (object.Equals(name2, Dafny.Sequence.UnicodeFromString(""))) { + Dafny.ISequence name3 = base2.dtor_name; + if (object.Equals(name3, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { + Dafny.ISequence _763_tpe2 = baseName1.dtor_name; + Dafny.ISequence _764_elems2 = _10.dtor_arguments; + return ((_761_tpe1).Equals(_763_tpe2)) && (((((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Set"))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Sequence")))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Multiset")))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Map")))); } } } @@ -98,11 +94,7 @@ public static bool IsImmutableConversion(RAST._IType fromTpe, RAST._IType toTpe) } } } - if (unmatched25) { - unmatched25 = false; - return false; - } - throw new System.Exception("unexpected control point"); + return false; } public static RAST._IType SystemTupleType(Dafny.ISequence elements) { return (((RAST.__default.super__type).MSel(Dafny.Sequence.UnicodeFromString("_System"))).MSel(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("Tuple"), Std.Strings.__default.OfNat(new BigInteger((elements).Count))))).Apply(elements); @@ -331,23 +323,15 @@ public Dafny.ISequence dtor_body { var _pat_let_tv25 = ind; var _pat_let_tv26 = ind; RAST._IMod _source26 = this; - bool unmatched26 = true; - if (unmatched26) { - if (_source26.is_ExternMod) { - Dafny.ISequence _768_name = _source26.dtor_name; - unmatched26 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _768_name), Dafny.Sequence.UnicodeFromString(";")); - } + if (_source26.is_ExternMod) { + Dafny.ISequence _768_name = _source26.dtor_name; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _768_name), Dafny.Sequence.UnicodeFromString(";")); } - if (unmatched26) { - Dafny.ISequence _769_name = _source26.dtor_name; - Dafny.ISequence _770_body = _source26.dtor_body; - unmatched26 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _769_name), Dafny.Sequence.UnicodeFromString(" {")), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv23), RAST.__default.IND), RAST.__default.SeqToString(_770_body, Dafny.Helpers.Id, Func>>>((_771_ind) => ((System.Func>)((_772_modDecl) => { - return (_772_modDecl)._ToString(Dafny.Sequence.Concat(_771_ind, RAST.__default.IND)); - })))(_pat_let_tv24), Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n\n"), _pat_let_tv25), RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv26), Dafny.Sequence.UnicodeFromString("}")); - } - throw new System.Exception("unexpected control point"); + Dafny.ISequence _769_name = _source26.dtor_name; + Dafny.ISequence _770_body = _source26.dtor_body; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _769_name), Dafny.Sequence.UnicodeFromString(" {")), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv23), RAST.__default.IND), RAST.__default.SeqToString(_770_body, Dafny.Helpers.Id, Func>>>((_771_ind) => ((System.Func>)((_772_modDecl) => { + return (_772_modDecl)._ToString(Dafny.Sequence.Concat(_771_ind, RAST.__default.IND)); + })))(_pat_let_tv24), Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n\n"), _pat_let_tv25), RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv26), Dafny.Sequence.UnicodeFromString("}")); } } public class Mod_Mod : Mod { @@ -1561,162 +1545,94 @@ public bool CanReadWithoutClone() { var _pat_let_tv37 = ind; var _pat_let_tv38 = ind; RAST._IType _source27 = this; - bool unmatched27 = true; - if (unmatched27) { - if (_source27.is_Bool) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("bool"); - } - } - if (unmatched27) { - if (_source27.is_TIdentifier) { - Dafny.ISequence _793_underlying = _source27.dtor_name; - unmatched27 = false; - return _793_underlying; - } - } - if (unmatched27) { - if (_source27.is_TMemberSelect) { - RAST._IType _794_underlying = _source27.dtor_base; - Dafny.ISequence _795_name = _source27.dtor_name; - unmatched27 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_794_underlying)._ToString(_pat_let_tv27), Dafny.Sequence.UnicodeFromString("::")), _795_name); - } - } - if (unmatched27) { - if (_source27.is_Borrowed) { - RAST._IType _796_underlying = _source27.dtor_underlying; - unmatched27 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&"), (_796_underlying)._ToString(_pat_let_tv28)); - } - } - if (unmatched27) { - if (_source27.is_BorrowedMut) { - RAST._IType _797_underlying = _source27.dtor_underlying; - unmatched27 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&mut "), (_797_underlying)._ToString(_pat_let_tv29)); - } - } - if (unmatched27) { - if (_source27.is_ImplType) { - RAST._IType _798_underlying = _source27.dtor_underlying; - unmatched27 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("impl "), (_798_underlying)._ToString(_pat_let_tv30)); - } - } - if (unmatched27) { - if (_source27.is_DynType) { - RAST._IType _799_underlying = _source27.dtor_underlying; - unmatched27 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("dyn "), (_799_underlying)._ToString(_pat_let_tv31)); - } - } - if (unmatched27) { - if (_source27.is_FnType) { - Dafny.ISequence _800_arguments = _source27.dtor_arguments; - RAST._IType _801_returnType = _source27.dtor_returnType; - unmatched27 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Fn("), RAST.__default.SeqToString(_800_arguments, Dafny.Helpers.Id, Func>>>((_802_ind) => ((System.Func>)((_803_arg) => { - return (_803_arg)._ToString(Dafny.Sequence.Concat(_802_ind, RAST.__default.IND)); - })))(_pat_let_tv32), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(") -> ")), (_801_returnType)._ToString(Dafny.Sequence.Concat(_pat_let_tv33, RAST.__default.IND))); - } - } - if (unmatched27) { - if (_source27.is_IntersectionType) { - RAST._IType _804_left = _source27.dtor_left; - RAST._IType _805_right = _source27.dtor_right; - unmatched27 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_804_left)._ToString(_pat_let_tv34), Dafny.Sequence.UnicodeFromString(" + ")), (_805_right)._ToString(_pat_let_tv35)); - } - } - if (unmatched27) { - if (_source27.is_TupleType) { - Dafny.ISequence _806_args = _source27.dtor_arguments; - unmatched27 = false; - if ((_806_args).Equals(Dafny.Sequence.FromElements())) { - return Dafny.Sequence.UnicodeFromString("()"); - } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_806_args, Dafny.Helpers.Id, Func>>>((_807_ind) => ((System.Func>)((_808_arg) => { - return (_808_arg)._ToString(Dafny.Sequence.Concat(_807_ind, RAST.__default.IND)); - })))(_pat_let_tv36), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")); - } - } - } - if (unmatched27) { - if (_source27.is_TypeApp) { - RAST._IType _809_base = _source27.dtor_baseName; - Dafny.ISequence _810_args = _source27.dtor_arguments; - unmatched27 = false; - return Dafny.Sequence.Concat((_809_base)._ToString(_pat_let_tv37), (((_810_args).Equals(Dafny.Sequence.FromElements())) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), RAST.__default.SeqToString(_810_args, Dafny.Helpers.Id, Func>>>((_811_ind) => ((System.Func>)((_812_arg) => { - return (_812_arg)._ToString(Dafny.Sequence.Concat(_811_ind, RAST.__default.IND)); - })))(_pat_let_tv38), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">"))))); + if (_source27.is_Bool) { + return Dafny.Sequence.UnicodeFromString("bool"); + } + if (_source27.is_TIdentifier) { + Dafny.ISequence _793_underlying = _source27.dtor_name; + return _793_underlying; + } + if (_source27.is_TMemberSelect) { + RAST._IType _794_underlying = _source27.dtor_base; + Dafny.ISequence _795_name = _source27.dtor_name; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_794_underlying)._ToString(_pat_let_tv27), Dafny.Sequence.UnicodeFromString("::")), _795_name); + } + if (_source27.is_Borrowed) { + RAST._IType _796_underlying = _source27.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&"), (_796_underlying)._ToString(_pat_let_tv28)); + } + if (_source27.is_BorrowedMut) { + RAST._IType _797_underlying = _source27.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&mut "), (_797_underlying)._ToString(_pat_let_tv29)); + } + if (_source27.is_ImplType) { + RAST._IType _798_underlying = _source27.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("impl "), (_798_underlying)._ToString(_pat_let_tv30)); + } + if (_source27.is_DynType) { + RAST._IType _799_underlying = _source27.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("dyn "), (_799_underlying)._ToString(_pat_let_tv31)); + } + if (_source27.is_FnType) { + Dafny.ISequence _800_arguments = _source27.dtor_arguments; + RAST._IType _801_returnType = _source27.dtor_returnType; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Fn("), RAST.__default.SeqToString(_800_arguments, Dafny.Helpers.Id, Func>>>((_802_ind) => ((System.Func>)((_803_arg) => { + return (_803_arg)._ToString(Dafny.Sequence.Concat(_802_ind, RAST.__default.IND)); + })))(_pat_let_tv32), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(") -> ")), (_801_returnType)._ToString(Dafny.Sequence.Concat(_pat_let_tv33, RAST.__default.IND))); + } + if (_source27.is_IntersectionType) { + RAST._IType _804_left = _source27.dtor_left; + RAST._IType _805_right = _source27.dtor_right; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_804_left)._ToString(_pat_let_tv34), Dafny.Sequence.UnicodeFromString(" + ")), (_805_right)._ToString(_pat_let_tv35)); + } + if (_source27.is_TupleType) { + Dafny.ISequence _806_args = _source27.dtor_arguments; + if ((_806_args).Equals(Dafny.Sequence.FromElements())) { + return Dafny.Sequence.UnicodeFromString("()"); + } else { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_806_args, Dafny.Helpers.Id, Func>>>((_807_ind) => ((System.Func>)((_808_arg) => { + return (_808_arg)._ToString(Dafny.Sequence.Concat(_807_ind, RAST.__default.IND)); + })))(_pat_let_tv36), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")); } } - if (unmatched27) { - if (_source27.is_SelfOwned) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("Self"); - } + if (_source27.is_TypeApp) { + RAST._IType _809_base = _source27.dtor_baseName; + Dafny.ISequence _810_args = _source27.dtor_arguments; + return Dafny.Sequence.Concat((_809_base)._ToString(_pat_let_tv37), (((_810_args).Equals(Dafny.Sequence.FromElements())) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), RAST.__default.SeqToString(_810_args, Dafny.Helpers.Id, Func>>>((_811_ind) => ((System.Func>)((_812_arg) => { + return (_812_arg)._ToString(Dafny.Sequence.Concat(_811_ind, RAST.__default.IND)); + })))(_pat_let_tv38), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">"))))); } - if (unmatched27) { - if (_source27.is_U8) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("u8"); - } + if (_source27.is_SelfOwned) { + return Dafny.Sequence.UnicodeFromString("Self"); } - if (unmatched27) { - if (_source27.is_U16) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("u16"); - } + if (_source27.is_U8) { + return Dafny.Sequence.UnicodeFromString("u8"); } - if (unmatched27) { - if (_source27.is_U32) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("u32"); - } + if (_source27.is_U16) { + return Dafny.Sequence.UnicodeFromString("u16"); } - if (unmatched27) { - if (_source27.is_U64) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("u64"); - } + if (_source27.is_U32) { + return Dafny.Sequence.UnicodeFromString("u32"); } - if (unmatched27) { - if (_source27.is_U128) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("u128"); - } + if (_source27.is_U64) { + return Dafny.Sequence.UnicodeFromString("u64"); } - if (unmatched27) { - if (_source27.is_I8) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("i8"); - } + if (_source27.is_U128) { + return Dafny.Sequence.UnicodeFromString("u128"); } - if (unmatched27) { - if (_source27.is_I16) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("i16"); - } + if (_source27.is_I8) { + return Dafny.Sequence.UnicodeFromString("i8"); } - if (unmatched27) { - if (_source27.is_I32) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("i32"); - } + if (_source27.is_I16) { + return Dafny.Sequence.UnicodeFromString("i16"); } - if (unmatched27) { - if (_source27.is_I64) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("i64"); - } + if (_source27.is_I32) { + return Dafny.Sequence.UnicodeFromString("i32"); } - if (unmatched27) { - unmatched27 = false; - return Dafny.Sequence.UnicodeFromString("i128"); + if (_source27.is_I64) { + return Dafny.Sequence.UnicodeFromString("i64"); } - throw new System.Exception("unexpected control point"); + return Dafny.Sequence.UnicodeFromString("i128"); } public RAST._IType MSel(Dafny.ISequence name) { return RAST.Type.create_TMemberSelect(this, name); @@ -1729,27 +1645,16 @@ public RAST._IType Apply(Dafny.ISequence args) { } public RAST._IType ToOwned() { RAST._IType _source28 = this; - bool unmatched28 = true; - if (unmatched28) { - if (_source28.is_Borrowed) { - RAST._IType _813_x = _source28.dtor_underlying; - unmatched28 = false; - return _813_x; - } + if (_source28.is_Borrowed) { + RAST._IType _813_x = _source28.dtor_underlying; + return _813_x; } - if (unmatched28) { - if (_source28.is_BorrowedMut) { - RAST._IType _814_x = _source28.dtor_underlying; - unmatched28 = false; - return _814_x; - } + if (_source28.is_BorrowedMut) { + RAST._IType _814_x = _source28.dtor_underlying; + return _814_x; } - if (unmatched28) { - RAST._IType _815_x = _source28; - unmatched28 = false; - return _815_x; - } - throw new System.Exception("unexpected control point"); + RAST._IType _815_x = _source28; + return _815_x; } } public class Type_SelfOwned : Type { @@ -4048,197 +3953,159 @@ public bool NoExtraSemicolonAfter() { } public RAST._IExpr Optimize() { RAST._IExpr _source29 = this; - bool unmatched29 = true; - if (unmatched29) { - if (_source29.is_UnaryOp) { - Dafny.ISequence op10 = _source29.dtor_op1; - if (object.Equals(op10, Dafny.Sequence.UnicodeFromString("&"))) { - RAST._IExpr underlying0 = _source29.dtor_underlying; - if (underlying0.is_Call) { - RAST._IExpr obj0 = underlying0.dtor_obj; - if (obj0.is_Select) { - RAST._IExpr _822_underlying = obj0.dtor_obj; - Dafny.ISequence name4 = obj0.dtor_name; - if (object.Equals(name4, Dafny.Sequence.UnicodeFromString("clone"))) { - Dafny.ISequence _823_args = underlying0.dtor_arguments; - DAST.Format._IUnaryOpFormat _824_format = _source29.dtor_format; - unmatched29 = false; - if ((_823_args).Equals(Dafny.Sequence.FromElements())) { - return RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("&"), _822_underlying, _824_format); - } else { - return this; - } + if (_source29.is_UnaryOp) { + Dafny.ISequence op10 = _source29.dtor_op1; + if (object.Equals(op10, Dafny.Sequence.UnicodeFromString("&"))) { + RAST._IExpr underlying0 = _source29.dtor_underlying; + if (underlying0.is_Call) { + RAST._IExpr obj0 = underlying0.dtor_obj; + if (obj0.is_Select) { + RAST._IExpr _822_underlying = obj0.dtor_obj; + Dafny.ISequence name4 = obj0.dtor_name; + if (object.Equals(name4, Dafny.Sequence.UnicodeFromString("clone"))) { + Dafny.ISequence _823_args = underlying0.dtor_arguments; + DAST.Format._IUnaryOpFormat _824_format = _source29.dtor_format; + if ((_823_args).Equals(Dafny.Sequence.FromElements())) { + return RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("&"), _822_underlying, _824_format); + } else { + return this; } } } } } } - if (unmatched29) { - if (_source29.is_UnaryOp) { - Dafny.ISequence op11 = _source29.dtor_op1; - if (object.Equals(op11, Dafny.Sequence.UnicodeFromString("!"))) { - RAST._IExpr underlying1 = _source29.dtor_underlying; - if (underlying1.is_BinaryOp) { - Dafny.ISequence op20 = underlying1.dtor_op2; - if (object.Equals(op20, Dafny.Sequence.UnicodeFromString("=="))) { - RAST._IExpr _825_left = underlying1.dtor_left; - RAST._IExpr _826_right = underlying1.dtor_right; - DAST.Format._IBinaryOpFormat _827_format = underlying1.dtor_format2; - DAST.Format._IUnaryOpFormat format0 = _source29.dtor_format; - if (format0.is_CombineFormat) { - unmatched29 = false; - return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("!="), _825_left, _826_right, DAST.Format.BinaryOpFormat.create_NoFormat()); - } + if (_source29.is_UnaryOp) { + Dafny.ISequence op11 = _source29.dtor_op1; + if (object.Equals(op11, Dafny.Sequence.UnicodeFromString("!"))) { + RAST._IExpr underlying1 = _source29.dtor_underlying; + if (underlying1.is_BinaryOp) { + Dafny.ISequence op20 = underlying1.dtor_op2; + if (object.Equals(op20, Dafny.Sequence.UnicodeFromString("=="))) { + RAST._IExpr _825_left = underlying1.dtor_left; + RAST._IExpr _826_right = underlying1.dtor_right; + DAST.Format._IBinaryOpFormat _827_format = underlying1.dtor_format2; + DAST.Format._IUnaryOpFormat format0 = _source29.dtor_format; + if (format0.is_CombineFormat) { + return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("!="), _825_left, _826_right, DAST.Format.BinaryOpFormat.create_NoFormat()); } } } } } - if (unmatched29) { - if (_source29.is_UnaryOp) { - Dafny.ISequence op12 = _source29.dtor_op1; - if (object.Equals(op12, Dafny.Sequence.UnicodeFromString("!"))) { - RAST._IExpr underlying2 = _source29.dtor_underlying; - if (underlying2.is_BinaryOp) { - Dafny.ISequence op21 = underlying2.dtor_op2; - if (object.Equals(op21, Dafny.Sequence.UnicodeFromString("<"))) { - RAST._IExpr _828_left = underlying2.dtor_left; - RAST._IExpr _829_right = underlying2.dtor_right; - DAST.Format._IBinaryOpFormat format20 = underlying2.dtor_format2; - if (format20.is_NoFormat) { - DAST.Format._IUnaryOpFormat format1 = _source29.dtor_format; - if (format1.is_CombineFormat) { - unmatched29 = false; - return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString(">="), _828_left, _829_right, DAST.Format.BinaryOpFormat.create_NoFormat()); - } + if (_source29.is_UnaryOp) { + Dafny.ISequence op12 = _source29.dtor_op1; + if (object.Equals(op12, Dafny.Sequence.UnicodeFromString("!"))) { + RAST._IExpr underlying2 = _source29.dtor_underlying; + if (underlying2.is_BinaryOp) { + Dafny.ISequence op21 = underlying2.dtor_op2; + if (object.Equals(op21, Dafny.Sequence.UnicodeFromString("<"))) { + RAST._IExpr _828_left = underlying2.dtor_left; + RAST._IExpr _829_right = underlying2.dtor_right; + DAST.Format._IBinaryOpFormat format20 = underlying2.dtor_format2; + if (format20.is_NoFormat) { + DAST.Format._IUnaryOpFormat format1 = _source29.dtor_format; + if (format1.is_CombineFormat) { + return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString(">="), _828_left, _829_right, DAST.Format.BinaryOpFormat.create_NoFormat()); } } } } } } - if (unmatched29) { - if (_source29.is_UnaryOp) { - Dafny.ISequence op13 = _source29.dtor_op1; - if (object.Equals(op13, Dafny.Sequence.UnicodeFromString("!"))) { - RAST._IExpr underlying3 = _source29.dtor_underlying; - if (underlying3.is_BinaryOp) { - Dafny.ISequence op22 = underlying3.dtor_op2; - if (object.Equals(op22, Dafny.Sequence.UnicodeFromString("<"))) { - RAST._IExpr _830_left = underlying3.dtor_left; - RAST._IExpr _831_right = underlying3.dtor_right; - DAST.Format._IBinaryOpFormat format21 = underlying3.dtor_format2; - if (format21.is_ReverseFormat) { - DAST.Format._IUnaryOpFormat format2 = _source29.dtor_format; - if (format2.is_CombineFormat) { - unmatched29 = false; - return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _831_right, _830_left, DAST.Format.BinaryOpFormat.create_NoFormat()); - } + if (_source29.is_UnaryOp) { + Dafny.ISequence op13 = _source29.dtor_op1; + if (object.Equals(op13, Dafny.Sequence.UnicodeFromString("!"))) { + RAST._IExpr underlying3 = _source29.dtor_underlying; + if (underlying3.is_BinaryOp) { + Dafny.ISequence op22 = underlying3.dtor_op2; + if (object.Equals(op22, Dafny.Sequence.UnicodeFromString("<"))) { + RAST._IExpr _830_left = underlying3.dtor_left; + RAST._IExpr _831_right = underlying3.dtor_right; + DAST.Format._IBinaryOpFormat format21 = underlying3.dtor_format2; + if (format21.is_ReverseFormat) { + DAST.Format._IUnaryOpFormat format2 = _source29.dtor_format; + if (format2.is_CombineFormat) { + return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _831_right, _830_left, DAST.Format.BinaryOpFormat.create_NoFormat()); } } } } } } - if (unmatched29) { - if (_source29.is_Call) { - RAST._IExpr obj1 = _source29.dtor_obj; - if (obj1.is_MemberSelect) { - RAST._IExpr _832_r = obj1.dtor_obj; - Dafny.ISequence name5 = obj1.dtor_name; - if (object.Equals(name5, Dafny.Sequence.UnicodeFromString("truncate!"))) { - Dafny.ISequence _833_args = _source29.dtor_arguments; - unmatched29 = false; - if (((!object.Equals(_832_r, RAST.__default.dafny__runtime)) && (!object.Equals(_832_r, RAST.__default.@global))) || ((new BigInteger((_833_args).Count)) != (new BigInteger(2)))) { + if (_source29.is_Call) { + RAST._IExpr obj1 = _source29.dtor_obj; + if (obj1.is_MemberSelect) { + RAST._IExpr _832_r = obj1.dtor_obj; + Dafny.ISequence name5 = obj1.dtor_name; + if (object.Equals(name5, Dafny.Sequence.UnicodeFromString("truncate!"))) { + Dafny.ISequence _833_args = _source29.dtor_arguments; + if (((!object.Equals(_832_r, RAST.__default.dafny__runtime)) && (!object.Equals(_832_r, RAST.__default.@global))) || ((new BigInteger((_833_args).Count)) != (new BigInteger(2)))) { + return this; + } else { + RAST._IExpr _834_expr = (_833_args).Select(BigInteger.Zero); + RAST._IExpr _835_tpeExpr = (_833_args).Select(BigInteger.One); + if (!((_835_tpeExpr).is_ExprFromType)) { return this; } else { - RAST._IExpr _834_expr = (_833_args).Select(BigInteger.Zero); - RAST._IExpr _835_tpeExpr = (_833_args).Select(BigInteger.One); - if (!((_835_tpeExpr).is_ExprFromType)) { - return this; - } else { - RAST._IType _836_tpe = (_835_tpeExpr).dtor_tpe; - if (((((((((((_836_tpe).is_U8) || ((_836_tpe).is_U16)) || ((_836_tpe).is_U32)) || ((_836_tpe).is_U64)) || ((_836_tpe).is_U128)) || ((_836_tpe).is_I8)) || ((_836_tpe).is_I16)) || ((_836_tpe).is_I32)) || ((_836_tpe).is_I64)) || ((_836_tpe).is_I128)) { - RAST._IExpr _source30 = _834_expr; - bool unmatched30 = true; - if (unmatched30) { - if (_source30.is_Call) { - RAST._IExpr obj2 = _source30.dtor_obj; - if (obj2.is_MemberSelect) { - RAST._IExpr _837_base = obj2.dtor_obj; - Dafny.ISequence name6 = obj2.dtor_name; - if (object.Equals(name6, Dafny.Sequence.UnicodeFromString("int!"))) { - Dafny.ISequence _838_args = _source30.dtor_arguments; - unmatched30 = false; - if (((new BigInteger((_838_args).Count)) == (BigInteger.One)) && ((object.Equals(_837_base, RAST.__default.dafny__runtime)) || (object.Equals(_837_base, RAST.__default.@global)))) { - RAST._IExpr _source31 = (_838_args).Select(BigInteger.Zero); - bool unmatched31 = true; - if (unmatched31) { - if (_source31.is_LiteralInt) { - Dafny.ISequence _839_number = _source31.dtor_value; - unmatched31 = false; - return RAST.Expr.create_LiteralInt(_839_number); - } - } - if (unmatched31) { - if (_source31.is_LiteralString) { - Dafny.ISequence _840_number = _source31.dtor_value; - unmatched31 = false; - return RAST.Expr.create_LiteralInt(_840_number); - } - } - if (unmatched31) { - unmatched31 = false; - return this; - } - throw new System.Exception("unexpected control point"); - } else { - return this; - } + RAST._IType _836_tpe = (_835_tpeExpr).dtor_tpe; + if (((((((((((_836_tpe).is_U8) || ((_836_tpe).is_U16)) || ((_836_tpe).is_U32)) || ((_836_tpe).is_U64)) || ((_836_tpe).is_U128)) || ((_836_tpe).is_I8)) || ((_836_tpe).is_I16)) || ((_836_tpe).is_I32)) || ((_836_tpe).is_I64)) || ((_836_tpe).is_I128)) { + RAST._IExpr _source30 = _834_expr; + if (_source30.is_Call) { + RAST._IExpr obj2 = _source30.dtor_obj; + if (obj2.is_MemberSelect) { + RAST._IExpr _837_base = obj2.dtor_obj; + Dafny.ISequence name6 = obj2.dtor_name; + if (object.Equals(name6, Dafny.Sequence.UnicodeFromString("int!"))) { + Dafny.ISequence _838_args = _source30.dtor_arguments; + if (((new BigInteger((_838_args).Count)) == (BigInteger.One)) && ((object.Equals(_837_base, RAST.__default.dafny__runtime)) || (object.Equals(_837_base, RAST.__default.@global)))) { + RAST._IExpr _source31 = (_838_args).Select(BigInteger.Zero); + if (_source31.is_LiteralInt) { + Dafny.ISequence _839_number = _source31.dtor_value; + return RAST.Expr.create_LiteralInt(_839_number); } + if (_source31.is_LiteralString) { + Dafny.ISequence _840_number = _source31.dtor_value; + return RAST.Expr.create_LiteralInt(_840_number); + } + return this; + } else { + return this; } } } - if (unmatched30) { - unmatched30 = false; - return this; - } - throw new System.Exception("unexpected control point"); - } else { - return this; } + return this; + } else { + return this; } } } } } } - if (unmatched29) { - if (_source29.is_StmtExpr) { - RAST._IExpr stmt0 = _source29.dtor_stmt; - if (stmt0.is_DeclareVar) { - RAST._IDeclareType _841_mod = stmt0.dtor_declareType; - Dafny.ISequence _842_name = stmt0.dtor_name; - Std.Wrappers._IOption optType0 = stmt0.dtor_optType; - if (optType0.is_Some) { - RAST._IType _843_tpe = optType0.dtor_value; - Std.Wrappers._IOption optRhs0 = stmt0.dtor_optRhs; - if (optRhs0.is_None) { - RAST._IExpr rhs0 = _source29.dtor_rhs; - if (rhs0.is_StmtExpr) { - RAST._IExpr stmt1 = rhs0.dtor_stmt; - if (stmt1.is_Assign) { - Std.Wrappers._IOption _844_name2 = stmt1.dtor_names; - RAST._IExpr _845_rhs = stmt1.dtor_rhs; - RAST._IExpr _846_last = rhs0.dtor_rhs; - unmatched29 = false; - if (object.Equals(_844_name2, Std.Wrappers.Option.create_Some(RAST.AssignLhs.create_LocalVar(_842_name)))) { - RAST._IExpr _847_rewriting = RAST.Expr.create_StmtExpr(RAST.Expr.create_DeclareVar(_841_mod, _842_name, Std.Wrappers.Option.create_Some(_843_tpe), Std.Wrappers.Option.create_Some(_845_rhs)), _846_last); - return _847_rewriting; - } else { - return this; - } + if (_source29.is_StmtExpr) { + RAST._IExpr stmt0 = _source29.dtor_stmt; + if (stmt0.is_DeclareVar) { + RAST._IDeclareType _841_mod = stmt0.dtor_declareType; + Dafny.ISequence _842_name = stmt0.dtor_name; + Std.Wrappers._IOption optType0 = stmt0.dtor_optType; + if (optType0.is_Some) { + RAST._IType _843_tpe = optType0.dtor_value; + Std.Wrappers._IOption optRhs0 = stmt0.dtor_optRhs; + if (optRhs0.is_None) { + RAST._IExpr rhs0 = _source29.dtor_rhs; + if (rhs0.is_StmtExpr) { + RAST._IExpr stmt1 = rhs0.dtor_stmt; + if (stmt1.is_Assign) { + Std.Wrappers._IOption _844_name2 = stmt1.dtor_names; + RAST._IExpr _845_rhs = stmt1.dtor_rhs; + RAST._IExpr _846_last = rhs0.dtor_rhs; + if (object.Equals(_844_name2, Std.Wrappers.Option.create_Some(RAST.AssignLhs.create_LocalVar(_842_name)))) { + RAST._IExpr _847_rewriting = RAST.Expr.create_StmtExpr(RAST.Expr.create_DeclareVar(_841_mod, _842_name, Std.Wrappers.Option.create_Some(_843_tpe), Std.Wrappers.Option.create_Some(_845_rhs)), _846_last); + return _847_rewriting; + } else { + return this; } } } @@ -4246,35 +4113,32 @@ public RAST._IExpr Optimize() { } } } - if (unmatched29) { - if (_source29.is_StmtExpr) { - RAST._IExpr stmt2 = _source29.dtor_stmt; - if (stmt2.is_IfExpr) { - RAST._IExpr cond0 = stmt2.dtor_cond; - if (cond0.is_UnaryOp) { - Dafny.ISequence op14 = cond0.dtor_op1; - if (object.Equals(op14, Dafny.Sequence.UnicodeFromString("!"))) { - RAST._IExpr underlying4 = cond0.dtor_underlying; - if (underlying4.is_BinaryOp) { - Dafny.ISequence op23 = underlying4.dtor_op2; - if (object.Equals(op23, Dafny.Sequence.UnicodeFromString("=="))) { - RAST._IExpr _848_a = underlying4.dtor_left; - RAST._IExpr _849_b = underlying4.dtor_right; - DAST.Format._IBinaryOpFormat _850_f = underlying4.dtor_format2; - DAST.Format._IUnaryOpFormat _851_of = cond0.dtor_format; - RAST._IExpr thn0 = stmt2.dtor_thn; - if (thn0.is_RawExpr) { - Dafny.ISequence content0 = thn0.dtor_content; - if (object.Equals(content0, Dafny.Sequence.UnicodeFromString("panic!(\"Halt\");"))) { - RAST._IExpr els0 = stmt2.dtor_els; - if (els0.is_RawExpr) { - Dafny.ISequence content1 = els0.dtor_content; - if (object.Equals(content1, Dafny.Sequence.UnicodeFromString(""))) { - RAST._IExpr _852_last = _source29.dtor_rhs; - unmatched29 = false; - RAST._IExpr _853_rewriting = RAST.Expr.create_StmtExpr((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("assert_eq!"))).Apply(Dafny.Sequence.FromElements(_848_a, _849_b)), _852_last); - return _853_rewriting; - } + if (_source29.is_StmtExpr) { + RAST._IExpr stmt2 = _source29.dtor_stmt; + if (stmt2.is_IfExpr) { + RAST._IExpr cond0 = stmt2.dtor_cond; + if (cond0.is_UnaryOp) { + Dafny.ISequence op14 = cond0.dtor_op1; + if (object.Equals(op14, Dafny.Sequence.UnicodeFromString("!"))) { + RAST._IExpr underlying4 = cond0.dtor_underlying; + if (underlying4.is_BinaryOp) { + Dafny.ISequence op23 = underlying4.dtor_op2; + if (object.Equals(op23, Dafny.Sequence.UnicodeFromString("=="))) { + RAST._IExpr _848_a = underlying4.dtor_left; + RAST._IExpr _849_b = underlying4.dtor_right; + DAST.Format._IBinaryOpFormat _850_f = underlying4.dtor_format2; + DAST.Format._IUnaryOpFormat _851_of = cond0.dtor_format; + RAST._IExpr thn0 = stmt2.dtor_thn; + if (thn0.is_RawExpr) { + Dafny.ISequence content0 = thn0.dtor_content; + if (object.Equals(content0, Dafny.Sequence.UnicodeFromString("panic!(\"Halt\");"))) { + RAST._IExpr els0 = stmt2.dtor_els; + if (els0.is_RawExpr) { + Dafny.ISequence content1 = els0.dtor_content; + if (object.Equals(content1, Dafny.Sequence.UnicodeFromString(""))) { + RAST._IExpr _852_last = _source29.dtor_rhs; + RAST._IExpr _853_rewriting = RAST.Expr.create_StmtExpr((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("assert_eq!"))).Apply(Dafny.Sequence.FromElements(_848_a, _849_b)), _852_last); + return _853_rewriting; } } } @@ -4285,11 +4149,7 @@ public RAST._IExpr Optimize() { } } } - if (unmatched29) { - unmatched29 = false; - return this; - } - throw new System.Exception("unexpected control point"); + return this; } public bool LeftRequiresParentheses(RAST._IExpr left) { return ((this).printingInfo).NeedParenthesesForLeft((left).printingInfo); @@ -4313,19 +4173,11 @@ public bool RightRequiresParentheses(RAST._IExpr right) { } public Std.Wrappers._IOption> RightMostIdentifier() { RAST._IExpr _source32 = this; - bool unmatched32 = true; - if (unmatched32) { - if (_source32.is_MemberSelect) { - Dafny.ISequence _854_id = _source32.dtor_name; - unmatched32 = false; - return Std.Wrappers.Option>.create_Some(_854_id); - } - } - if (unmatched32) { - unmatched32 = false; - return Std.Wrappers.Option>.create_None(); + if (_source32.is_MemberSelect) { + Dafny.ISequence _854_id = _source32.dtor_name; + return Std.Wrappers.Option>.create_Some(_854_id); } - throw new System.Exception("unexpected control point"); + return Std.Wrappers.Option>.create_None(); } public static Dafny.ISequence MaxHashes(Dafny.ISequence s, Dafny.ISequence currentHashes, Dafny.ISequence mostHashes) { @@ -4431,440 +4283,302 @@ public bool RightRequiresParentheses(RAST._IExpr right) { var _pat_let_tv95 = ind; var _pat_let_tv96 = ind; RAST._IExpr _source33 = (this).Optimize(); - bool unmatched33 = true; - if (unmatched33) { - if (_source33.is_Identifier) { - Dafny.ISequence _856_name = _source33.dtor_name; - unmatched33 = false; - return _856_name; - } - } - if (unmatched33) { - if (_source33.is_ExprFromType) { - RAST._IType _857_t = _source33.dtor_tpe; - unmatched33 = false; - return (_857_t)._ToString(_pat_let_tv39); - } - } - if (unmatched33) { - if (_source33.is_LiteralInt) { - Dafny.ISequence _858_number = _source33.dtor_value; - unmatched33 = false; - return _858_number; - } - } - if (unmatched33) { - if (_source33.is_LiteralBool) { - bool _859_b = _source33.dtor_bvalue; - unmatched33 = false; - if (_859_b) { - return Dafny.Sequence.UnicodeFromString("true"); - } else { - return Dafny.Sequence.UnicodeFromString("false"); - } - } - } - if (unmatched33) { - if (_source33.is_LiteralString) { - Dafny.ISequence _860_characters = _source33.dtor_value; - bool _861_binary = _source33.dtor_binary; - bool _862_verbatim = _source33.dtor_verbatim; - unmatched33 = false; - Dafny.ISequence _863_hashes = ((_862_verbatim) ? (Dafny.Sequence.Concat(RAST.Expr.MaxHashes(_860_characters, Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")), Dafny.Sequence.UnicodeFromString("#"))) : (Dafny.Sequence.UnicodeFromString(""))); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((_861_binary) ? (Dafny.Sequence.UnicodeFromString("b")) : (Dafny.Sequence.UnicodeFromString(""))), ((_862_verbatim) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("r"), _863_hashes)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("\"")), ((_862_verbatim) ? (RAST.Expr.RemoveDoubleQuotes(_860_characters)) : (_860_characters))), Dafny.Sequence.UnicodeFromString("\"")), _863_hashes); - } - } - if (unmatched33) { - if (_source33.is_Match) { - RAST._IExpr _864_matchee = _source33.dtor_matchee; - Dafny.ISequence _865_cases = _source33.dtor_cases; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("match "), (_864_matchee)._ToString(Dafny.Sequence.Concat(_pat_let_tv40, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_865_cases, Dafny.Helpers.Id, Func>>>((_866_ind) => ((System.Func>)((_867_c) => { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _866_ind), RAST.__default.IND), (_867_c)._ToString(Dafny.Sequence.Concat(_866_ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(",")); - })))(_pat_let_tv41), Dafny.Sequence.UnicodeFromString(""))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv42), Dafny.Sequence.UnicodeFromString("}")); - } - } - if (unmatched33) { - if (_source33.is_StmtExpr) { - RAST._IExpr _868_stmt = _source33.dtor_stmt; - RAST._IExpr _869_rhs = _source33.dtor_rhs; - unmatched33 = false; - if (((_868_stmt).is_RawExpr) && (((_868_stmt).dtor_content).Equals(Dafny.Sequence.UnicodeFromString("")))) { - return (_869_rhs)._ToString(_pat_let_tv43); - } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_868_stmt)._ToString(_pat_let_tv44), (((_868_stmt).NoExtraSemicolonAfter()) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.UnicodeFromString(";")))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv45), (_869_rhs)._ToString(_pat_let_tv46)); - } - } - } - if (unmatched33) { - if (_source33.is_Block) { - RAST._IExpr _870_underlying = _source33.dtor_underlying; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\n"), _pat_let_tv47), RAST.__default.IND), (_870_underlying)._ToString(Dafny.Sequence.Concat(_pat_let_tv48, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv49), Dafny.Sequence.UnicodeFromString("}")); - } - } - if (unmatched33) { - if (_source33.is_IfExpr) { - RAST._IExpr _871_cond = _source33.dtor_cond; - RAST._IExpr _872_thn = _source33.dtor_thn; - RAST._IExpr _873_els = _source33.dtor_els; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("if "), (_871_cond)._ToString(Dafny.Sequence.Concat(_pat_let_tv50, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv51), RAST.__default.IND), (_872_thn)._ToString(Dafny.Sequence.Concat(_pat_let_tv52, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv53), Dafny.Sequence.UnicodeFromString("}")), ((object.Equals(_873_els, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" else {\n"), _pat_let_tv54), RAST.__default.IND), (_873_els)._ToString(Dafny.Sequence.Concat(_pat_let_tv55, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv56), Dafny.Sequence.UnicodeFromString("}"))))); - } - } - if (unmatched33) { - if (_source33.is_StructBuild) { - RAST._IExpr _874_name = _source33.dtor_underlying; - Dafny.ISequence _875_assignments = _source33.dtor_assignments; - unmatched33 = false; - if (((new BigInteger((_875_assignments).Count)).Sign == 1) && ((((_875_assignments).Select(BigInteger.Zero)).dtor_identifier).Equals(Dafny.Sequence.UnicodeFromString("0")))) { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_874_name)._ToString(_pat_let_tv57), Dafny.Sequence.UnicodeFromString(" (")), RAST.__default.SeqToString(_875_assignments, Dafny.Helpers.Id, Func>>>((_876_ind) => ((System.Func>)((_877_assignment) => { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _876_ind), RAST.__default.IND), ((_877_assignment).dtor_rhs)._ToString(Dafny.Sequence.Concat(_876_ind, RAST.__default.IND))); - })))(_pat_let_tv58), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_875_assignments).Count)) > (BigInteger.One)) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv59)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); - } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_874_name)._ToString(_pat_let_tv60), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_875_assignments, Dafny.Helpers.Id, Func>>>((_878_ind) => ((System.Func>)((_879_assignment) => { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _878_ind), RAST.__default.IND), (_879_assignment)._ToString(Dafny.Sequence.Concat(_878_ind, RAST.__default.IND))); - })))(_pat_let_tv61), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_875_assignments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv62)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("}")); - } - } - } - if (unmatched33) { - if (_source33.is_Tuple) { - Dafny.ISequence _880_arguments = _source33.dtor_arguments; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_880_arguments, Dafny.Helpers.Id, Func>>>((_881_ind) => ((System.Func>)((_882_arg) => { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _881_ind), RAST.__default.IND), (_882_arg)._ToString(Dafny.Sequence.Concat(_881_ind, RAST.__default.IND))); - })))(_pat_let_tv63), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_880_arguments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv64)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); - } - } - if (unmatched33) { - if (_source33.is_UnaryOp) { - Dafny.ISequence _883_op = _source33.dtor_op1; - RAST._IExpr _884_underlying = _source33.dtor_underlying; - DAST.Format._IUnaryOpFormat _885_format = _source33.dtor_format; - unmatched33 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs41 = ((((this).printingInfo).NeedParenthesesFor((_884_underlying).printingInfo)) ? (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")"))) : (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")))); - Dafny.ISequence _886_leftP = _let_tmp_rhs41.dtor__0; - Dafny.ISequence _887_rightP = _let_tmp_rhs41.dtor__1; - Dafny.ISequence _888_leftOp = ((((_883_op).Equals(Dafny.Sequence.UnicodeFromString("&mut"))) && (!(_886_leftP).Equals(Dafny.Sequence.UnicodeFromString("(")))) ? (Dafny.Sequence.Concat(_883_op, Dafny.Sequence.UnicodeFromString(" "))) : ((((_883_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (Dafny.Sequence.UnicodeFromString("")) : (_883_op)))); - Dafny.ISequence _889_rightOp = (((_883_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (_883_op) : (Dafny.Sequence.UnicodeFromString(""))); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_888_leftOp, _886_leftP), (_884_underlying)._ToString(_pat_let_tv65)), _887_rightP), _889_rightOp); - } - } - if (unmatched33) { - if (_source33.is_TypeAscription) { - RAST._IExpr _890_left = _source33.dtor_left; - RAST._IType _891_tpe = _source33.dtor_tpe; - unmatched33 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs42 = (this).LeftParentheses(_890_left); - Dafny.ISequence _892_leftLeftP = _let_tmp_rhs42.dtor__0; - Dafny.ISequence _893_leftRightP = _let_tmp_rhs42.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_892_leftLeftP, (_890_left)._ToString(RAST.__default.IND)), _893_leftRightP), Dafny.Sequence.UnicodeFromString(" as ")), (_891_tpe)._ToString(RAST.__default.IND)); + if (_source33.is_Identifier) { + Dafny.ISequence _856_name = _source33.dtor_name; + return _856_name; + } + if (_source33.is_ExprFromType) { + RAST._IType _857_t = _source33.dtor_tpe; + return (_857_t)._ToString(_pat_let_tv39); + } + if (_source33.is_LiteralInt) { + Dafny.ISequence _858_number = _source33.dtor_value; + return _858_number; + } + if (_source33.is_LiteralBool) { + bool _859_b = _source33.dtor_bvalue; + if (_859_b) { + return Dafny.Sequence.UnicodeFromString("true"); + } else { + return Dafny.Sequence.UnicodeFromString("false"); } } - if (unmatched33) { - if (_source33.is_BinaryOp) { - Dafny.ISequence _894_op2 = _source33.dtor_op2; - RAST._IExpr _895_left = _source33.dtor_left; - RAST._IExpr _896_right = _source33.dtor_right; - DAST.Format._IBinaryOpFormat _897_format = _source33.dtor_format2; - unmatched33 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs43 = (this).LeftParentheses(_895_left); - Dafny.ISequence _898_leftLeftP = _let_tmp_rhs43.dtor__0; - Dafny.ISequence _899_leftRighP = _let_tmp_rhs43.dtor__1; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs44 = (this).RightParentheses(_896_right); - Dafny.ISequence _900_rightLeftP = _let_tmp_rhs44.dtor__0; - Dafny.ISequence _901_rightRightP = _let_tmp_rhs44.dtor__1; - Dafny.ISequence _902_opRendered = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), _894_op2), Dafny.Sequence.UnicodeFromString(" ")); - Dafny.ISequence _903_indLeft = (((_898_leftLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(_pat_let_tv66, RAST.__default.IND)) : (_pat_let_tv67)); - Dafny.ISequence _904_indRight = (((_900_rightLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(_pat_let_tv68, RAST.__default.IND)) : (_pat_let_tv69)); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_898_leftLeftP, (_895_left)._ToString(_903_indLeft)), _899_leftRighP), _902_opRendered), _900_rightLeftP), (_896_right)._ToString(_904_indRight)), _901_rightRightP); + if (_source33.is_LiteralString) { + Dafny.ISequence _860_characters = _source33.dtor_value; + bool _861_binary = _source33.dtor_binary; + bool _862_verbatim = _source33.dtor_verbatim; + Dafny.ISequence _863_hashes = ((_862_verbatim) ? (Dafny.Sequence.Concat(RAST.Expr.MaxHashes(_860_characters, Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")), Dafny.Sequence.UnicodeFromString("#"))) : (Dafny.Sequence.UnicodeFromString(""))); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((_861_binary) ? (Dafny.Sequence.UnicodeFromString("b")) : (Dafny.Sequence.UnicodeFromString(""))), ((_862_verbatim) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("r"), _863_hashes)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("\"")), ((_862_verbatim) ? (RAST.Expr.RemoveDoubleQuotes(_860_characters)) : (_860_characters))), Dafny.Sequence.UnicodeFromString("\"")), _863_hashes); + } + if (_source33.is_Match) { + RAST._IExpr _864_matchee = _source33.dtor_matchee; + Dafny.ISequence _865_cases = _source33.dtor_cases; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("match "), (_864_matchee)._ToString(Dafny.Sequence.Concat(_pat_let_tv40, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_865_cases, Dafny.Helpers.Id, Func>>>((_866_ind) => ((System.Func>)((_867_c) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _866_ind), RAST.__default.IND), (_867_c)._ToString(Dafny.Sequence.Concat(_866_ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(",")); + })))(_pat_let_tv41), Dafny.Sequence.UnicodeFromString(""))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv42), Dafny.Sequence.UnicodeFromString("}")); + } + if (_source33.is_StmtExpr) { + RAST._IExpr _868_stmt = _source33.dtor_stmt; + RAST._IExpr _869_rhs = _source33.dtor_rhs; + if (((_868_stmt).is_RawExpr) && (((_868_stmt).dtor_content).Equals(Dafny.Sequence.UnicodeFromString("")))) { + return (_869_rhs)._ToString(_pat_let_tv43); + } else { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_868_stmt)._ToString(_pat_let_tv44), (((_868_stmt).NoExtraSemicolonAfter()) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.UnicodeFromString(";")))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv45), (_869_rhs)._ToString(_pat_let_tv46)); } } - if (unmatched33) { - if (_source33.is_DeclareVar) { - RAST._IDeclareType _905_declareType = _source33.dtor_declareType; - Dafny.ISequence _906_name = _source33.dtor_name; - Std.Wrappers._IOption _907_optType = _source33.dtor_optType; - Std.Wrappers._IOption _908_optExpr = _source33.dtor_optRhs; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("let "), ((object.Equals(_905_declareType, RAST.DeclareType.create_MUT())) ? (Dafny.Sequence.UnicodeFromString("mut ")) : (Dafny.Sequence.UnicodeFromString("")))), _906_name), (((_907_optType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(": "), ((_907_optType).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv70, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), (((_908_optExpr).is_Some) ? (Dafny.Helpers.Let, Dafny.ISequence>(((_908_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv71, RAST.__default.IND)), _pat_let5_0 => Dafny.Helpers.Let, Dafny.ISequence>(_pat_let5_0, _909_optExprString => (((_909_optExprString).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("= /*issue with empty RHS*/"), ((((_908_optExpr).dtor_value).is_RawExpr) ? (Dafny.Sequence.UnicodeFromString("Empty Raw expr")) : (((((_908_optExpr).dtor_value).is_LiteralString) ? (Dafny.Sequence.UnicodeFromString("Empty string literal")) : (((((_908_optExpr).dtor_value).is_LiteralInt) ? (Dafny.Sequence.UnicodeFromString("Empty int literal")) : (Dafny.Sequence.UnicodeFromString("Another case"))))))))) : (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" = "), _909_optExprString)))))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); + if (_source33.is_Block) { + RAST._IExpr _870_underlying = _source33.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\n"), _pat_let_tv47), RAST.__default.IND), (_870_underlying)._ToString(Dafny.Sequence.Concat(_pat_let_tv48, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv49), Dafny.Sequence.UnicodeFromString("}")); + } + if (_source33.is_IfExpr) { + RAST._IExpr _871_cond = _source33.dtor_cond; + RAST._IExpr _872_thn = _source33.dtor_thn; + RAST._IExpr _873_els = _source33.dtor_els; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("if "), (_871_cond)._ToString(Dafny.Sequence.Concat(_pat_let_tv50, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv51), RAST.__default.IND), (_872_thn)._ToString(Dafny.Sequence.Concat(_pat_let_tv52, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv53), Dafny.Sequence.UnicodeFromString("}")), ((object.Equals(_873_els, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" else {\n"), _pat_let_tv54), RAST.__default.IND), (_873_els)._ToString(Dafny.Sequence.Concat(_pat_let_tv55, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv56), Dafny.Sequence.UnicodeFromString("}"))))); + } + if (_source33.is_StructBuild) { + RAST._IExpr _874_name = _source33.dtor_underlying; + Dafny.ISequence _875_assignments = _source33.dtor_assignments; + if (((new BigInteger((_875_assignments).Count)).Sign == 1) && ((((_875_assignments).Select(BigInteger.Zero)).dtor_identifier).Equals(Dafny.Sequence.UnicodeFromString("0")))) { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_874_name)._ToString(_pat_let_tv57), Dafny.Sequence.UnicodeFromString(" (")), RAST.__default.SeqToString(_875_assignments, Dafny.Helpers.Id, Func>>>((_876_ind) => ((System.Func>)((_877_assignment) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _876_ind), RAST.__default.IND), ((_877_assignment).dtor_rhs)._ToString(Dafny.Sequence.Concat(_876_ind, RAST.__default.IND))); + })))(_pat_let_tv58), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_875_assignments).Count)) > (BigInteger.One)) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv59)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); + } else { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_874_name)._ToString(_pat_let_tv60), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_875_assignments, Dafny.Helpers.Id, Func>>>((_878_ind) => ((System.Func>)((_879_assignment) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _878_ind), RAST.__default.IND), (_879_assignment)._ToString(Dafny.Sequence.Concat(_878_ind, RAST.__default.IND))); + })))(_pat_let_tv61), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_875_assignments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv62)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("}")); } } - if (unmatched33) { - if (_source33.is_Assign) { - Std.Wrappers._IOption _910_names = _source33.dtor_names; - RAST._IExpr _911_expr = _source33.dtor_rhs; - unmatched33 = false; - Dafny.ISequence _912_lhs = ((System.Func>)(() => { - Std.Wrappers._IOption _source34 = _910_names; - bool unmatched34 = true; - if (unmatched34) { - if (_source34.is_Some) { - RAST._IAssignLhs value0 = _source34.dtor_value; - if (value0.is_LocalVar) { - Dafny.ISequence _913_name = value0.dtor_name; - unmatched34 = false; - return Dafny.Sequence.Concat(_913_name, Dafny.Sequence.UnicodeFromString(" = ")); - } - } - } - if (unmatched34) { - if (_source34.is_Some) { - RAST._IAssignLhs value1 = _source34.dtor_value; - if (value1.is_SelectMember) { - RAST._IExpr _914_member = value1.dtor_on; - Dafny.ISequence _915_field = value1.dtor_field; - unmatched34 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs45 = (RAST.Expr.create_Select(_914_member, _915_field)).LeftParentheses(_914_member); - Dafny.ISequence _916_leftP = _let_tmp_rhs45.dtor__0; - Dafny.ISequence _917_rightP = _let_tmp_rhs45.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_916_leftP, (_914_member)._ToString(_pat_let_tv72)), _917_rightP), Dafny.Sequence.UnicodeFromString(".")), _915_field), Dafny.Sequence.UnicodeFromString(" = ")); - } - } + if (_source33.is_Tuple) { + Dafny.ISequence _880_arguments = _source33.dtor_arguments; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_880_arguments, Dafny.Helpers.Id, Func>>>((_881_ind) => ((System.Func>)((_882_arg) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _881_ind), RAST.__default.IND), (_882_arg)._ToString(Dafny.Sequence.Concat(_881_ind, RAST.__default.IND))); + })))(_pat_let_tv63), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_880_arguments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv64)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); + } + if (_source33.is_UnaryOp) { + Dafny.ISequence _883_op = _source33.dtor_op1; + RAST._IExpr _884_underlying = _source33.dtor_underlying; + DAST.Format._IUnaryOpFormat _885_format = _source33.dtor_format; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs41 = ((((this).printingInfo).NeedParenthesesFor((_884_underlying).printingInfo)) ? (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")"))) : (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")))); + Dafny.ISequence _886_leftP = _let_tmp_rhs41.dtor__0; + Dafny.ISequence _887_rightP = _let_tmp_rhs41.dtor__1; + Dafny.ISequence _888_leftOp = ((((_883_op).Equals(Dafny.Sequence.UnicodeFromString("&mut"))) && (!(_886_leftP).Equals(Dafny.Sequence.UnicodeFromString("(")))) ? (Dafny.Sequence.Concat(_883_op, Dafny.Sequence.UnicodeFromString(" "))) : ((((_883_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (Dafny.Sequence.UnicodeFromString("")) : (_883_op)))); + Dafny.ISequence _889_rightOp = (((_883_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (_883_op) : (Dafny.Sequence.UnicodeFromString(""))); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_888_leftOp, _886_leftP), (_884_underlying)._ToString(_pat_let_tv65)), _887_rightP), _889_rightOp); + } + if (_source33.is_TypeAscription) { + RAST._IExpr _890_left = _source33.dtor_left; + RAST._IType _891_tpe = _source33.dtor_tpe; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs42 = (this).LeftParentheses(_890_left); + Dafny.ISequence _892_leftLeftP = _let_tmp_rhs42.dtor__0; + Dafny.ISequence _893_leftRightP = _let_tmp_rhs42.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_892_leftLeftP, (_890_left)._ToString(RAST.__default.IND)), _893_leftRightP), Dafny.Sequence.UnicodeFromString(" as ")), (_891_tpe)._ToString(RAST.__default.IND)); + } + if (_source33.is_BinaryOp) { + Dafny.ISequence _894_op2 = _source33.dtor_op2; + RAST._IExpr _895_left = _source33.dtor_left; + RAST._IExpr _896_right = _source33.dtor_right; + DAST.Format._IBinaryOpFormat _897_format = _source33.dtor_format2; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs43 = (this).LeftParentheses(_895_left); + Dafny.ISequence _898_leftLeftP = _let_tmp_rhs43.dtor__0; + Dafny.ISequence _899_leftRighP = _let_tmp_rhs43.dtor__1; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs44 = (this).RightParentheses(_896_right); + Dafny.ISequence _900_rightLeftP = _let_tmp_rhs44.dtor__0; + Dafny.ISequence _901_rightRightP = _let_tmp_rhs44.dtor__1; + Dafny.ISequence _902_opRendered = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), _894_op2), Dafny.Sequence.UnicodeFromString(" ")); + Dafny.ISequence _903_indLeft = (((_898_leftLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(_pat_let_tv66, RAST.__default.IND)) : (_pat_let_tv67)); + Dafny.ISequence _904_indRight = (((_900_rightLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(_pat_let_tv68, RAST.__default.IND)) : (_pat_let_tv69)); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_898_leftLeftP, (_895_left)._ToString(_903_indLeft)), _899_leftRighP), _902_opRendered), _900_rightLeftP), (_896_right)._ToString(_904_indRight)), _901_rightRightP); + } + if (_source33.is_DeclareVar) { + RAST._IDeclareType _905_declareType = _source33.dtor_declareType; + Dafny.ISequence _906_name = _source33.dtor_name; + Std.Wrappers._IOption _907_optType = _source33.dtor_optType; + Std.Wrappers._IOption _908_optExpr = _source33.dtor_optRhs; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("let "), ((object.Equals(_905_declareType, RAST.DeclareType.create_MUT())) ? (Dafny.Sequence.UnicodeFromString("mut ")) : (Dafny.Sequence.UnicodeFromString("")))), _906_name), (((_907_optType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(": "), ((_907_optType).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv70, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), (((_908_optExpr).is_Some) ? (Dafny.Helpers.Let, Dafny.ISequence>(((_908_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv71, RAST.__default.IND)), _pat_let5_0 => Dafny.Helpers.Let, Dafny.ISequence>(_pat_let5_0, _909_optExprString => (((_909_optExprString).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("= /*issue with empty RHS*/"), ((((_908_optExpr).dtor_value).is_RawExpr) ? (Dafny.Sequence.UnicodeFromString("Empty Raw expr")) : (((((_908_optExpr).dtor_value).is_LiteralString) ? (Dafny.Sequence.UnicodeFromString("Empty string literal")) : (((((_908_optExpr).dtor_value).is_LiteralInt) ? (Dafny.Sequence.UnicodeFromString("Empty int literal")) : (Dafny.Sequence.UnicodeFromString("Another case"))))))))) : (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" = "), _909_optExprString)))))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); + } + if (_source33.is_Assign) { + Std.Wrappers._IOption _910_names = _source33.dtor_names; + RAST._IExpr _911_expr = _source33.dtor_rhs; + Dafny.ISequence _912_lhs = ((System.Func>)(() => { + Std.Wrappers._IOption _source34 = _910_names; + if (_source34.is_Some) { + RAST._IAssignLhs value0 = _source34.dtor_value; + if (value0.is_LocalVar) { + Dafny.ISequence _913_name = value0.dtor_name; + return Dafny.Sequence.Concat(_913_name, Dafny.Sequence.UnicodeFromString(" = ")); } - if (unmatched34) { - if (_source34.is_Some) { - RAST._IAssignLhs value2 = _source34.dtor_value; - if (value2.is_ExtractTuple) { - Dafny.ISequence> _918_names = value2.dtor_names; - unmatched34 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString>(_918_names, ((System.Func, Dafny.ISequence>)((_919_name) => { - return _919_name; - })), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString(") = ")); - } - } + } + if (_source34.is_Some) { + RAST._IAssignLhs value1 = _source34.dtor_value; + if (value1.is_SelectMember) { + RAST._IExpr _914_member = value1.dtor_on; + Dafny.ISequence _915_field = value1.dtor_field; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs45 = (RAST.Expr.create_Select(_914_member, _915_field)).LeftParentheses(_914_member); + Dafny.ISequence _916_leftP = _let_tmp_rhs45.dtor__0; + Dafny.ISequence _917_rightP = _let_tmp_rhs45.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_916_leftP, (_914_member)._ToString(_pat_let_tv72)), _917_rightP), Dafny.Sequence.UnicodeFromString(".")), _915_field), Dafny.Sequence.UnicodeFromString(" = ")); } - if (unmatched34) { - if (_source34.is_Some) { - RAST._IAssignLhs value3 = _source34.dtor_value; - if (value3.is_Index) { - RAST._IExpr _920_e = value3.dtor_expr; - Dafny.ISequence _921_indices = value3.dtor_indices; - unmatched34 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs46 = (RAST.Expr.create_Call(_920_e, _921_indices)).LeftParentheses(_920_e); - Dafny.ISequence _922_leftP = _let_tmp_rhs46.dtor__0; - Dafny.ISequence _923_rightP = _let_tmp_rhs46.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_922_leftP, (_920_e)._ToString(_pat_let_tv73)), _923_rightP), Dafny.Sequence.UnicodeFromString("[")), RAST.__default.SeqToString(_921_indices, Dafny.Helpers.Id, Func>>>((_924_ind) => ((System.Func>)((_925_index) => { - return (_925_index)._ToString(Dafny.Sequence.Concat(_924_ind, RAST.__default.IND)); - })))(_pat_let_tv74), Dafny.Sequence.UnicodeFromString("]["))), Dafny.Sequence.UnicodeFromString("] = ")); - } - } + } + if (_source34.is_Some) { + RAST._IAssignLhs value2 = _source34.dtor_value; + if (value2.is_ExtractTuple) { + Dafny.ISequence> _918_names = value2.dtor_names; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString>(_918_names, ((System.Func, Dafny.ISequence>)((_919_name) => { + return _919_name; + })), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString(") = ")); } - if (unmatched34) { - unmatched34 = false; - return Dafny.Sequence.UnicodeFromString("_ = "); + } + if (_source34.is_Some) { + RAST._IAssignLhs value3 = _source34.dtor_value; + if (value3.is_Index) { + RAST._IExpr _920_e = value3.dtor_expr; + Dafny.ISequence _921_indices = value3.dtor_indices; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs46 = (RAST.Expr.create_Call(_920_e, _921_indices)).LeftParentheses(_920_e); + Dafny.ISequence _922_leftP = _let_tmp_rhs46.dtor__0; + Dafny.ISequence _923_rightP = _let_tmp_rhs46.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_922_leftP, (_920_e)._ToString(_pat_let_tv73)), _923_rightP), Dafny.Sequence.UnicodeFromString("[")), RAST.__default.SeqToString(_921_indices, Dafny.Helpers.Id, Func>>>((_924_ind) => ((System.Func>)((_925_index) => { + return (_925_index)._ToString(Dafny.Sequence.Concat(_924_ind, RAST.__default.IND)); + })))(_pat_let_tv74), Dafny.Sequence.UnicodeFromString("]["))), Dafny.Sequence.UnicodeFromString("] = ")); } - throw new System.Exception("unexpected control point"); - }))(); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(_912_lhs, (_911_expr)._ToString(Dafny.Sequence.Concat(_pat_let_tv75, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(";")); + } + return Dafny.Sequence.UnicodeFromString("_ = "); + }))(); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(_912_lhs, (_911_expr)._ToString(Dafny.Sequence.Concat(_pat_let_tv75, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(";")); + } + if (_source33.is_Labelled) { + Dafny.ISequence _926_name = _source33.dtor_lbl; + RAST._IExpr _927_underlying = _source33.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("'"), _926_name), Dafny.Sequence.UnicodeFromString(": ")), (_927_underlying)._ToString(_pat_let_tv76)); + } + if (_source33.is_Break) { + Std.Wrappers._IOption> _928_optLbl = _source33.dtor_optLbl; + Std.Wrappers._IOption> _source35 = _928_optLbl; + if (_source35.is_Some) { + Dafny.ISequence _929_lbl = _source35.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("break '"), _929_lbl), Dafny.Sequence.UnicodeFromString(";")); } - } - if (unmatched33) { - if (_source33.is_Labelled) { - Dafny.ISequence _926_name = _source33.dtor_lbl; - RAST._IExpr _927_underlying = _source33.dtor_underlying; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("'"), _926_name), Dafny.Sequence.UnicodeFromString(": ")), (_927_underlying)._ToString(_pat_let_tv76)); + return Dafny.Sequence.UnicodeFromString("break;"); + } + if (_source33.is_Continue) { + Std.Wrappers._IOption> _930_optLbl = _source33.dtor_optLbl; + Std.Wrappers._IOption> _source36 = _930_optLbl; + if (_source36.is_Some) { + Dafny.ISequence _931_lbl = _source36.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("continue '"), _931_lbl), Dafny.Sequence.UnicodeFromString(";")); } - } - if (unmatched33) { - if (_source33.is_Break) { - Std.Wrappers._IOption> _928_optLbl = _source33.dtor_optLbl; - unmatched33 = false; - Std.Wrappers._IOption> _source35 = _928_optLbl; - bool unmatched35 = true; - if (unmatched35) { - if (_source35.is_Some) { - Dafny.ISequence _929_lbl = _source35.dtor_value; - unmatched35 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("break '"), _929_lbl), Dafny.Sequence.UnicodeFromString(";")); - } + return Dafny.Sequence.UnicodeFromString("continue;"); + } + if (_source33.is_Loop) { + Std.Wrappers._IOption _932_optCond = _source33.dtor_optCond; + RAST._IExpr _933_underlying = _source33.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((System.Func>)(() => { + Std.Wrappers._IOption _source37 = _932_optCond; + if (_source37.is_None) { + return Dafny.Sequence.UnicodeFromString("loop"); } - if (unmatched35) { - unmatched35 = false; - return Dafny.Sequence.UnicodeFromString("break;"); - } - throw new System.Exception("unexpected control point"); + RAST._IExpr _934_c = _source37.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("while "), (_934_c)._ToString(Dafny.Sequence.Concat(_pat_let_tv77, RAST.__default.IND))); + }))(), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv78), RAST.__default.IND), (_933_underlying)._ToString(Dafny.Sequence.Concat(_pat_let_tv79, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv80), Dafny.Sequence.UnicodeFromString("}")); + } + if (_source33.is_For) { + Dafny.ISequence _935_name = _source33.dtor_name; + RAST._IExpr _936_range = _source33.dtor_range; + RAST._IExpr _937_body = _source33.dtor_body; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("for "), _935_name), Dafny.Sequence.UnicodeFromString(" in ")), (_936_range)._ToString(Dafny.Sequence.Concat(_pat_let_tv81, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv82), RAST.__default.IND), (_937_body)._ToString(Dafny.Sequence.Concat(_pat_let_tv83, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv84), Dafny.Sequence.UnicodeFromString("}")); + } + if (_source33.is_Return) { + Std.Wrappers._IOption _938_optExpr = _source33.dtor_optExpr; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("return"), (((_938_optExpr).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), ((_938_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv85, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); + } + if (_source33.is_CallType) { + RAST._IExpr _939_expr = _source33.dtor_obj; + Dafny.ISequence _940_tpes = _source33.dtor_typeParameters; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs47 = (this).LeftParentheses(_939_expr); + Dafny.ISequence _941_leftP = _let_tmp_rhs47.dtor__0; + Dafny.ISequence _942_rightP = _let_tmp_rhs47.dtor__1; + if ((_940_tpes).Equals(Dafny.Sequence.FromElements())) { + return (_939_expr)._ToString(_pat_let_tv86); + } else { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_941_leftP, (_939_expr)._ToString(_pat_let_tv87)), _942_rightP), Dafny.Sequence.UnicodeFromString("::<")), RAST.__default.SeqToString(_940_tpes, Dafny.Helpers.Id, Func>>>((_943_ind) => ((System.Func>)((_944_tpe) => { + return (_944_tpe)._ToString(Dafny.Sequence.Concat(_943_ind, RAST.__default.IND)); + })))(_pat_let_tv88), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">")); } } - if (unmatched33) { - if (_source33.is_Continue) { - Std.Wrappers._IOption> _930_optLbl = _source33.dtor_optLbl; - unmatched33 = false; - Std.Wrappers._IOption> _source36 = _930_optLbl; - bool unmatched36 = true; - if (unmatched36) { - if (_source36.is_Some) { - Dafny.ISequence _931_lbl = _source36.dtor_value; - unmatched36 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("continue '"), _931_lbl), Dafny.Sequence.UnicodeFromString(";")); + if (_source33.is_Call) { + RAST._IExpr _945_expr = _source33.dtor_obj; + Dafny.ISequence _946_args = _source33.dtor_arguments; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs48 = (this).LeftParentheses(_945_expr); + Dafny.ISequence _947_leftP = _let_tmp_rhs48.dtor__0; + Dafny.ISequence _948_rightP = _let_tmp_rhs48.dtor__1; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs49 = ((System.Func<_System._ITuple2, Dafny.ISequence>>)(() => { + Std.Wrappers._IOption> _source38 = (_945_expr).RightMostIdentifier(); + bool disjunctiveMatch0 = false; + if (_source38.is_Some) { + Dafny.ISequence value4 = _source38.dtor_value; + if (object.Equals(value4, Dafny.Sequence.UnicodeFromString("seq!"))) { + disjunctiveMatch0 = true; } } - if (unmatched36) { - unmatched36 = false; - return Dafny.Sequence.UnicodeFromString("continue;"); - } - throw new System.Exception("unexpected control point"); - } - } - if (unmatched33) { - if (_source33.is_Loop) { - Std.Wrappers._IOption _932_optCond = _source33.dtor_optCond; - RAST._IExpr _933_underlying = _source33.dtor_underlying; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((System.Func>)(() => { - Std.Wrappers._IOption _source37 = _932_optCond; - bool unmatched37 = true; - if (unmatched37) { - if (_source37.is_None) { - unmatched37 = false; - return Dafny.Sequence.UnicodeFromString("loop"); - } + if (_source38.is_Some) { + Dafny.ISequence value5 = _source38.dtor_value; + if (object.Equals(value5, Dafny.Sequence.UnicodeFromString("map!"))) { + disjunctiveMatch0 = true; } - if (unmatched37) { - RAST._IExpr _934_c = _source37.dtor_value; - unmatched37 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("while "), (_934_c)._ToString(Dafny.Sequence.Concat(_pat_let_tv77, RAST.__default.IND))); - } - throw new System.Exception("unexpected control point"); - }))(), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv78), RAST.__default.IND), (_933_underlying)._ToString(Dafny.Sequence.Concat(_pat_let_tv79, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv80), Dafny.Sequence.UnicodeFromString("}")); - } - } - if (unmatched33) { - if (_source33.is_For) { - Dafny.ISequence _935_name = _source33.dtor_name; - RAST._IExpr _936_range = _source33.dtor_range; - RAST._IExpr _937_body = _source33.dtor_body; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("for "), _935_name), Dafny.Sequence.UnicodeFromString(" in ")), (_936_range)._ToString(Dafny.Sequence.Concat(_pat_let_tv81, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv82), RAST.__default.IND), (_937_body)._ToString(Dafny.Sequence.Concat(_pat_let_tv83, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv84), Dafny.Sequence.UnicodeFromString("}")); - } - } - if (unmatched33) { - if (_source33.is_Return) { - Std.Wrappers._IOption _938_optExpr = _source33.dtor_optExpr; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("return"), (((_938_optExpr).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), ((_938_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv85, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); - } - } - if (unmatched33) { - if (_source33.is_CallType) { - RAST._IExpr _939_expr = _source33.dtor_obj; - Dafny.ISequence _940_tpes = _source33.dtor_typeParameters; - unmatched33 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs47 = (this).LeftParentheses(_939_expr); - Dafny.ISequence _941_leftP = _let_tmp_rhs47.dtor__0; - Dafny.ISequence _942_rightP = _let_tmp_rhs47.dtor__1; - if ((_940_tpes).Equals(Dafny.Sequence.FromElements())) { - return (_939_expr)._ToString(_pat_let_tv86); - } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_941_leftP, (_939_expr)._ToString(_pat_let_tv87)), _942_rightP), Dafny.Sequence.UnicodeFromString("::<")), RAST.__default.SeqToString(_940_tpes, Dafny.Helpers.Id, Func>>>((_943_ind) => ((System.Func>)((_944_tpe) => { - return (_944_tpe)._ToString(Dafny.Sequence.Concat(_943_ind, RAST.__default.IND)); - })))(_pat_let_tv88), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">")); } - } - } - if (unmatched33) { - if (_source33.is_Call) { - RAST._IExpr _945_expr = _source33.dtor_obj; - Dafny.ISequence _946_args = _source33.dtor_arguments; - unmatched33 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs48 = (this).LeftParentheses(_945_expr); - Dafny.ISequence _947_leftP = _let_tmp_rhs48.dtor__0; - Dafny.ISequence _948_rightP = _let_tmp_rhs48.dtor__1; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs49 = ((System.Func<_System._ITuple2, Dafny.ISequence>>)(() => { - Std.Wrappers._IOption> _source38 = (_945_expr).RightMostIdentifier(); - bool unmatched38 = true; - if (unmatched38) { - bool disjunctiveMatch0 = false; - if (_source38.is_Some) { - Dafny.ISequence value4 = _source38.dtor_value; - if (object.Equals(value4, Dafny.Sequence.UnicodeFromString("seq!"))) { - disjunctiveMatch0 = true; - } - } - if (_source38.is_Some) { - Dafny.ISequence value5 = _source38.dtor_value; - if (object.Equals(value5, Dafny.Sequence.UnicodeFromString("map!"))) { - disjunctiveMatch0 = true; - } - } - if (disjunctiveMatch0) { - unmatched38 = false; - return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("["), Dafny.Sequence.UnicodeFromString("]")); - } - } - if (unmatched38) { - bool disjunctiveMatch1 = false; - if (_source38.is_Some) { - Dafny.ISequence value6 = _source38.dtor_value; - if (object.Equals(value6, Dafny.Sequence.UnicodeFromString("set!"))) { - disjunctiveMatch1 = true; - } - } - if (_source38.is_Some) { - Dafny.ISequence value7 = _source38.dtor_value; - if (object.Equals(value7, Dafny.Sequence.UnicodeFromString("multiset!"))) { - disjunctiveMatch1 = true; - } - } - if (disjunctiveMatch1) { - unmatched38 = false; - return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("{"), Dafny.Sequence.UnicodeFromString("}")); - } + if (disjunctiveMatch0) { + return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("["), Dafny.Sequence.UnicodeFromString("]")); + } + bool disjunctiveMatch1 = false; + if (_source38.is_Some) { + Dafny.ISequence value6 = _source38.dtor_value; + if (object.Equals(value6, Dafny.Sequence.UnicodeFromString("set!"))) { + disjunctiveMatch1 = true; } - if (unmatched38) { - unmatched38 = false; - return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")")); + } + if (_source38.is_Some) { + Dafny.ISequence value7 = _source38.dtor_value; + if (object.Equals(value7, Dafny.Sequence.UnicodeFromString("multiset!"))) { + disjunctiveMatch1 = true; } - throw new System.Exception("unexpected control point"); - }))(); - Dafny.ISequence _949_leftCallP = _let_tmp_rhs49.dtor__0; - Dafny.ISequence _950_rightCallP = _let_tmp_rhs49.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_947_leftP, (_945_expr)._ToString(_pat_let_tv89)), _948_rightP), _949_leftCallP), RAST.__default.SeqToString(_946_args, Dafny.Helpers.Id, Func>>>((_951_ind) => ((System.Func>)((_952_arg) => { - return (_952_arg)._ToString(Dafny.Sequence.Concat(_951_ind, RAST.__default.IND)); - })))(_pat_let_tv90), Dafny.Sequence.UnicodeFromString(", "))), _950_rightCallP); - } - } - if (unmatched33) { - if (_source33.is_Select) { - RAST._IExpr _953_expression = _source33.dtor_obj; - Dafny.ISequence _954_name = _source33.dtor_name; - unmatched33 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs50 = (this).LeftParentheses(_953_expression); - Dafny.ISequence _955_leftP = _let_tmp_rhs50.dtor__0; - Dafny.ISequence _956_rightP = _let_tmp_rhs50.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_955_leftP, (_953_expression)._ToString(_pat_let_tv91)), _956_rightP), Dafny.Sequence.UnicodeFromString(".")), _954_name); - } - } - if (unmatched33) { - if (_source33.is_MemberSelect) { - RAST._IExpr _957_expression = _source33.dtor_obj; - Dafny.ISequence _958_name = _source33.dtor_name; - unmatched33 = false; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs51 = (this).LeftParentheses(_957_expression); - Dafny.ISequence _959_leftP = _let_tmp_rhs51.dtor__0; - Dafny.ISequence _960_rightP = _let_tmp_rhs51.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_959_leftP, (_957_expression)._ToString(_pat_let_tv92)), _960_rightP), Dafny.Sequence.UnicodeFromString("::")), _958_name); - } - } - if (unmatched33) { - if (_source33.is_Lambda) { - Dafny.ISequence _961_params = _source33.dtor_params; - Std.Wrappers._IOption _962_retType = _source33.dtor_retType; - RAST._IExpr _963_body = _source33.dtor_body; - unmatched33 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("move |"), RAST.__default.SeqToString(_961_params, Dafny.Helpers.Id, Func>>>((_964_ind) => ((System.Func>)((_965_arg) => { - return (_965_arg)._ToString(_964_ind); - })))(_pat_let_tv93), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString("| ")), (((_962_retType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("-> "), ((_962_retType).dtor_value)._ToString(_pat_let_tv94)), Dafny.Sequence.UnicodeFromString(" "))) : (Dafny.Sequence.UnicodeFromString("")))), (_963_body)._ToString(_pat_let_tv95)); - } - } - if (unmatched33) { - RAST._IExpr _966_r = _source33; - unmatched33 = false; - return RAST.__default.AddIndent((_966_r).dtor_content, _pat_let_tv96); - } - throw new System.Exception("unexpected control point"); + } + if (disjunctiveMatch1) { + return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("{"), Dafny.Sequence.UnicodeFromString("}")); + } + return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")")); + }))(); + Dafny.ISequence _949_leftCallP = _let_tmp_rhs49.dtor__0; + Dafny.ISequence _950_rightCallP = _let_tmp_rhs49.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_947_leftP, (_945_expr)._ToString(_pat_let_tv89)), _948_rightP), _949_leftCallP), RAST.__default.SeqToString(_946_args, Dafny.Helpers.Id, Func>>>((_951_ind) => ((System.Func>)((_952_arg) => { + return (_952_arg)._ToString(Dafny.Sequence.Concat(_951_ind, RAST.__default.IND)); + })))(_pat_let_tv90), Dafny.Sequence.UnicodeFromString(", "))), _950_rightCallP); + } + if (_source33.is_Select) { + RAST._IExpr _953_expression = _source33.dtor_obj; + Dafny.ISequence _954_name = _source33.dtor_name; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs50 = (this).LeftParentheses(_953_expression); + Dafny.ISequence _955_leftP = _let_tmp_rhs50.dtor__0; + Dafny.ISequence _956_rightP = _let_tmp_rhs50.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_955_leftP, (_953_expression)._ToString(_pat_let_tv91)), _956_rightP), Dafny.Sequence.UnicodeFromString(".")), _954_name); + } + if (_source33.is_MemberSelect) { + RAST._IExpr _957_expression = _source33.dtor_obj; + Dafny.ISequence _958_name = _source33.dtor_name; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs51 = (this).LeftParentheses(_957_expression); + Dafny.ISequence _959_leftP = _let_tmp_rhs51.dtor__0; + Dafny.ISequence _960_rightP = _let_tmp_rhs51.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_959_leftP, (_957_expression)._ToString(_pat_let_tv92)), _960_rightP), Dafny.Sequence.UnicodeFromString("::")), _958_name); + } + if (_source33.is_Lambda) { + Dafny.ISequence _961_params = _source33.dtor_params; + Std.Wrappers._IOption _962_retType = _source33.dtor_retType; + RAST._IExpr _963_body = _source33.dtor_body; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("move |"), RAST.__default.SeqToString(_961_params, Dafny.Helpers.Id, Func>>>((_964_ind) => ((System.Func>)((_965_arg) => { + return (_965_arg)._ToString(_964_ind); + })))(_pat_let_tv93), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString("| ")), (((_962_retType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("-> "), ((_962_retType).dtor_value)._ToString(_pat_let_tv94)), Dafny.Sequence.UnicodeFromString(" "))) : (Dafny.Sequence.UnicodeFromString("")))), (_963_body)._ToString(_pat_let_tv95)); + } + RAST._IExpr _966_r = _source33; + return RAST.__default.AddIndent((_966_r).dtor_content, _pat_let_tv96); } public RAST._IExpr Then(RAST._IExpr rhs2) { if ((this).is_StmtExpr) { @@ -4905,299 +4619,203 @@ public bool IsLhsIdentifier() { } public RAST._IPrintingInfo printingInfo { get { RAST._IExpr _source39 = this; - bool unmatched39 = true; - if (unmatched39) { - if (_source39.is_RawExpr) { - unmatched39 = false; - return RAST.PrintingInfo.create_UnknownPrecedence(); - } + if (_source39.is_RawExpr) { + return RAST.PrintingInfo.create_UnknownPrecedence(); } - if (unmatched39) { - if (_source39.is_ExprFromType) { - unmatched39 = false; - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } + if (_source39.is_ExprFromType) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (unmatched39) { - if (_source39.is_Identifier) { - unmatched39 = false; - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } + if (_source39.is_Identifier) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (unmatched39) { - if (_source39.is_LiteralInt) { - unmatched39 = false; - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } + if (_source39.is_LiteralInt) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (unmatched39) { - if (_source39.is_LiteralBool) { - unmatched39 = false; - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } + if (_source39.is_LiteralBool) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (unmatched39) { - if (_source39.is_LiteralString) { - unmatched39 = false; - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } + if (_source39.is_LiteralString) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (unmatched39) { - if (_source39.is_UnaryOp) { - Dafny.ISequence _967_op = _source39.dtor_op1; - RAST._IExpr _968_underlying = _source39.dtor_underlying; - DAST.Format._IUnaryOpFormat _969_format = _source39.dtor_format; - unmatched39 = false; - Dafny.ISequence _source40 = _967_op; - bool unmatched40 = true; - if (unmatched40) { - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("?"))) { - unmatched40 = false; - return RAST.PrintingInfo.create_SuffixPrecedence(new BigInteger(5)); - } - } - if (unmatched40) { - bool disjunctiveMatch2 = false; - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("-"))) { - disjunctiveMatch2 = true; - } - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("*"))) { - disjunctiveMatch2 = true; - } - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("!"))) { - disjunctiveMatch2 = true; - } - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("&"))) { - disjunctiveMatch2 = true; - } - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("&mut"))) { - disjunctiveMatch2 = true; - } - if (disjunctiveMatch2) { - unmatched40 = false; - return RAST.PrintingInfo.create_Precedence(new BigInteger(6)); - } - } - if (unmatched40) { - unmatched40 = false; - return RAST.PrintingInfo.create_UnknownPrecedence(); - } - throw new System.Exception("unexpected control point"); + if (_source39.is_UnaryOp) { + Dafny.ISequence _967_op = _source39.dtor_op1; + RAST._IExpr _968_underlying = _source39.dtor_underlying; + DAST.Format._IUnaryOpFormat _969_format = _source39.dtor_format; + Dafny.ISequence _source40 = _967_op; + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("?"))) { + return RAST.PrintingInfo.create_SuffixPrecedence(new BigInteger(5)); } - } - if (unmatched39) { - if (_source39.is_Select) { - RAST._IExpr _970_underlying = _source39.dtor_obj; - Dafny.ISequence _971_name = _source39.dtor_name; - unmatched39 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); + bool disjunctiveMatch2 = false; + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("-"))) { + disjunctiveMatch2 = true; } - } - if (unmatched39) { - if (_source39.is_MemberSelect) { - RAST._IExpr _972_underlying = _source39.dtor_obj; - Dafny.ISequence _973_name = _source39.dtor_name; - unmatched39 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("*"))) { + disjunctiveMatch2 = true; } - } - if (unmatched39) { - if (_source39.is_CallType) { - unmatched39 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("!"))) { + disjunctiveMatch2 = true; } - } - if (unmatched39) { - if (_source39.is_Call) { - unmatched39 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("&"))) { + disjunctiveMatch2 = true; } - } - if (unmatched39) { - if (_source39.is_TypeAscription) { - RAST._IExpr _974_left = _source39.dtor_left; - RAST._IType _975_tpe = _source39.dtor_tpe; - unmatched39 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(10), RAST.Associativity.create_LeftToRight()); + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("&mut"))) { + disjunctiveMatch2 = true; } - } - if (unmatched39) { - if (_source39.is_BinaryOp) { - Dafny.ISequence _976_op2 = _source39.dtor_op2; - RAST._IExpr _977_left = _source39.dtor_left; - RAST._IExpr _978_right = _source39.dtor_right; - DAST.Format._IBinaryOpFormat _979_format = _source39.dtor_format2; - unmatched39 = false; - Dafny.ISequence _source41 = _976_op2; - bool unmatched41 = true; - if (unmatched41) { - bool disjunctiveMatch3 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("*"))) { - disjunctiveMatch3 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("/"))) { - disjunctiveMatch3 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("%"))) { - disjunctiveMatch3 = true; - } - if (disjunctiveMatch3) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(20), RAST.Associativity.create_LeftToRight()); - } - } - if (unmatched41) { - bool disjunctiveMatch4 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("+"))) { - disjunctiveMatch4 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("-"))) { - disjunctiveMatch4 = true; - } - if (disjunctiveMatch4) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(30), RAST.Associativity.create_LeftToRight()); - } - } - if (unmatched41) { - bool disjunctiveMatch5 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<<"))) { - disjunctiveMatch5 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">>"))) { - disjunctiveMatch5 = true; - } - if (disjunctiveMatch5) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(40), RAST.Associativity.create_LeftToRight()); - } - } - if (unmatched41) { - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&"))) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(50), RAST.Associativity.create_LeftToRight()); - } - } - if (unmatched41) { - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("^"))) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(60), RAST.Associativity.create_LeftToRight()); - } - } - if (unmatched41) { - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("|"))) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(70), RAST.Associativity.create_LeftToRight()); - } - } - if (unmatched41) { - bool disjunctiveMatch6 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("=="))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("!="))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<"))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">"))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<="))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">="))) { - disjunctiveMatch6 = true; - } - if (disjunctiveMatch6) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(80), RAST.Associativity.create_RequiresParentheses()); - } - } - if (unmatched41) { - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&&"))) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(90), RAST.Associativity.create_LeftToRight()); - } - } - if (unmatched41) { - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("||"))) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(100), RAST.Associativity.create_LeftToRight()); - } - } - if (unmatched41) { - bool disjunctiveMatch7 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(".."))) { - disjunctiveMatch7 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("..="))) { - disjunctiveMatch7 = true; - } - if (disjunctiveMatch7) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RequiresParentheses()); - } - } - if (unmatched41) { - bool disjunctiveMatch8 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("+="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("-="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("*="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("/="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("%="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("|="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("^="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<<="))) { - disjunctiveMatch8 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">>="))) { - disjunctiveMatch8 = true; - } - if (disjunctiveMatch8) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RightToLeft()); - } - } - if (unmatched41) { - unmatched41 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(BigInteger.Zero, RAST.Associativity.create_RequiresParentheses()); - } - throw new System.Exception("unexpected control point"); + if (disjunctiveMatch2) { + return RAST.PrintingInfo.create_Precedence(new BigInteger(6)); } + return RAST.PrintingInfo.create_UnknownPrecedence(); } - if (unmatched39) { - if (_source39.is_Lambda) { - unmatched39 = false; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(300), RAST.Associativity.create_LeftToRight()); + if (_source39.is_Select) { + RAST._IExpr _970_underlying = _source39.dtor_obj; + Dafny.ISequence _971_name = _source39.dtor_name; + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); + } + if (_source39.is_MemberSelect) { + RAST._IExpr _972_underlying = _source39.dtor_obj; + Dafny.ISequence _973_name = _source39.dtor_name; + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); + } + if (_source39.is_CallType) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); + } + if (_source39.is_Call) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); + } + if (_source39.is_TypeAscription) { + RAST._IExpr _974_left = _source39.dtor_left; + RAST._IType _975_tpe = _source39.dtor_tpe; + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(10), RAST.Associativity.create_LeftToRight()); + } + if (_source39.is_BinaryOp) { + Dafny.ISequence _976_op2 = _source39.dtor_op2; + RAST._IExpr _977_left = _source39.dtor_left; + RAST._IExpr _978_right = _source39.dtor_right; + DAST.Format._IBinaryOpFormat _979_format = _source39.dtor_format2; + Dafny.ISequence _source41 = _976_op2; + bool disjunctiveMatch3 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("*"))) { + disjunctiveMatch3 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("/"))) { + disjunctiveMatch3 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("%"))) { + disjunctiveMatch3 = true; + } + if (disjunctiveMatch3) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(20), RAST.Associativity.create_LeftToRight()); + } + bool disjunctiveMatch4 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("+"))) { + disjunctiveMatch4 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("-"))) { + disjunctiveMatch4 = true; + } + if (disjunctiveMatch4) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(30), RAST.Associativity.create_LeftToRight()); + } + bool disjunctiveMatch5 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<<"))) { + disjunctiveMatch5 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">>"))) { + disjunctiveMatch5 = true; + } + if (disjunctiveMatch5) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(40), RAST.Associativity.create_LeftToRight()); } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(50), RAST.Associativity.create_LeftToRight()); + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("^"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(60), RAST.Associativity.create_LeftToRight()); + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("|"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(70), RAST.Associativity.create_LeftToRight()); + } + bool disjunctiveMatch6 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("=="))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("!="))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<"))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">"))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<="))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">="))) { + disjunctiveMatch6 = true; + } + if (disjunctiveMatch6) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(80), RAST.Associativity.create_RequiresParentheses()); + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&&"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(90), RAST.Associativity.create_LeftToRight()); + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("||"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(100), RAST.Associativity.create_LeftToRight()); + } + bool disjunctiveMatch7 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(".."))) { + disjunctiveMatch7 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("..="))) { + disjunctiveMatch7 = true; + } + if (disjunctiveMatch7) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RequiresParentheses()); + } + bool disjunctiveMatch8 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("+="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("-="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("*="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("/="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("%="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("|="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("^="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<<="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">>="))) { + disjunctiveMatch8 = true; + } + if (disjunctiveMatch8) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RightToLeft()); + } + return RAST.PrintingInfo.create_PrecedenceAssociativity(BigInteger.Zero, RAST.Associativity.create_RequiresParentheses()); } - if (unmatched39) { - unmatched39 = false; - return RAST.PrintingInfo.create_UnknownPrecedence(); + if (_source39.is_Lambda) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(300), RAST.Associativity.create_LeftToRight()); } - throw new System.Exception("unexpected control point"); + return RAST.PrintingInfo.create_UnknownPrecedence(); } } } public class Expr_RawExpr : Expr { @@ -6208,34 +5826,18 @@ public Std.Wrappers._IOption dtor_body { return (_981_formal)._ToString(_980_ind); })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")), ((System.Func>)(() => { Std.Wrappers._IOption _source42 = (this).dtor_returnType; - bool unmatched42 = true; - if (unmatched42) { - if (_source42.is_Some) { - RAST._IType _982_t = _source42.dtor_value; - unmatched42 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" -> "), (_982_t)._ToString(_pat_let_tv97)); - } + if (_source42.is_Some) { + RAST._IType _982_t = _source42.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" -> "), (_982_t)._ToString(_pat_let_tv97)); } - if (unmatched42) { - unmatched42 = false; - return Dafny.Sequence.UnicodeFromString(""); - } - throw new System.Exception("unexpected control point"); + return Dafny.Sequence.UnicodeFromString(""); }))()), ((((this).dtor_where).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind), RAST.__default.IND), (this).dtor_where)))), ((System.Func>)(() => { Std.Wrappers._IOption _source43 = (this).dtor_body; - bool unmatched43 = true; - if (unmatched43) { - if (_source43.is_None) { - unmatched43 = false; - return Dafny.Sequence.UnicodeFromString(";"); - } - } - if (unmatched43) { - RAST._IExpr _983_body = _source43.dtor_value; - unmatched43 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" {\n"), _pat_let_tv98), RAST.__default.IND), (_983_body)._ToString(Dafny.Sequence.Concat(_pat_let_tv99, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv100), Dafny.Sequence.UnicodeFromString("}")); + if (_source43.is_None) { + return Dafny.Sequence.UnicodeFromString(";"); } - throw new System.Exception("unexpected control point"); + RAST._IExpr _983_body = _source43.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" {\n"), _pat_let_tv98), RAST.__default.IND), (_983_body)._ToString(Dafny.Sequence.Concat(_pat_let_tv99, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv100), Dafny.Sequence.UnicodeFromString("}")); }))()); } } diff --git a/Source/DafnyCore/GeneratedFromDafny/Std_Wrappers.cs b/Source/DafnyCore/GeneratedFromDafny/Std_Wrappers.cs index c93d46b98b5..ff89fe15313 100644 --- a/Source/DafnyCore/GeneratedFromDafny/Std_Wrappers.cs +++ b/Source/DafnyCore/GeneratedFromDafny/Std_Wrappers.cs @@ -69,53 +69,29 @@ public T Extract() { public static T GetOr(Std.Wrappers._IOption _this, T @default) { var _pat_let_tv0 = @default; Std.Wrappers._IOption _source0 = _this; - bool unmatched0 = true; - if (unmatched0) { - if (_source0.is_Some) { - T v = _source0.dtor_value; - unmatched0 = false; - return v; - } + if (_source0.is_Some) { + T v = _source0.dtor_value; + return v; } - if (unmatched0) { - unmatched0 = false; - return _pat_let_tv0; - } - throw new System.Exception("unexpected control point"); + return _pat_let_tv0; } public Std.Wrappers._IResult ToResult<__E>(__E error) { var _pat_let_tv1 = error; Std.Wrappers._IOption _source1 = this; - bool unmatched1 = true; - if (unmatched1) { - if (_source1.is_Some) { - T v = _source1.dtor_value; - unmatched1 = false; - return Std.Wrappers.Result.create_Success(v); - } - } - if (unmatched1) { - unmatched1 = false; - return Std.Wrappers.Result.create_Failure(_pat_let_tv1); + if (_source1.is_Some) { + T v = _source1.dtor_value; + return Std.Wrappers.Result.create_Success(v); } - throw new System.Exception("unexpected control point"); + return Std.Wrappers.Result.create_Failure(_pat_let_tv1); } public Std.Wrappers._IOutcome<__E> ToOutcome<__E>(__E error) { var _pat_let_tv2 = error; Std.Wrappers._IOption _source2 = this; - bool unmatched2 = true; - if (unmatched2) { - if (_source2.is_Some) { - T v = _source2.dtor_value; - unmatched2 = false; - return Std.Wrappers.Outcome<__E>.create_Pass(); - } - } - if (unmatched2) { - unmatched2 = false; - return Std.Wrappers.Outcome<__E>.create_Fail(_pat_let_tv2); + if (_source2.is_Some) { + T v = _source2.dtor_value; + return Std.Wrappers.Outcome<__E>.create_Pass(); } - throw new System.Exception("unexpected control point"); + return Std.Wrappers.Outcome<__E>.create_Fail(_pat_let_tv2); } public static __FC Map<__FC>(Std.Wrappers._IOption _this, Func, __FC> rewrap) { return Dafny.Helpers.Id, __FC>>(rewrap)(_this); @@ -224,54 +200,30 @@ public R Extract() { public static R GetOr(Std.Wrappers._IResult _this, R @default) { var _pat_let_tv3 = @default; Std.Wrappers._IResult _source3 = _this; - bool unmatched3 = true; - if (unmatched3) { - if (_source3.is_Success) { - R s = _source3.dtor_value; - unmatched3 = false; - return s; - } + if (_source3.is_Success) { + R s = _source3.dtor_value; + return s; } - if (unmatched3) { - E e = _source3.dtor_error; - unmatched3 = false; - return _pat_let_tv3; - } - throw new System.Exception("unexpected control point"); + E e = _source3.dtor_error; + return _pat_let_tv3; } public Std.Wrappers._IOption ToOption() { Std.Wrappers._IResult _source4 = this; - bool unmatched4 = true; - if (unmatched4) { - if (_source4.is_Success) { - R s = _source4.dtor_value; - unmatched4 = false; - return Std.Wrappers.Option.create_Some(s); - } - } - if (unmatched4) { - E _10_e = _source4.dtor_error; - unmatched4 = false; - return Std.Wrappers.Option.create_None(); + if (_source4.is_Success) { + R s = _source4.dtor_value; + return Std.Wrappers.Option.create_Some(s); } - throw new System.Exception("unexpected control point"); + E _10_e = _source4.dtor_error; + return Std.Wrappers.Option.create_None(); } public Std.Wrappers._IOutcome ToOutcome() { Std.Wrappers._IResult _source5 = this; - bool unmatched5 = true; - if (unmatched5) { - if (_source5.is_Success) { - R _11_s = _source5.dtor_value; - unmatched5 = false; - return Std.Wrappers.Outcome.create_Pass(); - } - } - if (unmatched5) { - E _12_e = _source5.dtor_error; - unmatched5 = false; - return Std.Wrappers.Outcome.create_Fail(_12_e); + if (_source5.is_Success) { + R _11_s = _source5.dtor_value; + return Std.Wrappers.Outcome.create_Pass(); } - throw new System.Exception("unexpected control point"); + E _12_e = _source5.dtor_error; + return Std.Wrappers.Outcome.create_Fail(_12_e); } public static __FC Map<__FC>(Std.Wrappers._IResult _this, Func, __FC> rewrap) { return Dafny.Helpers.Id, __FC>>(rewrap)(_this); @@ -279,20 +231,12 @@ public static __FC Map<__FC>(Std.Wrappers._IResult _this, Func MapFailure<__NewE>(Std.Wrappers._IResult _this, Func reWrap) { var _pat_let_tv4 = reWrap; Std.Wrappers._IResult _source6 = _this; - bool unmatched6 = true; - if (unmatched6) { - if (_source6.is_Success) { - R _13_s = _source6.dtor_value; - unmatched6 = false; - return Std.Wrappers.Result.create_Success(_13_s); - } - } - if (unmatched6) { - E _14_e = _source6.dtor_error; - unmatched6 = false; - return Std.Wrappers.Result.create_Failure(Dafny.Helpers.Id>(_pat_let_tv4)(_14_e)); + if (_source6.is_Success) { + R _13_s = _source6.dtor_value; + return Std.Wrappers.Result.create_Success(_13_s); } - throw new System.Exception("unexpected control point"); + E _14_e = _source6.dtor_error; + return Std.Wrappers.Result.create_Failure(Dafny.Helpers.Id>(_pat_let_tv4)(_14_e)); } } public class Result_Success : Result { @@ -393,36 +337,20 @@ public Std.Wrappers._IOutcome PropagateFailure() { public Std.Wrappers._IOption<__R> ToOption<__R>(__R r) { var _pat_let_tv5 = r; Std.Wrappers._IOutcome _source7 = this; - bool unmatched7 = true; - if (unmatched7) { - if (_source7.is_Pass) { - unmatched7 = false; - return Std.Wrappers.Option<__R>.create_Some(_pat_let_tv5); - } - } - if (unmatched7) { - E _15_e = _source7.dtor_error; - unmatched7 = false; - return Std.Wrappers.Option<__R>.create_None(); + if (_source7.is_Pass) { + return Std.Wrappers.Option<__R>.create_Some(_pat_let_tv5); } - throw new System.Exception("unexpected control point"); + E _15_e = _source7.dtor_error; + return Std.Wrappers.Option<__R>.create_None(); } public Std.Wrappers._IResult<__R, E> ToResult<__R>(__R r) { var _pat_let_tv6 = r; Std.Wrappers._IOutcome _source8 = this; - bool unmatched8 = true; - if (unmatched8) { - if (_source8.is_Pass) { - unmatched8 = false; - return Std.Wrappers.Result<__R, E>.create_Success(_pat_let_tv6); - } + if (_source8.is_Pass) { + return Std.Wrappers.Result<__R, E>.create_Success(_pat_let_tv6); } - if (unmatched8) { - E _16_e = _source8.dtor_error; - unmatched8 = false; - return Std.Wrappers.Result<__R, E>.create_Failure(_16_e); - } - throw new System.Exception("unexpected control point"); + E _16_e = _source8.dtor_error; + return Std.Wrappers.Result<__R, E>.create_Failure(_16_e); } public static __FC Map<__FC>(Std.Wrappers._IOutcome _this, Func, __FC> rewrap) { return Dafny.Helpers.Id, __FC>>(rewrap)(_this); @@ -432,19 +360,11 @@ public static Std.Wrappers._IResult<__T, __NewE> MapFailure<__T, __NewE>(Std.Wra var _pat_let_tv7 = @default; var _pat_let_tv8 = rewrap; Std.Wrappers._IOutcome _source9 = _this; - bool unmatched9 = true; - if (unmatched9) { - if (_source9.is_Pass) { - unmatched9 = false; - return Std.Wrappers.Result<__T, __NewE>.create_Success(_pat_let_tv7); - } - } - if (unmatched9) { - E _17_e = _source9.dtor_error; - unmatched9 = false; - return Std.Wrappers.Result<__T, __NewE>.create_Failure(Dafny.Helpers.Id>(_pat_let_tv8)(_17_e)); + if (_source9.is_Pass) { + return Std.Wrappers.Result<__T, __NewE>.create_Success(_pat_let_tv7); } - throw new System.Exception("unexpected control point"); + E _17_e = _source9.dtor_error; + return Std.Wrappers.Result<__T, __NewE>.create_Failure(Dafny.Helpers.Id>(_pat_let_tv8)(_17_e)); } public static Std.Wrappers._IOutcome Need(bool condition, E error) { From 8e392d9ec020834736fbcaf15e152aeb5e861248 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Mon, 8 Jul 2024 09:29:13 -0700 Subject: [PATCH 18/30] chore: Code improvements --- Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs | 2 +- .../Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs b/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs index a8007611a29..519993cac61 100644 --- a/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs +++ b/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs @@ -1990,7 +1990,7 @@ protected override void EmitReturnExpr(Expression expr, Type resultType, bool in var w = EmitReturnExpr(wr); var fromType = thisContext == null ? expr.Type : expr.Type.Subst(thisContext.ParentFormalTypeParametersToActuals); w = EmitCoercionIfNecessary(fromType, resultType, expr.tok, w); - w.Append(Expr(expr, inLetExprBody, wStmts)); + EmitExpr(expr, inLetExprBody, w, wStmts); } protected void EmitReturnWithCoercions(List outParams, List/*?*/ overriddenOutParams, Dictionary/*?*/ typeMap, ConcreteSyntaxTree wr) { diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index 424be425fba..52a8e920a05 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -2870,7 +2870,7 @@ void TrCasePatternOpt(CasePattern pat, Expression rhs, Action Date: Mon, 8 Jul 2024 09:36:09 -0700 Subject: [PATCH 19/30] fix: Revert the added downcast for exprs being returned --- .../Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index 52a8e920a05..975a41512ca 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -577,7 +577,6 @@ protected virtual void EmitSetterParameter(ConcreteSyntaxTree wr) { var wStmts = wr.Fork(); var w = EmitReturnExpr(wr); w = EmitCoercionIfNecessary(expr.Type, resultType, expr.tok, w); - w = EmitDowncastIfNecessary(expr.Type, resultType, expr.tok, w); EmitExpr(expr, inLetExprBody, w, wStmts); } protected virtual void EmitReturnExpr(string returnExpr, ConcreteSyntaxTree wr) { // emits "return ;" for function bodies From 64c784064e19cdc618d4701a69ac9c86663bace3 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Mon, 8 Jul 2024 09:36:43 -0700 Subject: [PATCH 20/30] Improve and unify code --- Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs | 8 -------- .../SinglePassCodeGenerator/SinglePassCodeGenerator.cs | 9 +++++---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs b/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs index 519993cac61..b58d76580f5 100644 --- a/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs +++ b/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs @@ -1985,14 +1985,6 @@ protected override void EmitReturn(List outParams, ConcreteSyntaxTree wr EmitReturnWithCoercions(outParams, null, null, wr); } - protected override void EmitReturnExpr(Expression expr, Type resultType, bool inLetExprBody, ConcreteSyntaxTree wr) { - var wStmts = wr.Fork(); - var w = EmitReturnExpr(wr); - var fromType = thisContext == null ? expr.Type : expr.Type.Subst(thisContext.ParentFormalTypeParametersToActuals); - w = EmitCoercionIfNecessary(fromType, resultType, expr.tok, w); - EmitExpr(expr, inLetExprBody, w, wStmts); - } - protected void EmitReturnWithCoercions(List outParams, List/*?*/ overriddenOutParams, Dictionary/*?*/ typeMap, ConcreteSyntaxTree wr) { wr.Write("return"); var sep = " "; diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index 975a41512ca..0e6b5547bc3 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -573,11 +573,12 @@ protected virtual void EmitSetterParameter(ConcreteSyntaxTree wr) { } protected abstract void EmitPrintStmt(ConcreteSyntaxTree wr, Expression arg); protected abstract void EmitReturn(List outParams, ConcreteSyntaxTree wr); - protected virtual void EmitReturnExpr(Expression expr, Type resultType, bool inLetExprBody, ConcreteSyntaxTree wr) { // emits "return ;" for function bodies + protected void EmitReturnExpr(Expression expr, Type resultType, bool inLetExprBody, ConcreteSyntaxTree wr) { // emits "return ;" for function bodies var wStmts = wr.Fork(); - var w = EmitReturnExpr(wr); - w = EmitCoercionIfNecessary(expr.Type, resultType, expr.tok, w); - EmitExpr(expr, inLetExprBody, w, wStmts); + wr = EmitReturnExpr(wr); + var fromType = thisContext == null ? expr.Type : expr.Type.Subst(thisContext.ParentFormalTypeParametersToActuals); + wr = EmitCoercionIfNecessary(fromType, resultType, expr.tok, wr); + EmitExpr(expr, inLetExprBody, wr, wStmts); } protected virtual void EmitReturnExpr(string returnExpr, ConcreteSyntaxTree wr) { // emits "return ;" for function bodies var w = EmitReturnExpr(wr); From 64ba677f984d74274e3c27d14b25981c47ff45d9 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Mon, 8 Jul 2024 11:15:26 -0700 Subject: [PATCH 21/30] chore: Improve code --- .../SinglePassCodeGenerator.Statement.cs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index 341fcf7abd0..8864d2ad1f6 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -610,21 +610,18 @@ private ConcreteSyntaxTree EmitNestedMatchCaseConditions(string sourceName, Type var right = new ConcreteSyntaxTree(); EmitExpr(litExpression, false, right, writer); EmitBinaryExprUsingConcreteSyntax(guardWriter, Type.Bool, preOpString, opString, new LineSegment(sourceName), right, callString, staticCallString, postOpString); - writer = thenWriter; + return thenWriter; } else if (pattern is IdPattern idPattern) { - if (idPattern.BoundVar != null) { - if (idPattern.BoundVar.Tok.val.StartsWith(IdPattern.WildcardString)) { - return writer; - } - - var boundVar = idPattern.BoundVar; + if (idPattern.BoundVar == null) { + return EmitNestedMatchStmtCaseConstructor(sourceName, sourceType, idPattern, writer, lastCase); + } + var boundVar = idPattern.BoundVar; + if (!boundVar.Tok.val.StartsWith(IdPattern.WildcardString)) { var valueWriter = DeclareLocalVar(IdName(boundVar), boundVar.Type, idPattern.Tok, writer); valueWriter.Write(sourceName); - return writer; - } else { - writer = EmitNestedMatchStmtCaseConstructor(sourceName, sourceType, idPattern, writer, lastCase); } + return writer; } else if (pattern is DisjunctivePattern disjunctivePattern) { if (lastCase) { @@ -639,12 +636,11 @@ private ConcreteSyntaxTree EmitNestedMatchCaseConditions(string sourceName, Type } writer = EmitIf(out var guardWriter, false, writer); guardWriter.Write(disjunctiveMatch); + return writer; } else { throw new Exception(); } - - return writer; } private ConcreteSyntaxTree EmitNestedMatchStmtCaseConstructor(string sourceName, Type sourceType, From 498ed9ce1ab676e704ced307c551b577bd3fe99b Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Mon, 8 Jul 2024 11:15:53 -0700 Subject: [PATCH 22/30] fix: Always wrap a block around each case --- .../SinglePassCodeGenerator.Statement.cs | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index 8864d2ad1f6..5f24f9e78b4 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -542,25 +542,29 @@ protected virtual void EmitNestedMatchStmt(NestedMatchStmt match, ConcreteSyntax /// Else, emit: /// /// BLOCK { - /// var unmatched = true; - /// if (unmatched && a is X) { - /// var x1 = ((X)a).1; - /// if (x1 is Y) { - /// var b = ((Y)x1).1; + /// { // this defines the scope for any new local variables in the case + /// if (a is X) { + /// var x0 = ((X)a).0; + /// if (x0 is Y) { + /// var b = ((Y)x0).0; /// - /// var x2 = ((X)a).2; - /// if (x2 is Z) { - /// var x4 = ((Z)x2).1; - /// if (x4 is W) { - /// var c = ((W)x4).1; - /// body1; + /// var x1 = ((X)a).1; + /// if (x1 is Z) { + /// var xz0 = ((Z)x1).0; + /// if (xz0 is W) { + /// var c = ((W)xz0).0; + /// + /// body1; + /// break BLOCK; /// } /// } /// } - /// break BLOCK; /// } - /// var r = a; - /// body2; + /// + /// { + /// var r = a; + /// body2; + /// } /// } /// /// @@ -582,7 +586,9 @@ private void EmitNestedMatchGeneric(INestedMatch match, bool preventCaseFallThro for (var index = 0; index < match.Cases.Count; index++) { var myCase = match.Cases[index]; var lastCase = index == match.Cases.Count - 1; - var innerWriter = EmitNestedMatchCaseConditions(sourceName, sourceType, myCase.Pat, output, lastCase); + + var caseBlock = EmitBlock(output); + var innerWriter = EmitNestedMatchCaseConditions(sourceName, sourceType, myCase.Pat, caseBlock, lastCase); Coverage.Instrument(myCase.Tok, "case body", innerWriter); emitBody(index, innerWriter); From 065b415039d12114db3e4b0d7e783764a2928c27 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Mon, 8 Jul 2024 17:31:40 -0700 Subject: [PATCH 23/30] fix: Rename override-member type parameters --- Source/DafnyCore/AST/Members/Function.cs | 13 +++++++++++++ .../SinglePassCodeGenerator.cs | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/DafnyCore/AST/Members/Function.cs b/Source/DafnyCore/AST/Members/Function.cs index 7a901fe1917..84f6940a220 100644 --- a/Source/DafnyCore/AST/Members/Function.cs +++ b/Source/DafnyCore/AST/Members/Function.cs @@ -96,6 +96,19 @@ public TailStatus public readonly Formal Result; public PreType ResultPreType; public readonly Type ResultType; + public Type OriginalResultTypeWithRenamings() { + if (OverriddenFunction == null) { + return ResultType; + } + + Contract.Assert(TypeArgs.Count == OverriddenFunction.TypeArgs.Count); + var renamings = new Dictionary(); + for (var i = 0; i < TypeArgs.Count; i++) { + renamings.Add(OverriddenFunction.TypeArgs[i], new UserDefinedType(tok, TypeArgs[i])); + } + return OverriddenFunction.ResultType.Subst(renamings); + + } public Expression Body; // an extended expression; Body is readonly after construction, except for any kind of rewrite that may take place around the time of resolution public IToken /*?*/ ByMethodTok; // null iff ByMethodBody is null public BlockStmt /*?*/ ByMethodBody; diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index 0e6b5547bc3..431f37963dd 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -578,6 +578,7 @@ protected virtual void EmitSetterParameter(ConcreteSyntaxTree wr) { wr = EmitReturnExpr(wr); var fromType = thisContext == null ? expr.Type : expr.Type.Subst(thisContext.ParentFormalTypeParametersToActuals); wr = EmitCoercionIfNecessary(fromType, resultType, expr.tok, wr); + wr = EmitDowncastIfNecessary(fromType, resultType, expr.tok, wr); EmitExpr(expr, inLetExprBody, wr, wStmts); } protected virtual void EmitReturnExpr(string returnExpr, ConcreteSyntaxTree wr) { // emits "return ;" for function bodies @@ -2748,7 +2749,7 @@ private void CompileFunction(Function f, IClassWriter cw, bool lookasideBody) { Coverage.Instrument(f.Body.tok, $"entry to function {f.FullName}", w); Contract.Assert(enclosingFunction == null); enclosingFunction = f; - CompileReturnBody(f.Body, f.Original.ResultType, w, accVar); + CompileReturnBody(f.Body, f.OriginalResultTypeWithRenamings(), w, accVar); Contract.Assert(enclosingFunction == f); enclosingFunction = null; } From 7da8a60ac05842c9e8f6ac37774a9104867befd4 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Mon, 8 Jul 2024 17:41:38 -0700 Subject: [PATCH 24/30] refactor: Extract method TrTailCall --- .../SinglePassCodeGenerator.Statement.cs | 2 +- .../SinglePassCodeGenerator.cs | 83 +++++-------------- 2 files changed, 21 insertions(+), 64 deletions(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs index 5f24f9e78b4..53b1fd38c56 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Statement.cs @@ -124,7 +124,7 @@ protected void TrStmt(Statement stmt, ConcreteSyntaxTree wr, ConcreteSyntaxTree } else { var eRhs = (ExprRhs)s.Rhs; if (eRhs.Expr.Resolved is FunctionCallExpr fce && IsTailRecursiveByMethodCall(fce)) { - TrTailCallStmt(s.Tok, fce.Function.ByMethodDecl, fce.Receiver, fce.Args, null, wr); + TrTailCallStmt(s.Tok, fce.Function.ByMethodDecl, fce.Receiver, fce.Args, wr); } else { var lvalue = CreateLvalue(s.Lhs, wr, wStmts); var doAssignment = (Expression e, Type resultType, bool inLetExprBody, ConcreteSyntaxTree wrAssignment) => { diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index 431f37963dd..ed4c064c04f 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -3014,57 +3014,8 @@ protected void TrExprOpt(Expression expr, Type resultType, ConcreteSyntaxTree wr } else if (expr is FunctionCallExpr fce && fce.Function == enclosingFunction && enclosingFunction.IsTailRecursive) { var e = fce; // compile call as tail-recursive - - // assign the actual in-parameters to temporary variables - var inTmps = new List(); - var inTypes = new List(); - if (!e.Function.IsStatic) { - string inTmp = ProtectedFreshId("_in"); - inTmps.Add(inTmp); - inTypes.Add(null); - DeclareLocalVar(inTmp, null, null, e.Receiver, inLetExprBody, wr); - } - for (int i = 0; i < e.Function.Ins.Count; i++) { - Formal p = e.Function.Ins[i]; - if (!p.IsGhost) { - string inTmp = ProtectedFreshId("_in"); - inTmps.Add(inTmp); - inTypes.Add(e.Args[i].Type); - DeclareLocalVar(inTmp, e.Args[i].Type, p.tok, e.Args[i], inLetExprBody, wr); - } - } - // Now, assign to the formals - int n = 0; - if (!e.Function.IsStatic) { - ConcreteSyntaxTree wRHS = EmitAssignment(IdentLvalue("_this"), null, null, wr, e.tok); - if (thisContext == null) { - wRHS = wr; - } else { - var instantiatedType = e.Receiver.Type.Subst(thisContext.ParentFormalTypeParametersToActuals); - - var contextType = UserDefinedType.FromTopLevelDecl(e.tok, thisContext); - if (contextType.ResolvedClass is ClassLikeDecl { NonNullTypeDecl: { } } cls) { - contextType = UserDefinedType.FromTopLevelDecl(e.tok, cls.NonNullTypeDecl); - } - - wRHS = EmitCoercionIfNecessary(instantiatedType, contextType, e.tok, wRHS); - } - EmitIdentifier(inTmps[n], wRHS); - EndStmt(wr); - n++; - } - foreach (var p in e.Function.Ins) { - if (!p.IsGhost) { - EmitIdentifier( - inTmps[n], - EmitAssignment(IdentLvalue(IdName(p)), p.Type, inTypes[n], wr, e.tok) - ); - n++; - } - } - Contract.Assert(n == inTmps.Count); - // finally, the jump back to the head of the function - EmitJumpToTailCallStart(wr); + Contract.Assert(!inLetExprBody); // a tail call had better not sit inside a target-code lambda + TrTailCall(e.tok, e.Function.IsStatic, e.Function.Ins, e.Receiver, e.Args, wr); } else if (expr is BinaryExpr bin && bin.AccumulatesForTailRecursion != BinaryExpr.AccumulationOperand.None @@ -4374,13 +4325,18 @@ private static Type TypeOfRhs(AssignmentRhs rhs) { } } + /// + /// Emit translation of a call statement. + /// The "receiverReplacement" parameter is allowed to be "null". It must be null for tail recursive calls. + /// protected virtual void TrCallStmt(CallStmt s, string receiverReplacement, ConcreteSyntaxTree wr, ConcreteSyntaxTree wStmts, ConcreteSyntaxTree wStmtsAfterCall) { Contract.Requires(s != null); Contract.Assert(s.Method != null); // follows from the fact that stmt has been successfully resolved if (s.Method == enclosingMethod && enclosingMethod.IsTailRecursive) { // compile call as tail-recursive - TrTailCallStmt(s.Tok, s.Method, s.Receiver, s.Args, receiverReplacement, wr); + Contract.Assert(receiverReplacement == null); // "receiverReplacement" is expected to be "null" for tail recursive calls + TrTailCallStmt(s.Tok, s.Method, s.Receiver, s.Args, wr); } else { // compile call as a regular call var lvalues = new List(); // contains an entry for each non-ghost formal out-parameter, but the entry is null if the actual out-parameter is ghost @@ -4576,29 +4532,30 @@ protected virtual void TrCallStmt(CallStmt s, string receiverReplacement, Concre } } - void TrTailCallStmt(IToken tok, Method method, Expression receiver, List args, string receiverReplacement, ConcreteSyntaxTree wr) { + void TrTailCallStmt(IToken tok, Method method, Expression receiver, List args, ConcreteSyntaxTree wr) { Contract.Requires(tok != null); Contract.Requires(method != null); Contract.Requires(receiver != null); Contract.Requires(args != null); Contract.Requires(method.IsTailRecursive); Contract.Requires(wr != null); + TrTailCall(tok, method.IsStatic, method.Ins, receiver, args, wr); + } + void TrTailCall(IToken tok, bool isStatic, List inParameters, Expression receiver, List args, ConcreteSyntaxTree wr) { // assign the actual in-parameters to temporary variables var inTmps = new List(); - var inTypes = new List(); - if (receiverReplacement != null) { - // TODO: What to do here? When does this happen, what does it mean? - } else if (!method.IsStatic) { - string inTmp = ProtectedFreshId("_in"); + var inTypes = new List(); + if (!isStatic) { + var inTmp = ProtectedFreshId("_in"); inTmps.Add(inTmp); inTypes.Add(null); DeclareLocalVar(inTmp, null, null, receiver, false, wr); } - for (int i = 0; i < method.Ins.Count; i++) { - Formal p = method.Ins[i]; + for (int i = 0; i < inParameters.Count; i++) { + var p = inParameters[i]; if (!p.IsGhost) { - string inTmp = ProtectedFreshId("_in"); + var inTmp = ProtectedFreshId("_in"); inTmps.Add(inTmp); inTypes.Add(args[i].Type); DeclareLocalVar(inTmp, args[i].Type, p.tok, args[i], false, wr); @@ -4606,7 +4563,7 @@ void TrTailCallStmt(IToken tok, Method method, Expression receiver, List Date: Mon, 8 Jul 2024 17:42:11 -0700 Subject: [PATCH 25/30] =?UTF-8?q?fix:=20Pass=20=E2=80=9CinLetExprBody?= =?UTF-8?q?=E2=80=9D=20through?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SinglePassCodeGenerator.Expression.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs index bb2fe08eddc..74a7e73007b 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.Expression.cs @@ -722,7 +722,7 @@ protected virtual void TrOptNestedMatchExpr(NestedMatchExpr match, Type resultTy EmitNestedMatchGeneric(match, continuation.PreventCaseFallThrough, (caseIndex, caseBody) => { var myCase = match.Cases[caseIndex]; - TrExprOpt(myCase.Body, myCase.Body.Type, caseBody, wStmts, inLetExprBody: true, accumulatorVar: null, continuation); + TrExprOpt(myCase.Body, myCase.Body.Type, caseBody, wStmts, inLetExprBody, accumulatorVar: null, continuation); }, inLetExprBody, wr); } From 7742cd85db1132ec7a39cbec3b2938de62874238 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Mon, 8 Jul 2024 17:42:36 -0700 Subject: [PATCH 26/30] Add comment to test file --- .../TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy index a8de65a62c0..52ae2d329a5 100644 --- a/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy +++ b/Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-5597.dfy @@ -1,5 +1,9 @@ // RUN: %testDafnyForEachCompiler "%s" +// Note, these tests seem to be specific to the old type system. With the new type system, +// assignments that, in some way, involve a conversion from Number to Integer require an +// explicit "as" type conversion. + method Main() { var n: set := {}; var s: set; From f7763ab5be366935210ad886fd69ca9827bfa9e2 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Mon, 8 Jul 2024 21:26:06 -0700 Subject: [PATCH 27/30] Regenerate Dafny code --- Source/DafnyCore/GeneratedFromDafny/DCOMP.cs | 6694 +++++++++-------- Source/DafnyCore/GeneratedFromDafny/RAST.cs | 1782 +++-- .../GeneratedFromDafny/Std_Wrappers.cs | 137 +- 3 files changed, 4608 insertions(+), 4005 deletions(-) diff --git a/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs b/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs index f3f115c0841..326d98c9762 100644 --- a/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs +++ b/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs @@ -412,42 +412,52 @@ public RAST._IMod GenModule(DAST._IModule mod, Dafny.ISequence _1012_generated = Dafny.Sequence.Empty; DAST._IModuleItem _source44 = (body).Select(_1011_i); - if (_source44.is_Module) { - DAST._IModule _1013_m = _source44.dtor_Module_a0; - RAST._IMod _1014_mm; - RAST._IMod _out16; - _out16 = (this).GenModule(_1013_m, containingPath); - _1014_mm = _out16; - _1012_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_ModDecl(_1014_mm)); - goto after_match1; - } - if (_source44.is_Class) { - DAST._IClass _1015_c = _source44.dtor_Class_a0; - Dafny.ISequence _out17; - _out17 = (this).GenClass(_1015_c, Dafny.Sequence>.Concat(containingPath, Dafny.Sequence>.FromElements((_1015_c).dtor_name))); - _1012_generated = _out17; - goto after_match1; - } - if (_source44.is_Trait) { - DAST._ITrait _1016_t = _source44.dtor_Trait_a0; - Dafny.ISequence _1017_tt; - Dafny.ISequence _out18; - _out18 = (this).GenTrait(_1016_t, containingPath); - _1017_tt = _out18; - _1012_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_RawDecl(_1017_tt)); - goto after_match1; - } - if (_source44.is_Newtype) { - DAST._INewtype _1018_n = _source44.dtor_Newtype_a0; - Dafny.ISequence _out19; - _out19 = (this).GenNewtype(_1018_n); - _1012_generated = _out19; - goto after_match1; - } - DAST._IDatatype _1019_d = _source44.dtor_Datatype_a0; - Dafny.ISequence _out20; - _out20 = (this).GenDatatype(_1019_d); - _1012_generated = _out20; + { + if (_source44.is_Module) { + DAST._IModule _1013_m = _source44.dtor_Module_a0; + RAST._IMod _1014_mm; + RAST._IMod _out16; + _out16 = (this).GenModule(_1013_m, containingPath); + _1014_mm = _out16; + _1012_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_ModDecl(_1014_mm)); + goto after_match1; + } + } + { + if (_source44.is_Class) { + DAST._IClass _1015_c = _source44.dtor_Class_a0; + Dafny.ISequence _out17; + _out17 = (this).GenClass(_1015_c, Dafny.Sequence>.Concat(containingPath, Dafny.Sequence>.FromElements((_1015_c).dtor_name))); + _1012_generated = _out17; + goto after_match1; + } + } + { + if (_source44.is_Trait) { + DAST._ITrait _1016_t = _source44.dtor_Trait_a0; + Dafny.ISequence _1017_tt; + Dafny.ISequence _out18; + _out18 = (this).GenTrait(_1016_t, containingPath); + _1017_tt = _out18; + _1012_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_RawDecl(_1017_tt)); + goto after_match1; + } + } + { + if (_source44.is_Newtype) { + DAST._INewtype _1018_n = _source44.dtor_Newtype_a0; + Dafny.ISequence _out19; + _out19 = (this).GenNewtype(_1018_n); + _1012_generated = _out19; + goto after_match1; + } + } + { + DAST._IDatatype _1019_d = _source44.dtor_Datatype_a0; + Dafny.ISequence _out20; + _out20 = (this).GenDatatype(_1019_d); + _1012_generated = _out20; + } after_match1: ; s = Dafny.Sequence.Concat(s, _1012_generated); } @@ -535,27 +545,31 @@ public void GenTypeParameters(Dafny.ISequence @params, out D _1036_fieldRustName = DCOMP.__default.escapeName(((_1034_field).dtor_formal).dtor_name); _1031_fields = Dafny.Sequence.Concat(_1031_fields, Dafny.Sequence.FromElements(RAST.Field.create(RAST.Visibility.create_PUB(), RAST.Formal.create(_1036_fieldRustName, _1035_fieldType)))); Std.Wrappers._IOption _source45 = (_1034_field).dtor_defaultValue; - if (_source45.is_Some) { - DAST._IExpression _1037_e = _source45.dtor_value; - { - RAST._IExpr _1038_expr; - DCOMP._IOwnership _1039___v42; - Dafny.ISet> _1040___v43; - RAST._IExpr _out29; - DCOMP._IOwnership _out30; - Dafny.ISet> _out31; - (this).GenExpr(_1037_e, Std.Wrappers.Option>.create_None(), DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out29, out _out30, out _out31); - _1038_expr = _out29; - _1039___v42 = _out30; - _1040___v43 = _out31; - _1032_fieldInits = Dafny.Sequence.Concat(_1032_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(DCOMP.__default.escapeName(((_1034_field).dtor_formal).dtor_name), RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::cell::RefCell::new("), (_1038_expr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")))))); - } - goto after_match2; + { + if (_source45.is_Some) { + DAST._IExpression _1037_e = _source45.dtor_value; + { + RAST._IExpr _1038_expr; + DCOMP._IOwnership _1039___v42; + Dafny.ISet> _1040___v43; + RAST._IExpr _out29; + DCOMP._IOwnership _out30; + Dafny.ISet> _out31; + (this).GenExpr(_1037_e, Std.Wrappers.Option>.create_None(), DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out29, out _out30, out _out31); + _1038_expr = _out29; + _1039___v42 = _out30; + _1040___v43 = _out31; + _1032_fieldInits = Dafny.Sequence.Concat(_1032_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(DCOMP.__default.escapeName(((_1034_field).dtor_formal).dtor_name), RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::cell::RefCell::new("), (_1038_expr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")))))); + } + goto after_match2; + } } { - RAST._IExpr _1041_default; - _1041_default = RAST.__default.std__Default__default; - _1032_fieldInits = Dafny.Sequence.Concat(_1032_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1036_fieldRustName, _1041_default))); + { + RAST._IExpr _1041_default; + _1041_default = RAST.__default.std__Default__default; + _1032_fieldInits = Dafny.Sequence.Concat(_1032_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1036_fieldRustName, _1041_default))); + } } after_match2: ; } @@ -599,36 +613,40 @@ public void GenTypeParameters(Dafny.ISequence @params, out D DAST._IType _1053_superClass; _1053_superClass = ((c).dtor_superClasses).Select(_1052_i); DAST._IType _source46 = _1053_superClass; - if (_source46.is_Path) { - Dafny.ISequence> _1054_traitPath = _source46.dtor_Path_a0; - Dafny.ISequence _1055_typeArgs = _source46.dtor_typeArgs; - DAST._IResolvedType resolved0 = _source46.dtor_resolved; - if (resolved0.is_Trait) { - { - RAST._IType _1056_pathStr; - RAST._IType _out37; - _out37 = DCOMP.COMP.GenPath(_1054_traitPath); - _1056_pathStr = _out37; - Dafny.ISequence _1057_typeArgs; - Dafny.ISequence _out38; - _out38 = (this).GenTypeArgs(_1055_typeArgs, false, false); - _1057_typeArgs = _out38; - Dafny.ISequence _1058_body; - _1058_body = Dafny.Sequence.FromElements(); - if ((_1049_traitBodies).Contains(_1054_traitPath)) { - _1058_body = Dafny.Map>, Dafny.ISequence>.Select(_1049_traitBodies,_1054_traitPath); + { + if (_source46.is_Path) { + Dafny.ISequence> _1054_traitPath = _source46.dtor_Path_a0; + Dafny.ISequence _1055_typeArgs = _source46.dtor_typeArgs; + DAST._IResolvedType resolved0 = _source46.dtor_resolved; + if (resolved0.is_Trait) { + { + RAST._IType _1056_pathStr; + RAST._IType _out37; + _out37 = DCOMP.COMP.GenPath(_1054_traitPath); + _1056_pathStr = _out37; + Dafny.ISequence _1057_typeArgs; + Dafny.ISequence _out38; + _out38 = (this).GenTypeArgs(_1055_typeArgs, false, false); + _1057_typeArgs = _out38; + Dafny.ISequence _1058_body; + _1058_body = Dafny.Sequence.FromElements(); + if ((_1049_traitBodies).Contains(_1054_traitPath)) { + _1058_body = Dafny.Map>, Dafny.ISequence>.Select(_1049_traitBodies,_1054_traitPath); + } + RAST._IType _1059_genSelfPath; + RAST._IType _out39; + _out39 = DCOMP.COMP.GenPath(path); + _1059_genSelfPath = _out39; + RAST._IModDecl _1060_x; + _1060_x = RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1028_rTypeParamsDecls, RAST.Type.create_TypeApp(_1056_pathStr, _1057_typeArgs), RAST.__default.Rc(RAST.Type.create_TypeApp(_1059_genSelfPath, _1027_rTypeParams)), _1029_whereConstraints, _1058_body)); + s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1060_x)); } - RAST._IType _1059_genSelfPath; - RAST._IType _out39; - _out39 = DCOMP.COMP.GenPath(path); - _1059_genSelfPath = _out39; - RAST._IModDecl _1060_x; - _1060_x = RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1028_rTypeParamsDecls, RAST.Type.create_TypeApp(_1056_pathStr, _1057_typeArgs), RAST.__default.Rc(RAST.Type.create_TypeApp(_1059_genSelfPath, _1027_rTypeParams)), _1029_whereConstraints, _1058_body)); - s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1060_x)); + goto after_match3; } - goto after_match3; } } + { + } after_match3: ; _1052_i = (_1052_i) + (BigInteger.One); } @@ -712,14 +730,18 @@ public void GenTypeParameters(Dafny.ISequence @params, out D _1082_constrainedTypeParams = RAST.TypeParamDecl.ToStringMultiple(_1080_rTypeParamsDecls, Dafny.Sequence.Concat(RAST.__default.IND, RAST.__default.IND)); RAST._IType _1083_underlyingType = RAST.Type.Default(); Std.Wrappers._IOption _source47 = DCOMP.COMP.NewtypeToRustType((c).dtor_base, (c).dtor_range); - if (_source47.is_Some) { - RAST._IType _1084_v = _source47.dtor_value; - _1083_underlyingType = _1084_v; - goto after_match4; - } - RAST._IType _out49; - _out49 = (this).GenType((c).dtor_base, false, false); - _1083_underlyingType = _out49; + { + if (_source47.is_Some) { + RAST._IType _1084_v = _source47.dtor_value; + _1083_underlyingType = _1084_v; + goto after_match4; + } + } + { + RAST._IType _out49; + _out49 = (this).GenType((c).dtor_base, false, false); + _1083_underlyingType = _out49; + } after_match4: ; DAST._IType _1085_resultingType; _1085_resultingType = DAST.Type.create_Path(Dafny.Sequence>.FromElements(), Dafny.Sequence.FromElements(), DAST.ResolvedType.create_Newtype((c).dtor_base, (c).dtor_range, false, (c).dtor_attributes)); @@ -729,31 +751,35 @@ public void GenTypeParameters(Dafny.ISequence @params, out D RAST._IExpr _1087_fnBody; _1087_fnBody = RAST.Expr.create_Identifier(_1086_datatypeName); Std.Wrappers._IOption _source48 = (c).dtor_witnessExpr; - if (_source48.is_Some) { - DAST._IExpression _1088_e = _source48.dtor_value; - { - DAST._IExpression _1089_e; - if (object.Equals((c).dtor_base, _1085_resultingType)) { - _1089_e = _1088_e; - } else { - _1089_e = DAST.Expression.create_Convert(_1088_e, (c).dtor_base, _1085_resultingType); + { + if (_source48.is_Some) { + DAST._IExpression _1088_e = _source48.dtor_value; + { + DAST._IExpression _1089_e; + if (object.Equals((c).dtor_base, _1085_resultingType)) { + _1089_e = _1088_e; + } else { + _1089_e = DAST.Expression.create_Convert(_1088_e, (c).dtor_base, _1085_resultingType); + } + RAST._IExpr _1090_eStr; + DCOMP._IOwnership _1091___v48; + Dafny.ISet> _1092___v49; + RAST._IExpr _out50; + DCOMP._IOwnership _out51; + Dafny.ISet> _out52; + (this).GenExpr(_1089_e, Std.Wrappers.Option>.create_None(), DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out50, out _out51, out _out52); + _1090_eStr = _out50; + _1091___v48 = _out51; + _1092___v49 = _out52; + _1087_fnBody = (_1087_fnBody).Apply1(_1090_eStr); } - RAST._IExpr _1090_eStr; - DCOMP._IOwnership _1091___v48; - Dafny.ISet> _1092___v49; - RAST._IExpr _out50; - DCOMP._IOwnership _out51; - Dafny.ISet> _out52; - (this).GenExpr(_1089_e, Std.Wrappers.Option>.create_None(), DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out50, out _out51, out _out52); - _1090_eStr = _out50; - _1091___v48 = _out51; - _1092___v49 = _out52; - _1087_fnBody = (_1087_fnBody).Apply1(_1090_eStr); + goto after_match5; } - goto after_match5; } { - _1087_fnBody = (_1087_fnBody).Apply1(RAST.__default.std__Default__default); + { + _1087_fnBody = (_1087_fnBody).Apply1(RAST.__default.std__Default__default); + } } after_match5: ; RAST._IImplMember _1093_body; @@ -1084,249 +1110,297 @@ public RAST._IType GenType(DAST._IType c, bool inBinding, bool inFn) { RAST._IType s = RAST.Type.Default(); DAST._IType _source49 = c; - if (_source49.is_Path) { - Dafny.ISequence> _1167_p = _source49.dtor_Path_a0; - Dafny.ISequence _1168_args = _source49.dtor_typeArgs; - DAST._IResolvedType _1169_resolved = _source49.dtor_resolved; - { - RAST._IType _1170_t; - RAST._IType _out65; - _out65 = DCOMP.COMP.GenPath(_1167_p); - _1170_t = _out65; - Dafny.ISequence _1171_typeArgs; - Dafny.ISequence _out66; - _out66 = (this).GenTypeArgs(_1168_args, inBinding, inFn); - _1171_typeArgs = _out66; - s = RAST.Type.create_TypeApp(_1170_t, _1171_typeArgs); - DAST._IResolvedType _source50 = _1169_resolved; - if (_source50.is_Datatype) { - DAST._IDatatypeType datatypeType0 = _source50.dtor_datatypeType; - Dafny.ISequence _1172_attributes = datatypeType0.dtor_attributes; + { + if (_source49.is_Path) { + Dafny.ISequence> _1167_p = _source49.dtor_Path_a0; + Dafny.ISequence _1168_args = _source49.dtor_typeArgs; + DAST._IResolvedType _1169_resolved = _source49.dtor_resolved; + { + RAST._IType _1170_t; + RAST._IType _out65; + _out65 = DCOMP.COMP.GenPath(_1167_p); + _1170_t = _out65; + Dafny.ISequence _1171_typeArgs; + Dafny.ISequence _out66; + _out66 = (this).GenTypeArgs(_1168_args, inBinding, inFn); + _1171_typeArgs = _out66; + s = RAST.Type.create_TypeApp(_1170_t, _1171_typeArgs); + DAST._IResolvedType _source50 = _1169_resolved; { - if ((this).IsRcWrapped(_1172_attributes)) { - s = RAST.__default.Rc(s); + if (_source50.is_Datatype) { + DAST._IDatatypeType datatypeType0 = _source50.dtor_datatypeType; + Dafny.ISequence _1172_attributes = datatypeType0.dtor_attributes; + { + if ((this).IsRcWrapped(_1172_attributes)) { + s = RAST.__default.Rc(s); + } + } + goto after_match7; } } - goto after_match7; - } - if (_source50.is_Trait) { { - if ((_1167_p).Equals(Dafny.Sequence>.FromElements(Dafny.Sequence.UnicodeFromString("_System"), Dafny.Sequence.UnicodeFromString("object")))) { - s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("::std::rc::Rc")); - } else { - if (inBinding) { - s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("_")); - } else { - s = RAST.Type.create_ImplType(s); + if (_source50.is_Trait) { + { + if ((_1167_p).Equals(Dafny.Sequence>.FromElements(Dafny.Sequence.UnicodeFromString("_System"), Dafny.Sequence.UnicodeFromString("object")))) { + s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("::std::rc::Rc")); + } else { + if (inBinding) { + s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("_")); + } else { + s = RAST.Type.create_ImplType(s); + } + } } + goto after_match7; } } - goto after_match7; - } - DAST._IType _1173_t = _source50.dtor_baseType; - DAST._INewtypeRange _1174_range = _source50.dtor_range; - bool _1175_erased = _source50.dtor_erase; - Dafny.ISequence _1176_attributes = _source50.dtor_attributes; - { - if (_1175_erased) { - Std.Wrappers._IOption _source51 = DCOMP.COMP.NewtypeToRustType(_1173_t, _1174_range); - if (_source51.is_Some) { - RAST._IType _1177_v = _source51.dtor_value; - s = _1177_v; - goto after_match8; + { + DAST._IType _1173_t = _source50.dtor_baseType; + DAST._INewtypeRange _1174_range = _source50.dtor_range; + bool _1175_erased = _source50.dtor_erase; + Dafny.ISequence _1176_attributes = _source50.dtor_attributes; + { + if (_1175_erased) { + Std.Wrappers._IOption _source51 = DCOMP.COMP.NewtypeToRustType(_1173_t, _1174_range); + { + if (_source51.is_Some) { + RAST._IType _1177_v = _source51.dtor_value; + s = _1177_v; + goto after_match8; + } + } + { + } + after_match8: ; + } } - after_match8: ; } + after_match7: ; } - after_match7: ; + goto after_match6; } - goto after_match6; } - if (_source49.is_Nullable) { - DAST._IType _1178_inner = _source49.dtor_Nullable_a0; - { - RAST._IType _1179_innerExpr; - RAST._IType _out67; - _out67 = (this).GenType(_1178_inner, inBinding, inFn); - _1179_innerExpr = _out67; - s = RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("::std::option::Option")), Dafny.Sequence.FromElements(_1179_innerExpr)); + { + if (_source49.is_Nullable) { + DAST._IType _1178_inner = _source49.dtor_Nullable_a0; + { + RAST._IType _1179_innerExpr; + RAST._IType _out67; + _out67 = (this).GenType(_1178_inner, inBinding, inFn); + _1179_innerExpr = _out67; + s = RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("::std::option::Option")), Dafny.Sequence.FromElements(_1179_innerExpr)); + } + goto after_match6; } - goto after_match6; } - if (_source49.is_Tuple) { - Dafny.ISequence _1180_types = _source49.dtor_Tuple_a0; - { - Dafny.ISequence _1181_args; - _1181_args = Dafny.Sequence.FromElements(); - BigInteger _1182_i; - _1182_i = BigInteger.Zero; - while ((_1182_i) < (new BigInteger((_1180_types).Count))) { - RAST._IType _1183_generated; - RAST._IType _out68; - _out68 = (this).GenType((_1180_types).Select(_1182_i), inBinding, inFn); - _1183_generated = _out68; - _1181_args = Dafny.Sequence.Concat(_1181_args, Dafny.Sequence.FromElements(_1183_generated)); - _1182_i = (_1182_i) + (BigInteger.One); - } - if ((new BigInteger((_1180_types).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) { - s = RAST.Type.create_TupleType(_1181_args); - } else { - s = RAST.__default.SystemTupleType(_1181_args); + { + if (_source49.is_Tuple) { + Dafny.ISequence _1180_types = _source49.dtor_Tuple_a0; + { + Dafny.ISequence _1181_args; + _1181_args = Dafny.Sequence.FromElements(); + BigInteger _1182_i; + _1182_i = BigInteger.Zero; + while ((_1182_i) < (new BigInteger((_1180_types).Count))) { + RAST._IType _1183_generated; + RAST._IType _out68; + _out68 = (this).GenType((_1180_types).Select(_1182_i), inBinding, inFn); + _1183_generated = _out68; + _1181_args = Dafny.Sequence.Concat(_1181_args, Dafny.Sequence.FromElements(_1183_generated)); + _1182_i = (_1182_i) + (BigInteger.One); + } + if ((new BigInteger((_1180_types).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) { + s = RAST.Type.create_TupleType(_1181_args); + } else { + s = RAST.__default.SystemTupleType(_1181_args); + } } + goto after_match6; } - goto after_match6; } - if (_source49.is_Array) { - DAST._IType _1184_element = _source49.dtor_element; - BigInteger _1185_dims = _source49.dtor_dims; - { - RAST._IType _1186_elem; - RAST._IType _out69; - _out69 = (this).GenType(_1184_element, inBinding, inFn); - _1186_elem = _out69; - s = _1186_elem; - BigInteger _1187_i; - _1187_i = BigInteger.Zero; - while ((_1187_i) < (_1185_dims)) { - s = RAST.__default.Rc(RAST.__default.RefCell(RAST.__default.Vec(s))); - _1187_i = (_1187_i) + (BigInteger.One); - } - } - goto after_match6; - } - if (_source49.is_Seq) { - DAST._IType _1188_element = _source49.dtor_element; - { - RAST._IType _1189_elem; - RAST._IType _out70; - _out70 = (this).GenType(_1188_element, inBinding, inFn); - _1189_elem = _out70; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements(_1189_elem)); + { + if (_source49.is_Array) { + DAST._IType _1184_element = _source49.dtor_element; + BigInteger _1185_dims = _source49.dtor_dims; + { + RAST._IType _1186_elem; + RAST._IType _out69; + _out69 = (this).GenType(_1184_element, inBinding, inFn); + _1186_elem = _out69; + s = _1186_elem; + BigInteger _1187_i; + _1187_i = BigInteger.Zero; + while ((_1187_i) < (_1185_dims)) { + s = RAST.__default.Rc(RAST.__default.RefCell(RAST.__default.Vec(s))); + _1187_i = (_1187_i) + (BigInteger.One); + } + } + goto after_match6; } - goto after_match6; } - if (_source49.is_Set) { - DAST._IType _1190_element = _source49.dtor_element; - { - RAST._IType _1191_elem; - RAST._IType _out71; - _out71 = (this).GenType(_1190_element, inBinding, inFn); - _1191_elem = _out71; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Set")), Dafny.Sequence.FromElements(_1191_elem)); + { + if (_source49.is_Seq) { + DAST._IType _1188_element = _source49.dtor_element; + { + RAST._IType _1189_elem; + RAST._IType _out70; + _out70 = (this).GenType(_1188_element, inBinding, inFn); + _1189_elem = _out70; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements(_1189_elem)); + } + goto after_match6; } - goto after_match6; } - if (_source49.is_Multiset) { - DAST._IType _1192_element = _source49.dtor_element; - { - RAST._IType _1193_elem; - RAST._IType _out72; - _out72 = (this).GenType(_1192_element, inBinding, inFn); - _1193_elem = _out72; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Multiset")), Dafny.Sequence.FromElements(_1193_elem)); + { + if (_source49.is_Set) { + DAST._IType _1190_element = _source49.dtor_element; + { + RAST._IType _1191_elem; + RAST._IType _out71; + _out71 = (this).GenType(_1190_element, inBinding, inFn); + _1191_elem = _out71; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Set")), Dafny.Sequence.FromElements(_1191_elem)); + } + goto after_match6; } - goto after_match6; } - if (_source49.is_Map) { - DAST._IType _1194_key = _source49.dtor_key; - DAST._IType _1195_value = _source49.dtor_value; - { - RAST._IType _1196_keyType; - RAST._IType _out73; - _out73 = (this).GenType(_1194_key, inBinding, inFn); - _1196_keyType = _out73; - RAST._IType _1197_valueType; - RAST._IType _out74; - _out74 = (this).GenType(_1195_value, inBinding, inFn); - _1197_valueType = _out74; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Map")), Dafny.Sequence.FromElements(_1196_keyType, _1197_valueType)); - } - goto after_match6; - } - if (_source49.is_MapBuilder) { - DAST._IType _1198_key = _source49.dtor_key; - DAST._IType _1199_value = _source49.dtor_value; - { - RAST._IType _1200_keyType; - RAST._IType _out75; - _out75 = (this).GenType(_1198_key, inBinding, inFn); - _1200_keyType = _out75; - RAST._IType _1201_valueType; - RAST._IType _out76; - _out76 = (this).GenType(_1199_value, inBinding, inFn); - _1201_valueType = _out76; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder")), Dafny.Sequence.FromElements(_1200_keyType, _1201_valueType)); - } - goto after_match6; - } - if (_source49.is_SetBuilder) { - DAST._IType _1202_elem = _source49.dtor_element; - { - RAST._IType _1203_elemType; - RAST._IType _out77; - _out77 = (this).GenType(_1202_elem, inBinding, inFn); - _1203_elemType = _out77; - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder")), Dafny.Sequence.FromElements(_1203_elemType)); + { + if (_source49.is_Multiset) { + DAST._IType _1192_element = _source49.dtor_element; + { + RAST._IType _1193_elem; + RAST._IType _out72; + _out72 = (this).GenType(_1192_element, inBinding, inFn); + _1193_elem = _out72; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Multiset")), Dafny.Sequence.FromElements(_1193_elem)); + } + goto after_match6; } - goto after_match6; } - if (_source49.is_Arrow) { - Dafny.ISequence _1204_args = _source49.dtor_args; - DAST._IType _1205_result = _source49.dtor_result; - { - Dafny.ISequence _1206_argTypes; - _1206_argTypes = Dafny.Sequence.FromElements(); - BigInteger _1207_i; - _1207_i = BigInteger.Zero; - while ((_1207_i) < (new BigInteger((_1204_args).Count))) { - RAST._IType _1208_generated; - RAST._IType _out78; - _out78 = (this).GenType((_1204_args).Select(_1207_i), inBinding, true); - _1208_generated = _out78; - _1206_argTypes = Dafny.Sequence.Concat(_1206_argTypes, Dafny.Sequence.FromElements(RAST.Type.create_Borrowed(_1208_generated))); - _1207_i = (_1207_i) + (BigInteger.One); - } - RAST._IType _1209_resultType; - RAST._IType _out79; - _out79 = (this).GenType(_1205_result, inBinding, (inFn) || (inBinding)); - _1209_resultType = _out79; - s = RAST.__default.Rc(RAST.Type.create_DynType(RAST.Type.create_FnType(_1206_argTypes, _1209_resultType))); - } - goto after_match6; - } - if (_source49.is_TypeArg) { - Dafny.ISequence _h100 = _source49.dtor_TypeArg_a0; - Dafny.ISequence _1210_name = _h100; - s = RAST.Type.create_TIdentifier(DCOMP.__default.escapeName(_1210_name)); - goto after_match6; - } - if (_source49.is_Primitive) { - DAST._IPrimitive _1211_p = _source49.dtor_Primitive_a0; - { - DAST._IPrimitive _source52 = _1211_p; - if (_source52.is_Int) { - s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("DafnyInt")); - goto after_match9; + { + if (_source49.is_Map) { + DAST._IType _1194_key = _source49.dtor_key; + DAST._IType _1195_value = _source49.dtor_value; + { + RAST._IType _1196_keyType; + RAST._IType _out73; + _out73 = (this).GenType(_1194_key, inBinding, inFn); + _1196_keyType = _out73; + RAST._IType _1197_valueType; + RAST._IType _out74; + _out74 = (this).GenType(_1195_value, inBinding, inFn); + _1197_valueType = _out74; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Map")), Dafny.Sequence.FromElements(_1196_keyType, _1197_valueType)); + } + goto after_match6; + } + } + { + if (_source49.is_MapBuilder) { + DAST._IType _1198_key = _source49.dtor_key; + DAST._IType _1199_value = _source49.dtor_value; + { + RAST._IType _1200_keyType; + RAST._IType _out75; + _out75 = (this).GenType(_1198_key, inBinding, inFn); + _1200_keyType = _out75; + RAST._IType _1201_valueType; + RAST._IType _out76; + _out76 = (this).GenType(_1199_value, inBinding, inFn); + _1201_valueType = _out76; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder")), Dafny.Sequence.FromElements(_1200_keyType, _1201_valueType)); } - if (_source52.is_Real) { - s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("BigRational")); - goto after_match9; + goto after_match6; + } + } + { + if (_source49.is_SetBuilder) { + DAST._IType _1202_elem = _source49.dtor_element; + { + RAST._IType _1203_elemType; + RAST._IType _out77; + _out77 = (this).GenType(_1202_elem, inBinding, inFn); + _1203_elemType = _out77; + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder")), Dafny.Sequence.FromElements(_1203_elemType)); } - if (_source52.is_String) { - s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements((RAST.__default.dafny__runtime__type).MSel((this).DafnyChar))); - goto after_match9; + goto after_match6; + } + } + { + if (_source49.is_Arrow) { + Dafny.ISequence _1204_args = _source49.dtor_args; + DAST._IType _1205_result = _source49.dtor_result; + { + Dafny.ISequence _1206_argTypes; + _1206_argTypes = Dafny.Sequence.FromElements(); + BigInteger _1207_i; + _1207_i = BigInteger.Zero; + while ((_1207_i) < (new BigInteger((_1204_args).Count))) { + RAST._IType _1208_generated; + RAST._IType _out78; + _out78 = (this).GenType((_1204_args).Select(_1207_i), inBinding, true); + _1208_generated = _out78; + _1206_argTypes = Dafny.Sequence.Concat(_1206_argTypes, Dafny.Sequence.FromElements(RAST.Type.create_Borrowed(_1208_generated))); + _1207_i = (_1207_i) + (BigInteger.One); + } + RAST._IType _1209_resultType; + RAST._IType _out79; + _out79 = (this).GenType(_1205_result, inBinding, (inFn) || (inBinding)); + _1209_resultType = _out79; + s = RAST.__default.Rc(RAST.Type.create_DynType(RAST.Type.create_FnType(_1206_argTypes, _1209_resultType))); } - if (_source52.is_Bool) { - s = RAST.Type.create_Bool(); - goto after_match9; + goto after_match6; + } + } + { + if (_source49.is_TypeArg) { + Dafny.ISequence _h100 = _source49.dtor_TypeArg_a0; + Dafny.ISequence _1210_name = _h100; + s = RAST.Type.create_TIdentifier(DCOMP.__default.escapeName(_1210_name)); + goto after_match6; + } + } + { + if (_source49.is_Primitive) { + DAST._IPrimitive _1211_p = _source49.dtor_Primitive_a0; + { + DAST._IPrimitive _source52 = _1211_p; + { + if (_source52.is_Int) { + s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("DafnyInt")); + goto after_match9; + } + } + { + if (_source52.is_Real) { + s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("BigRational")); + goto after_match9; + } + } + { + if (_source52.is_String) { + s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements((RAST.__default.dafny__runtime__type).MSel((this).DafnyChar))); + goto after_match9; + } + } + { + if (_source52.is_Bool) { + s = RAST.Type.create_Bool(); + goto after_match9; + } + } + { + s = (RAST.__default.dafny__runtime__type).MSel((this).DafnyChar); + } + after_match9: ; } - s = (RAST.__default.dafny__runtime__type).MSel((this).DafnyChar); - after_match9: ; + goto after_match6; } - goto after_match6; } - Dafny.ISequence _1212_v = _source49.dtor_Passthrough_a0; - s = RAST.__default.RawType(_1212_v); + { + Dafny.ISequence _1212_v = _source49.dtor_Passthrough_a0; + s = RAST.__default.RawType(_1212_v); + } after_match6: ; return s; } @@ -1339,34 +1413,40 @@ public void GenClassImplBody(Dafny.ISequence body, bool forTrait, BigInteger _hi21 = new BigInteger((body).Count); for (BigInteger _1213_i = BigInteger.Zero; _1213_i < _hi21; _1213_i++) { DAST._IMethod _source53 = (body).Select(_1213_i); - DAST._IMethod _1214_m = _source53; { - Std.Wrappers._IOption>> _source54 = (_1214_m).dtor_overridingPath; - if (_source54.is_Some) { - Dafny.ISequence> _1215_p = _source54.dtor_value; + DAST._IMethod _1214_m = _source53; + { + Std.Wrappers._IOption>> _source54 = (_1214_m).dtor_overridingPath; { - Dafny.ISequence _1216_existing; - _1216_existing = Dafny.Sequence.FromElements(); - if ((traitBodies).Contains(_1215_p)) { - _1216_existing = Dafny.Map>, Dafny.ISequence>.Select(traitBodies,_1215_p); + if (_source54.is_Some) { + Dafny.ISequence> _1215_p = _source54.dtor_value; + { + Dafny.ISequence _1216_existing; + _1216_existing = Dafny.Sequence.FromElements(); + if ((traitBodies).Contains(_1215_p)) { + _1216_existing = Dafny.Map>, Dafny.ISequence>.Select(traitBodies,_1215_p); + } + RAST._IImplMember _1217_genMethod; + RAST._IImplMember _out80; + _out80 = (this).GenMethod(_1214_m, true, enclosingType, enclosingTypeParams); + _1217_genMethod = _out80; + _1216_existing = Dafny.Sequence.Concat(_1216_existing, Dafny.Sequence.FromElements(_1217_genMethod)); + traitBodies = Dafny.Map>, Dafny.ISequence>.Merge(traitBodies, Dafny.Map>, Dafny.ISequence>.FromElements(new Dafny.Pair>, Dafny.ISequence>(_1215_p, _1216_existing))); + } + goto after_match11; } - RAST._IImplMember _1217_genMethod; - RAST._IImplMember _out80; - _out80 = (this).GenMethod(_1214_m, true, enclosingType, enclosingTypeParams); - _1217_genMethod = _out80; - _1216_existing = Dafny.Sequence.Concat(_1216_existing, Dafny.Sequence.FromElements(_1217_genMethod)); - traitBodies = Dafny.Map>, Dafny.ISequence>.Merge(traitBodies, Dafny.Map>, Dafny.ISequence>.FromElements(new Dafny.Pair>, Dafny.ISequence>(_1215_p, _1216_existing))); } - goto after_match11; - } - { - RAST._IImplMember _1218_generated; - RAST._IImplMember _out81; - _out81 = (this).GenMethod(_1214_m, forTrait, enclosingType, enclosingTypeParams); - _1218_generated = _out81; - s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1218_generated)); + { + { + RAST._IImplMember _1218_generated; + RAST._IImplMember _out81; + _out81 = (this).GenMethod(_1214_m, forTrait, enclosingType, enclosingTypeParams); + _1218_generated = _out81; + s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1218_generated)); + } + } + after_match11: ; } - after_match11: ; } after_match10: ; } @@ -1488,48 +1568,52 @@ public RAST._IImplMember GenMethod(DAST._IMethod m, bool forTrait, DAST._IType e RAST._IExpr _1250_earlyReturn; _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_None()); Std.Wrappers._IOption>> _source55 = (m).dtor_outVars; - if (_source55.is_Some) { - Dafny.ISequence> _1251_outVars = _source55.dtor_value; - { - Dafny.ISequence _1252_tupleArgs; - _1252_tupleArgs = Dafny.Sequence.FromElements(); - BigInteger _hi26 = new BigInteger((_1251_outVars).Count); - for (BigInteger _1253_outI = BigInteger.Zero; _1253_outI < _hi26; _1253_outI++) { - Dafny.ISequence _1254_outVar; - _1254_outVar = (_1251_outVars).Select(_1253_outI); - RAST._IType _1255_outType; - RAST._IType _out88; - _out88 = (this).GenType(((m).dtor_outTypes).Select(_1253_outI), false, false); - _1255_outType = _out88; - Dafny.ISequence _1256_outName; - _1256_outName = DCOMP.__default.escapeName((_1254_outVar)); - _1223_paramNames = Dafny.Sequence>.Concat(_1223_paramNames, Dafny.Sequence>.FromElements(_1256_outName)); - RAST._IType _1257_outMaybeType; - if ((_1255_outType).CanReadWithoutClone()) { - _1257_outMaybeType = _1255_outType; + { + if (_source55.is_Some) { + Dafny.ISequence> _1251_outVars = _source55.dtor_value; + { + Dafny.ISequence _1252_tupleArgs; + _1252_tupleArgs = Dafny.Sequence.FromElements(); + BigInteger _hi26 = new BigInteger((_1251_outVars).Count); + for (BigInteger _1253_outI = BigInteger.Zero; _1253_outI < _hi26; _1253_outI++) { + Dafny.ISequence _1254_outVar; + _1254_outVar = (_1251_outVars).Select(_1253_outI); + RAST._IType _1255_outType; + RAST._IType _out88; + _out88 = (this).GenType(((m).dtor_outTypes).Select(_1253_outI), false, false); + _1255_outType = _out88; + Dafny.ISequence _1256_outName; + _1256_outName = DCOMP.__default.escapeName((_1254_outVar)); + _1223_paramNames = Dafny.Sequence>.Concat(_1223_paramNames, Dafny.Sequence>.FromElements(_1256_outName)); + RAST._IType _1257_outMaybeType; + if ((_1255_outType).CanReadWithoutClone()) { + _1257_outMaybeType = _1255_outType; + } else { + _1257_outMaybeType = RAST.Type.create_Borrowed(_1255_outType); + } + _1224_paramTypes = Dafny.Map, RAST._IType>.Update(_1224_paramTypes, _1256_outName, _1257_outMaybeType); + RAST._IExpr _1258_outVarReturn; + DCOMP._IOwnership _1259___v53; + Dafny.ISet> _1260___v54; + RAST._IExpr _out89; + DCOMP._IOwnership _out90; + Dafny.ISet> _out91; + (this).GenExpr(DAST.Expression.create_Ident((_1254_outVar)), Std.Wrappers.Option>.create_None(), DCOMP.Environment.create(Dafny.Sequence>.FromElements(_1256_outName), Dafny.Map, RAST._IType>.FromElements(new Dafny.Pair, RAST._IType>(_1256_outName, _1257_outMaybeType))), DCOMP.Ownership.create_OwnershipOwned(), out _out89, out _out90, out _out91); + _1258_outVarReturn = _out89; + _1259___v53 = _out90; + _1260___v54 = _out91; + _1252_tupleArgs = Dafny.Sequence.Concat(_1252_tupleArgs, Dafny.Sequence.FromElements(_1258_outVarReturn)); + } + if ((new BigInteger((_1252_tupleArgs).Count)) == (BigInteger.One)) { + _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some((_1252_tupleArgs).Select(BigInteger.Zero))); } else { - _1257_outMaybeType = RAST.Type.create_Borrowed(_1255_outType); + _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(RAST.Expr.create_Tuple(_1252_tupleArgs))); } - _1224_paramTypes = Dafny.Map, RAST._IType>.Update(_1224_paramTypes, _1256_outName, _1257_outMaybeType); - RAST._IExpr _1258_outVarReturn; - DCOMP._IOwnership _1259___v53; - Dafny.ISet> _1260___v54; - RAST._IExpr _out89; - DCOMP._IOwnership _out90; - Dafny.ISet> _out91; - (this).GenExpr(DAST.Expression.create_Ident((_1254_outVar)), Std.Wrappers.Option>.create_None(), DCOMP.Environment.create(Dafny.Sequence>.FromElements(_1256_outName), Dafny.Map, RAST._IType>.FromElements(new Dafny.Pair, RAST._IType>(_1256_outName, _1257_outMaybeType))), DCOMP.Ownership.create_OwnershipOwned(), out _out89, out _out90, out _out91); - _1258_outVarReturn = _out89; - _1259___v53 = _out90; - _1260___v54 = _out91; - _1252_tupleArgs = Dafny.Sequence.Concat(_1252_tupleArgs, Dafny.Sequence.FromElements(_1258_outVarReturn)); - } - if ((new BigInteger((_1252_tupleArgs).Count)) == (BigInteger.One)) { - _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some((_1252_tupleArgs).Select(BigInteger.Zero))); - } else { - _1250_earlyReturn = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(RAST.Expr.create_Tuple(_1252_tupleArgs))); } + goto after_match12; } - goto after_match12; + } + { } after_match12: ; _1248_env = DCOMP.Environment.create(_1223_paramNames, _1224_paramTypes); @@ -1578,12 +1662,16 @@ public void GenStmts(Dafny.ISequence stmts, Std.Wrappers._IOpt _1269_newEnv2 = _out97; newEnv = _1269_newEnv2; DAST._IStatement _source56 = _1266_stmt; - if (_source56.is_DeclareVar) { - Dafny.ISequence _1270_name = _source56.dtor_name; - { - _1264_declarations = Dafny.Set>.Union(_1264_declarations, Dafny.Set>.FromElements(DCOMP.__default.escapeName(_1270_name))); + { + if (_source56.is_DeclareVar) { + Dafny.ISequence _1270_name = _source56.dtor_name; + { + _1264_declarations = Dafny.Set>.Union(_1264_declarations, Dafny.Set>.FromElements(DCOMP.__default.escapeName(_1270_name))); + } + goto after_match13; } - goto after_match13; + } + { } after_match13: ; readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.Difference(_1268_recIdents, _1264_declarations)); @@ -1599,85 +1687,91 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, Std.Wrappers._IO newEnv = DCOMP.Environment.Default(); newEnv = env; DAST._IAssignLhs _source57 = lhs; - if (_source57.is_Ident) { - Dafny.ISequence ident0 = _source57.dtor_ident; - Dafny.ISequence _1271_id = ident0; - { - Dafny.ISequence _1272_idRust; - _1272_idRust = DCOMP.__default.escapeName(_1271_id); - if (((env).IsBorrowed(_1272_idRust)) || ((env).IsBorrowedMut(_1272_idRust))) { - generated = RAST.__default.AssignVar(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*"), _1272_idRust), rhs); - } else { - generated = RAST.__default.AssignVar(_1272_idRust, rhs); + { + if (_source57.is_Ident) { + Dafny.ISequence ident0 = _source57.dtor_ident; + Dafny.ISequence _1271_id = ident0; + { + Dafny.ISequence _1272_idRust; + _1272_idRust = DCOMP.__default.escapeName(_1271_id); + if (((env).IsBorrowed(_1272_idRust)) || ((env).IsBorrowedMut(_1272_idRust))) { + generated = RAST.__default.AssignVar(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*"), _1272_idRust), rhs); + } else { + generated = RAST.__default.AssignVar(_1272_idRust, rhs); + } + readIdents = Dafny.Set>.FromElements(_1272_idRust); + needsIIFE = false; + } + goto after_match14; + } + } + { + if (_source57.is_Select) { + DAST._IExpression _1273_on = _source57.dtor_expr; + Dafny.ISequence _1274_field = _source57.dtor_field; + { + Dafny.ISequence _1275_fieldName; + _1275_fieldName = DCOMP.__default.escapeName(_1274_field); + RAST._IExpr _1276_onExpr; + DCOMP._IOwnership _1277_onOwned; + Dafny.ISet> _1278_recIdents; + RAST._IExpr _out98; + DCOMP._IOwnership _out99; + Dafny.ISet> _out100; + (this).GenExpr(_1273_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowedMut(), out _out98, out _out99, out _out100); + _1276_onExpr = _out98; + _1277_onOwned = _out99; + _1278_recIdents = _out100; + generated = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*("), (_1276_onExpr)._ToString(RAST.__default.IND)), Dafny.Sequence.UnicodeFromString(".")), _1275_fieldName), Dafny.Sequence.UnicodeFromString(".borrow_mut()) = ")), (rhs)._ToString(RAST.__default.IND)), Dafny.Sequence.UnicodeFromString(";"))); + readIdents = _1278_recIdents; + needsIIFE = true; } - readIdents = Dafny.Set>.FromElements(_1272_idRust); - needsIIFE = false; + goto after_match14; } - goto after_match14; } - if (_source57.is_Select) { - DAST._IExpression _1273_on = _source57.dtor_expr; - Dafny.ISequence _1274_field = _source57.dtor_field; + { + DAST._IExpression _1279_on = _source57.dtor_expr; + Dafny.ISequence _1280_indices = _source57.dtor_indices; { - Dafny.ISequence _1275_fieldName; - _1275_fieldName = DCOMP.__default.escapeName(_1274_field); - RAST._IExpr _1276_onExpr; - DCOMP._IOwnership _1277_onOwned; - Dafny.ISet> _1278_recIdents; - RAST._IExpr _out98; - DCOMP._IOwnership _out99; - Dafny.ISet> _out100; - (this).GenExpr(_1273_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowedMut(), out _out98, out _out99, out _out100); - _1276_onExpr = _out98; - _1277_onOwned = _out99; - _1278_recIdents = _out100; - generated = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*("), (_1276_onExpr)._ToString(RAST.__default.IND)), Dafny.Sequence.UnicodeFromString(".")), _1275_fieldName), Dafny.Sequence.UnicodeFromString(".borrow_mut()) = ")), (rhs)._ToString(RAST.__default.IND)), Dafny.Sequence.UnicodeFromString(";"))); - readIdents = _1278_recIdents; + RAST._IExpr _1281_onExpr; + DCOMP._IOwnership _1282_onOwned; + Dafny.ISet> _1283_recIdents; + RAST._IExpr _out101; + DCOMP._IOwnership _out102; + Dafny.ISet> _out103; + (this).GenExpr(_1279_on, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out101, out _out102, out _out103); + _1281_onExpr = _out101; + _1282_onOwned = _out102; + _1283_recIdents = _out103; + readIdents = _1283_recIdents; + Dafny.ISequence _1284_r; + _1284_r = Dafny.Sequence.UnicodeFromString("{\n"); + BigInteger _1285_i; + _1285_i = BigInteger.Zero; + while ((_1285_i) < (new BigInteger((_1280_indices).Count))) { + RAST._IExpr _1286_idx; + DCOMP._IOwnership _1287___v60; + Dafny.ISet> _1288_recIdentsIdx; + RAST._IExpr _out104; + DCOMP._IOwnership _out105; + Dafny.ISet> _out106; + (this).GenExpr((_1280_indices).Select(_1285_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out104, out _out105, out _out106); + _1286_idx = _out104; + _1287___v60 = _out105; + _1288_recIdentsIdx = _out106; + _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString("let __idx")), Std.Strings.__default.OfNat(_1285_i)), Dafny.Sequence.UnicodeFromString(" = ::from(")), (_1286_idx)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap();\n")); + readIdents = Dafny.Set>.Union(readIdents, _1288_recIdentsIdx); + _1285_i = (_1285_i) + (BigInteger.One); + } + _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, (_1281_onExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(".borrow_mut()")); + _1285_i = BigInteger.Zero; + while ((_1285_i) < (new BigInteger((_1280_indices).Count))) { + _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString("[__idx")), Std.Strings.__default.OfNat(_1285_i)), Dafny.Sequence.UnicodeFromString("]")); + _1285_i = (_1285_i) + (BigInteger.One); + } + generated = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString(" = ")), (rhs)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";\n}"))); needsIIFE = true; } - goto after_match14; - } - DAST._IExpression _1279_on = _source57.dtor_expr; - Dafny.ISequence _1280_indices = _source57.dtor_indices; - { - RAST._IExpr _1281_onExpr; - DCOMP._IOwnership _1282_onOwned; - Dafny.ISet> _1283_recIdents; - RAST._IExpr _out101; - DCOMP._IOwnership _out102; - Dafny.ISet> _out103; - (this).GenExpr(_1279_on, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out101, out _out102, out _out103); - _1281_onExpr = _out101; - _1282_onOwned = _out102; - _1283_recIdents = _out103; - readIdents = _1283_recIdents; - Dafny.ISequence _1284_r; - _1284_r = Dafny.Sequence.UnicodeFromString("{\n"); - BigInteger _1285_i; - _1285_i = BigInteger.Zero; - while ((_1285_i) < (new BigInteger((_1280_indices).Count))) { - RAST._IExpr _1286_idx; - DCOMP._IOwnership _1287___v60; - Dafny.ISet> _1288_recIdentsIdx; - RAST._IExpr _out104; - DCOMP._IOwnership _out105; - Dafny.ISet> _out106; - (this).GenExpr((_1280_indices).Select(_1285_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out104, out _out105, out _out106); - _1286_idx = _out104; - _1287___v60 = _out105; - _1288_recIdentsIdx = _out106; - _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString("let __idx")), Std.Strings.__default.OfNat(_1285_i)), Dafny.Sequence.UnicodeFromString(" = ::from(")), (_1286_idx)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap();\n")); - readIdents = Dafny.Set>.Union(readIdents, _1288_recIdentsIdx); - _1285_i = (_1285_i) + (BigInteger.One); - } - _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, (_1281_onExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(".borrow_mut()")); - _1285_i = BigInteger.Zero; - while ((_1285_i) < (new BigInteger((_1280_indices).Count))) { - _1284_r = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString("[__idx")), Std.Strings.__default.OfNat(_1285_i)), Dafny.Sequence.UnicodeFromString("]")); - _1285_i = (_1285_i) + (BigInteger.One); - } - generated = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1284_r, Dafny.Sequence.UnicodeFromString(" = ")), (rhs)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";\n}"))); - needsIIFE = true; } after_match14: ; } @@ -1687,519 +1781,587 @@ public void GenStmt(DAST._IStatement stmt, Std.Wrappers._IOption>.Empty; newEnv = DCOMP.Environment.Default(); DAST._IStatement _source58 = stmt; - if (_source58.is_DeclareVar) { - Dafny.ISequence _1289_name = _source58.dtor_name; - DAST._IType _1290_typ = _source58.dtor_typ; - Std.Wrappers._IOption maybeValue0 = _source58.dtor_maybeValue; - if (maybeValue0.is_Some) { - DAST._IExpression _1291_expression = maybeValue0.dtor_value; - { - RAST._IType _1292_tpe; - RAST._IType _out107; - _out107 = (this).GenType(_1290_typ, true, false); - _1292_tpe = _out107; - RAST._IExpr _1293_expr; - DCOMP._IOwnership _1294_exprOwnership; - Dafny.ISet> _1295_recIdents; - RAST._IExpr _out108; - DCOMP._IOwnership _out109; - Dafny.ISet> _out110; - (this).GenExpr(_1291_expression, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out108, out _out109, out _out110); - _1293_expr = _out108; - _1294_exprOwnership = _out109; - _1295_recIdents = _out110; - readIdents = _1295_recIdents; - generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), DCOMP.__default.escapeName(_1289_name), Std.Wrappers.Option.create_Some(_1292_tpe), Std.Wrappers.Option.create_Some(_1293_expr)); - newEnv = (env).AddAssigned(DCOMP.__default.escapeName(_1289_name), _1292_tpe); + { + if (_source58.is_DeclareVar) { + Dafny.ISequence _1289_name = _source58.dtor_name; + DAST._IType _1290_typ = _source58.dtor_typ; + Std.Wrappers._IOption maybeValue0 = _source58.dtor_maybeValue; + if (maybeValue0.is_Some) { + DAST._IExpression _1291_expression = maybeValue0.dtor_value; + { + RAST._IType _1292_tpe; + RAST._IType _out107; + _out107 = (this).GenType(_1290_typ, true, false); + _1292_tpe = _out107; + RAST._IExpr _1293_expr; + DCOMP._IOwnership _1294_exprOwnership; + Dafny.ISet> _1295_recIdents; + RAST._IExpr _out108; + DCOMP._IOwnership _out109; + Dafny.ISet> _out110; + (this).GenExpr(_1291_expression, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out108, out _out109, out _out110); + _1293_expr = _out108; + _1294_exprOwnership = _out109; + _1295_recIdents = _out110; + readIdents = _1295_recIdents; + generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), DCOMP.__default.escapeName(_1289_name), Std.Wrappers.Option.create_Some(_1292_tpe), Std.Wrappers.Option.create_Some(_1293_expr)); + newEnv = (env).AddAssigned(DCOMP.__default.escapeName(_1289_name), _1292_tpe); + } + goto after_match15; } - goto after_match15; } } - if (_source58.is_DeclareVar) { - Dafny.ISequence _1296_name = _source58.dtor_name; - DAST._IType _1297_typ = _source58.dtor_typ; - Std.Wrappers._IOption maybeValue1 = _source58.dtor_maybeValue; - if (maybeValue1.is_None) { - { - DAST._IStatement _1298_newStmt; - _1298_newStmt = DAST.Statement.create_DeclareVar(_1296_name, _1297_typ, Std.Wrappers.Option.create_Some(DAST.Expression.create_InitializationValue(_1297_typ))); - RAST._IExpr _out111; - Dafny.ISet> _out112; - DCOMP._IEnvironment _out113; - (this).GenStmt(_1298_newStmt, selfIdent, env, isLast, earlyReturn, out _out111, out _out112, out _out113); - generated = _out111; - readIdents = _out112; - newEnv = _out113; + { + if (_source58.is_DeclareVar) { + Dafny.ISequence _1296_name = _source58.dtor_name; + DAST._IType _1297_typ = _source58.dtor_typ; + Std.Wrappers._IOption maybeValue1 = _source58.dtor_maybeValue; + if (maybeValue1.is_None) { + { + DAST._IStatement _1298_newStmt; + _1298_newStmt = DAST.Statement.create_DeclareVar(_1296_name, _1297_typ, Std.Wrappers.Option.create_Some(DAST.Expression.create_InitializationValue(_1297_typ))); + RAST._IExpr _out111; + Dafny.ISet> _out112; + DCOMP._IEnvironment _out113; + (this).GenStmt(_1298_newStmt, selfIdent, env, isLast, earlyReturn, out _out111, out _out112, out _out113); + generated = _out111; + readIdents = _out112; + newEnv = _out113; + } + goto after_match15; } - goto after_match15; - } - } - if (_source58.is_Assign) { - DAST._IAssignLhs _1299_lhs = _source58.dtor_lhs; - DAST._IExpression _1300_expression = _source58.dtor_value; - { - RAST._IExpr _1301_exprGen; - DCOMP._IOwnership _1302___v61; - Dafny.ISet> _1303_exprIdents; - RAST._IExpr _out114; - DCOMP._IOwnership _out115; - Dafny.ISet> _out116; - (this).GenExpr(_1300_expression, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out114, out _out115, out _out116); - _1301_exprGen = _out114; - _1302___v61 = _out115; - _1303_exprIdents = _out116; - if ((_1299_lhs).is_Ident) { - Dafny.ISequence _1304_rustId; - _1304_rustId = DCOMP.__default.escapeName(((_1299_lhs).dtor_ident)); - Std.Wrappers._IOption _1305_tpe; - _1305_tpe = (env).GetType(_1304_rustId); - } - RAST._IExpr _1306_lhsGen; - bool _1307_needsIIFE; - Dafny.ISet> _1308_recIdents; - DCOMP._IEnvironment _1309_resEnv; - RAST._IExpr _out117; - bool _out118; - Dafny.ISet> _out119; - DCOMP._IEnvironment _out120; - (this).GenAssignLhs(_1299_lhs, _1301_exprGen, selfIdent, env, out _out117, out _out118, out _out119, out _out120); - _1306_lhsGen = _out117; - _1307_needsIIFE = _out118; - _1308_recIdents = _out119; - _1309_resEnv = _out120; - generated = _1306_lhsGen; - newEnv = _1309_resEnv; - if (_1307_needsIIFE) { - generated = RAST.Expr.create_Block(generated); - } - readIdents = Dafny.Set>.Union(_1308_recIdents, _1303_exprIdents); - } - goto after_match15; - } - if (_source58.is_If) { - DAST._IExpression _1310_cond = _source58.dtor_cond; - Dafny.ISequence _1311_thnDafny = _source58.dtor_thn; - Dafny.ISequence _1312_elsDafny = _source58.dtor_els; - { - RAST._IExpr _1313_cond; - DCOMP._IOwnership _1314___v62; - Dafny.ISet> _1315_recIdents; - RAST._IExpr _out121; - DCOMP._IOwnership _out122; - Dafny.ISet> _out123; - (this).GenExpr(_1310_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out121, out _out122, out _out123); - _1313_cond = _out121; - _1314___v62 = _out122; - _1315_recIdents = _out123; - Dafny.ISequence _1316_condString; - _1316_condString = (_1313_cond)._ToString(DCOMP.__default.IND); - readIdents = _1315_recIdents; - RAST._IExpr _1317_thn; - Dafny.ISet> _1318_thnIdents; - DCOMP._IEnvironment _1319_thnEnv; - RAST._IExpr _out124; - Dafny.ISet> _out125; - DCOMP._IEnvironment _out126; - (this).GenStmts(_1311_thnDafny, selfIdent, env, isLast, earlyReturn, out _out124, out _out125, out _out126); - _1317_thn = _out124; - _1318_thnIdents = _out125; - _1319_thnEnv = _out126; - readIdents = Dafny.Set>.Union(readIdents, _1318_thnIdents); - RAST._IExpr _1320_els; - Dafny.ISet> _1321_elsIdents; - DCOMP._IEnvironment _1322_elsEnv; - RAST._IExpr _out127; - Dafny.ISet> _out128; - DCOMP._IEnvironment _out129; - (this).GenStmts(_1312_elsDafny, selfIdent, env, isLast, earlyReturn, out _out127, out _out128, out _out129); - _1320_els = _out127; - _1321_elsIdents = _out128; - _1322_elsEnv = _out129; - readIdents = Dafny.Set>.Union(readIdents, _1321_elsIdents); - newEnv = env; - generated = RAST.Expr.create_IfExpr(_1313_cond, _1317_thn, _1320_els); } - goto after_match15; } - if (_source58.is_Labeled) { - Dafny.ISequence _1323_lbl = _source58.dtor_lbl; - Dafny.ISequence _1324_body = _source58.dtor_body; - { - RAST._IExpr _1325_body; - Dafny.ISet> _1326_bodyIdents; - DCOMP._IEnvironment _1327_env2; - RAST._IExpr _out130; - Dafny.ISet> _out131; - DCOMP._IEnvironment _out132; - (this).GenStmts(_1324_body, selfIdent, env, isLast, earlyReturn, out _out130, out _out131, out _out132); - _1325_body = _out130; - _1326_bodyIdents = _out131; - _1327_env2 = _out132; - readIdents = _1326_bodyIdents; - generated = RAST.Expr.create_Labelled(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1323_lbl), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), RAST.Expr.create_StmtExpr(_1325_body, RAST.Expr.create_Break(Std.Wrappers.Option>.create_None())))); - newEnv = env; + { + if (_source58.is_Assign) { + DAST._IAssignLhs _1299_lhs = _source58.dtor_lhs; + DAST._IExpression _1300_expression = _source58.dtor_value; + { + RAST._IExpr _1301_exprGen; + DCOMP._IOwnership _1302___v61; + Dafny.ISet> _1303_exprIdents; + RAST._IExpr _out114; + DCOMP._IOwnership _out115; + Dafny.ISet> _out116; + (this).GenExpr(_1300_expression, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out114, out _out115, out _out116); + _1301_exprGen = _out114; + _1302___v61 = _out115; + _1303_exprIdents = _out116; + if ((_1299_lhs).is_Ident) { + Dafny.ISequence _1304_rustId; + _1304_rustId = DCOMP.__default.escapeName(((_1299_lhs).dtor_ident)); + Std.Wrappers._IOption _1305_tpe; + _1305_tpe = (env).GetType(_1304_rustId); + } + RAST._IExpr _1306_lhsGen; + bool _1307_needsIIFE; + Dafny.ISet> _1308_recIdents; + DCOMP._IEnvironment _1309_resEnv; + RAST._IExpr _out117; + bool _out118; + Dafny.ISet> _out119; + DCOMP._IEnvironment _out120; + (this).GenAssignLhs(_1299_lhs, _1301_exprGen, selfIdent, env, out _out117, out _out118, out _out119, out _out120); + _1306_lhsGen = _out117; + _1307_needsIIFE = _out118; + _1308_recIdents = _out119; + _1309_resEnv = _out120; + generated = _1306_lhsGen; + newEnv = _1309_resEnv; + if (_1307_needsIIFE) { + generated = RAST.Expr.create_Block(generated); + } + readIdents = Dafny.Set>.Union(_1308_recIdents, _1303_exprIdents); + } + goto after_match15; } - goto after_match15; } - if (_source58.is_While) { - DAST._IExpression _1328_cond = _source58.dtor_cond; - Dafny.ISequence _1329_body = _source58.dtor_body; - { - RAST._IExpr _1330_cond; - DCOMP._IOwnership _1331___v63; - Dafny.ISet> _1332_recIdents; - RAST._IExpr _out133; - DCOMP._IOwnership _out134; - Dafny.ISet> _out135; - (this).GenExpr(_1328_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out133, out _out134, out _out135); - _1330_cond = _out133; - _1331___v63 = _out134; - _1332_recIdents = _out135; - readIdents = _1332_recIdents; - RAST._IExpr _1333_bodyExpr; - Dafny.ISet> _1334_bodyIdents; - DCOMP._IEnvironment _1335_bodyEnv; - RAST._IExpr _out136; - Dafny.ISet> _out137; - DCOMP._IEnvironment _out138; - (this).GenStmts(_1329_body, selfIdent, env, false, earlyReturn, out _out136, out _out137, out _out138); - _1333_bodyExpr = _out136; - _1334_bodyIdents = _out137; - _1335_bodyEnv = _out138; - newEnv = env; - readIdents = Dafny.Set>.Union(readIdents, _1334_bodyIdents); - generated = RAST.Expr.create_Loop(Std.Wrappers.Option.create_Some(_1330_cond), _1333_bodyExpr); + { + if (_source58.is_If) { + DAST._IExpression _1310_cond = _source58.dtor_cond; + Dafny.ISequence _1311_thnDafny = _source58.dtor_thn; + Dafny.ISequence _1312_elsDafny = _source58.dtor_els; + { + RAST._IExpr _1313_cond; + DCOMP._IOwnership _1314___v62; + Dafny.ISet> _1315_recIdents; + RAST._IExpr _out121; + DCOMP._IOwnership _out122; + Dafny.ISet> _out123; + (this).GenExpr(_1310_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out121, out _out122, out _out123); + _1313_cond = _out121; + _1314___v62 = _out122; + _1315_recIdents = _out123; + Dafny.ISequence _1316_condString; + _1316_condString = (_1313_cond)._ToString(DCOMP.__default.IND); + readIdents = _1315_recIdents; + RAST._IExpr _1317_thn; + Dafny.ISet> _1318_thnIdents; + DCOMP._IEnvironment _1319_thnEnv; + RAST._IExpr _out124; + Dafny.ISet> _out125; + DCOMP._IEnvironment _out126; + (this).GenStmts(_1311_thnDafny, selfIdent, env, isLast, earlyReturn, out _out124, out _out125, out _out126); + _1317_thn = _out124; + _1318_thnIdents = _out125; + _1319_thnEnv = _out126; + readIdents = Dafny.Set>.Union(readIdents, _1318_thnIdents); + RAST._IExpr _1320_els; + Dafny.ISet> _1321_elsIdents; + DCOMP._IEnvironment _1322_elsEnv; + RAST._IExpr _out127; + Dafny.ISet> _out128; + DCOMP._IEnvironment _out129; + (this).GenStmts(_1312_elsDafny, selfIdent, env, isLast, earlyReturn, out _out127, out _out128, out _out129); + _1320_els = _out127; + _1321_elsIdents = _out128; + _1322_elsEnv = _out129; + readIdents = Dafny.Set>.Union(readIdents, _1321_elsIdents); + newEnv = env; + generated = RAST.Expr.create_IfExpr(_1313_cond, _1317_thn, _1320_els); + } + goto after_match15; } - goto after_match15; } - if (_source58.is_Foreach) { - Dafny.ISequence _1336_boundName = _source58.dtor_boundName; - DAST._IType _1337_boundType = _source58.dtor_boundType; - DAST._IExpression _1338_over = _source58.dtor_over; - Dafny.ISequence _1339_body = _source58.dtor_body; - { - RAST._IExpr _1340_over; - DCOMP._IOwnership _1341___v64; - Dafny.ISet> _1342_recIdents; - RAST._IExpr _out139; - DCOMP._IOwnership _out140; - Dafny.ISet> _out141; - (this).GenExpr(_1338_over, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out139, out _out140, out _out141); - _1340_over = _out139; - _1341___v64 = _out140; - _1342_recIdents = _out141; - RAST._IType _1343_boundTpe; - RAST._IType _out142; - _out142 = (this).GenType(_1337_boundType, false, false); - _1343_boundTpe = _out142; - readIdents = _1342_recIdents; - Dafny.ISequence _1344_boundRName; - _1344_boundRName = DCOMP.__default.escapeName(_1336_boundName); - RAST._IExpr _1345_bodyExpr; - Dafny.ISet> _1346_bodyIdents; - DCOMP._IEnvironment _1347_bodyEnv; - RAST._IExpr _out143; - Dafny.ISet> _out144; - DCOMP._IEnvironment _out145; - (this).GenStmts(_1339_body, selfIdent, (env).AddAssigned(_1344_boundRName, _1343_boundTpe), false, earlyReturn, out _out143, out _out144, out _out145); - _1345_bodyExpr = _out143; - _1346_bodyIdents = _out144; - _1347_bodyEnv = _out145; - readIdents = Dafny.Set>.Difference(Dafny.Set>.Union(readIdents, _1346_bodyIdents), Dafny.Set>.FromElements(_1344_boundRName)); - newEnv = env; - generated = RAST.Expr.create_For(_1344_boundRName, _1340_over, _1345_bodyExpr); + { + if (_source58.is_Labeled) { + Dafny.ISequence _1323_lbl = _source58.dtor_lbl; + Dafny.ISequence _1324_body = _source58.dtor_body; + { + RAST._IExpr _1325_body; + Dafny.ISet> _1326_bodyIdents; + DCOMP._IEnvironment _1327_env2; + RAST._IExpr _out130; + Dafny.ISet> _out131; + DCOMP._IEnvironment _out132; + (this).GenStmts(_1324_body, selfIdent, env, isLast, earlyReturn, out _out130, out _out131, out _out132); + _1325_body = _out130; + _1326_bodyIdents = _out131; + _1327_env2 = _out132; + readIdents = _1326_bodyIdents; + generated = RAST.Expr.create_Labelled(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1323_lbl), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), RAST.Expr.create_StmtExpr(_1325_body, RAST.Expr.create_Break(Std.Wrappers.Option>.create_None())))); + newEnv = env; + } + goto after_match15; } - goto after_match15; } - if (_source58.is_Break) { - Std.Wrappers._IOption> _1348_toLabel = _source58.dtor_toLabel; - { - Std.Wrappers._IOption> _source59 = _1348_toLabel; - if (_source59.is_Some) { - Dafny.ISequence _1349_lbl = _source59.dtor_value; - { - generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_Some(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1349_lbl))); - } - goto after_match16; - } + { + if (_source58.is_While) { + DAST._IExpression _1328_cond = _source58.dtor_cond; + Dafny.ISequence _1329_body = _source58.dtor_body; { - generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_None()); + RAST._IExpr _1330_cond; + DCOMP._IOwnership _1331___v63; + Dafny.ISet> _1332_recIdents; + RAST._IExpr _out133; + DCOMP._IOwnership _out134; + Dafny.ISet> _out135; + (this).GenExpr(_1328_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out133, out _out134, out _out135); + _1330_cond = _out133; + _1331___v63 = _out134; + _1332_recIdents = _out135; + readIdents = _1332_recIdents; + RAST._IExpr _1333_bodyExpr; + Dafny.ISet> _1334_bodyIdents; + DCOMP._IEnvironment _1335_bodyEnv; + RAST._IExpr _out136; + Dafny.ISet> _out137; + DCOMP._IEnvironment _out138; + (this).GenStmts(_1329_body, selfIdent, env, false, earlyReturn, out _out136, out _out137, out _out138); + _1333_bodyExpr = _out136; + _1334_bodyIdents = _out137; + _1335_bodyEnv = _out138; + newEnv = env; + readIdents = Dafny.Set>.Union(readIdents, _1334_bodyIdents); + generated = RAST.Expr.create_Loop(Std.Wrappers.Option.create_Some(_1330_cond), _1333_bodyExpr); } - after_match16: ; - readIdents = Dafny.Set>.FromElements(); - newEnv = env; + goto after_match15; } - goto after_match15; } - if (_source58.is_TailRecursive) { - Dafny.ISequence _1350_body = _source58.dtor_body; - { - generated = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); - if (!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) { - generated = (generated).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), Dafny.Sequence.UnicodeFromString("_this"), Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.__default.self).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); - } - newEnv = env; - BigInteger _hi27 = new BigInteger(((env).dtor_names).Count); - for (BigInteger _1351_paramI = BigInteger.Zero; _1351_paramI < _hi27; _1351_paramI++) { - Dafny.ISequence _1352_param; - _1352_param = ((env).dtor_names).Select(_1351_paramI); - RAST._IExpr _1353_paramInit; - DCOMP._IOwnership _1354___v65; - Dafny.ISet> _1355___v66; - RAST._IExpr _out146; - DCOMP._IOwnership _out147; - Dafny.ISet> _out148; - (this).GenIdent(_1352_param, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out146, out _out147, out _out148); - _1353_paramInit = _out146; - _1354___v65 = _out147; - _1355___v66 = _out148; - generated = (generated).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), _1352_param, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(_1353_paramInit))); - if (((env).dtor_types).Contains(_1352_param)) { - RAST._IType _1356_declaredType; - _1356_declaredType = (Dafny.Map, RAST._IType>.Select((env).dtor_types,_1352_param)).ToOwned(); - newEnv = (newEnv).AddAssigned(_1352_param, _1356_declaredType); - } + { + if (_source58.is_Foreach) { + Dafny.ISequence _1336_boundName = _source58.dtor_boundName; + DAST._IType _1337_boundType = _source58.dtor_boundType; + DAST._IExpression _1338_over = _source58.dtor_over; + Dafny.ISequence _1339_body = _source58.dtor_body; + { + RAST._IExpr _1340_over; + DCOMP._IOwnership _1341___v64; + Dafny.ISet> _1342_recIdents; + RAST._IExpr _out139; + DCOMP._IOwnership _out140; + Dafny.ISet> _out141; + (this).GenExpr(_1338_over, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out139, out _out140, out _out141); + _1340_over = _out139; + _1341___v64 = _out140; + _1342_recIdents = _out141; + RAST._IType _1343_boundTpe; + RAST._IType _out142; + _out142 = (this).GenType(_1337_boundType, false, false); + _1343_boundTpe = _out142; + readIdents = _1342_recIdents; + Dafny.ISequence _1344_boundRName; + _1344_boundRName = DCOMP.__default.escapeName(_1336_boundName); + RAST._IExpr _1345_bodyExpr; + Dafny.ISet> _1346_bodyIdents; + DCOMP._IEnvironment _1347_bodyEnv; + RAST._IExpr _out143; + Dafny.ISet> _out144; + DCOMP._IEnvironment _out145; + (this).GenStmts(_1339_body, selfIdent, (env).AddAssigned(_1344_boundRName, _1343_boundTpe), false, earlyReturn, out _out143, out _out144, out _out145); + _1345_bodyExpr = _out143; + _1346_bodyIdents = _out144; + _1347_bodyEnv = _out145; + readIdents = Dafny.Set>.Difference(Dafny.Set>.Union(readIdents, _1346_bodyIdents), Dafny.Set>.FromElements(_1344_boundRName)); + newEnv = env; + generated = RAST.Expr.create_For(_1344_boundRName, _1340_over, _1345_bodyExpr); } - RAST._IExpr _1357_bodyExpr; - Dafny.ISet> _1358_bodyIdents; - DCOMP._IEnvironment _1359_bodyEnv; - RAST._IExpr _out149; - Dafny.ISet> _out150; - DCOMP._IEnvironment _out151; - (this).GenStmts(_1350_body, ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) ? (Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("_this"))) : (Std.Wrappers.Option>.create_None())), newEnv, false, earlyReturn, out _out149, out _out150, out _out151); - _1357_bodyExpr = _out149; - _1358_bodyIdents = _out150; - _1359_bodyEnv = _out151; - readIdents = _1358_bodyIdents; - generated = (generated).Then(RAST.Expr.create_Labelled(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), _1357_bodyExpr))); - } - goto after_match15; - } - if (_source58.is_JumpTailCallStart) { - { - generated = RAST.Expr.create_Continue(Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"))); - readIdents = Dafny.Set>.FromElements(); - newEnv = env; + goto after_match15; } - goto after_match15; } - if (_source58.is_Call) { - DAST._IExpression _1360_on = _source58.dtor_on; - DAST._ICallName _1361_name = _source58.dtor_callName; - Dafny.ISequence _1362_typeArgs = _source58.dtor_typeArgs; - Dafny.ISequence _1363_args = _source58.dtor_args; - Std.Wrappers._IOption>> _1364_maybeOutVars = _source58.dtor_outs; - { - readIdents = Dafny.Set>.FromElements(); - RAST._IExpr _1365_onExpr; - DCOMP._IOwnership _1366___v67; - Dafny.ISet> _1367_enclosingIdents; - RAST._IExpr _out152; - DCOMP._IOwnership _out153; - Dafny.ISet> _out154; - (this).GenExpr(_1360_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out152, out _out153, out _out154); - _1365_onExpr = _out152; - _1366___v67 = _out153; - _1367_enclosingIdents = _out154; - Dafny.ISequence _1368_typeArgsR; - _1368_typeArgsR = Dafny.Sequence.FromElements(); - if ((new BigInteger((_1362_typeArgs).Count)) >= (BigInteger.One)) { - BigInteger _1369_typeI; - _1369_typeI = BigInteger.Zero; - while ((_1369_typeI) < (new BigInteger((_1362_typeArgs).Count))) { - RAST._IType _1370_tpe; - RAST._IType _out155; - _out155 = (this).GenType((_1362_typeArgs).Select(_1369_typeI), false, false); - _1370_tpe = _out155; - _1368_typeArgsR = Dafny.Sequence.Concat(_1368_typeArgsR, Dafny.Sequence.FromElements(_1370_tpe)); - _1369_typeI = (_1369_typeI) + (BigInteger.One); - } - } - Dafny.ISequence _1371_argExprs; - _1371_argExprs = Dafny.Sequence.FromElements(); - BigInteger _hi28 = new BigInteger((_1363_args).Count); - for (BigInteger _1372_i = BigInteger.Zero; _1372_i < _hi28; _1372_i++) { - DCOMP._IOwnership _1373_argOwnership; - _1373_argOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); - if (((_1361_name).is_CallName) && ((_1372_i) < (new BigInteger((((_1361_name).dtor_signature)).Count)))) { - RAST._IType _1374_tpe; - RAST._IType _out156; - _out156 = (this).GenType(((((_1361_name).dtor_signature)).Select(_1372_i)).dtor_typ, false, false); - _1374_tpe = _out156; - if ((_1374_tpe).CanReadWithoutClone()) { - _1373_argOwnership = DCOMP.Ownership.create_OwnershipOwned(); + { + if (_source58.is_Break) { + Std.Wrappers._IOption> _1348_toLabel = _source58.dtor_toLabel; + { + Std.Wrappers._IOption> _source59 = _1348_toLabel; + { + if (_source59.is_Some) { + Dafny.ISequence _1349_lbl = _source59.dtor_value; + { + generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_Some(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1349_lbl))); + } + goto after_match16; } } - RAST._IExpr _1375_argExpr; - DCOMP._IOwnership _1376_ownership; - Dafny.ISet> _1377_argIdents; - RAST._IExpr _out157; - DCOMP._IOwnership _out158; - Dafny.ISet> _out159; - (this).GenExpr((_1363_args).Select(_1372_i), selfIdent, env, _1373_argOwnership, out _out157, out _out158, out _out159); - _1375_argExpr = _out157; - _1376_ownership = _out158; - _1377_argIdents = _out159; - _1371_argExprs = Dafny.Sequence.Concat(_1371_argExprs, Dafny.Sequence.FromElements(_1375_argExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1377_argIdents); - } - readIdents = Dafny.Set>.Union(readIdents, _1367_enclosingIdents); - Dafny.ISequence _1378_renderedName; - DAST._ICallName _source60 = _1361_name; - if (_source60.is_CallName) { - Dafny.ISequence _1379_name = _source60.dtor_name; - _1378_renderedName = DCOMP.__default.escapeName(_1379_name); - goto after_match17; - } - bool disjunctiveMatch9 = false; - if (_source60.is_MapBuilderAdd) { - disjunctiveMatch9 = true; - } - if (_source60.is_SetBuilderAdd) { - disjunctiveMatch9 = true; - } - if (disjunctiveMatch9) { - _1378_renderedName = Dafny.Sequence.UnicodeFromString("add"); - goto after_match17; - } - _1378_renderedName = Dafny.Sequence.UnicodeFromString("build"); - after_match17: ; - DAST._IExpression _source61 = _1360_on; - if (_source61.is_Companion) { { - _1365_onExpr = (_1365_onExpr).MSel(_1378_renderedName); + { + generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_None()); + } } - goto after_match18; + after_match16: ; + readIdents = Dafny.Set>.FromElements(); + newEnv = env; } + goto after_match15; + } + } + { + if (_source58.is_TailRecursive) { + Dafny.ISequence _1350_body = _source58.dtor_body; { - _1365_onExpr = (_1365_onExpr).Sel(_1378_renderedName); - } - after_match18: ; - generated = _1365_onExpr; - if ((new BigInteger((_1368_typeArgsR).Count)).Sign == 1) { - generated = (generated).ApplyType(_1368_typeArgsR); - } - generated = (generated).Apply(_1371_argExprs); - if (((_1364_maybeOutVars).is_Some) && ((new BigInteger(((_1364_maybeOutVars).dtor_value).Count)) == (BigInteger.One))) { - Dafny.ISequence _1380_outVar; - _1380_outVar = DCOMP.__default.escapeName((((_1364_maybeOutVars).dtor_value).Select(BigInteger.Zero))); - generated = RAST.__default.AssignVar(_1380_outVar, generated); - } else if (((_1364_maybeOutVars).is_None) || ((new BigInteger(((_1364_maybeOutVars).dtor_value).Count)).Sign == 0)) { - } else { - Dafny.ISequence _1381_tmpVar; - _1381_tmpVar = Dafny.Sequence.UnicodeFromString("_x"); - RAST._IExpr _1382_tmpId; - _1382_tmpId = RAST.Expr.create_Identifier(_1381_tmpVar); - generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), _1381_tmpVar, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(generated)); - Dafny.ISequence> _1383_outVars; - _1383_outVars = (_1364_maybeOutVars).dtor_value; - BigInteger _hi29 = new BigInteger((_1383_outVars).Count); - for (BigInteger _1384_outI = BigInteger.Zero; _1384_outI < _hi29; _1384_outI++) { - Dafny.ISequence _1385_outVar; - _1385_outVar = DCOMP.__default.escapeName(((_1383_outVars).Select(_1384_outI))); - RAST._IExpr _1386_rhs; - _1386_rhs = (_1382_tmpId).Sel(Std.Strings.__default.OfNat(_1384_outI)); - generated = (generated).Then(RAST.__default.AssignVar(_1385_outVar, _1386_rhs)); + generated = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); + if (!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) { + generated = (generated).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), Dafny.Sequence.UnicodeFromString("_this"), Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.__default.self).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); + } + newEnv = env; + BigInteger _hi27 = new BigInteger(((env).dtor_names).Count); + for (BigInteger _1351_paramI = BigInteger.Zero; _1351_paramI < _hi27; _1351_paramI++) { + Dafny.ISequence _1352_param; + _1352_param = ((env).dtor_names).Select(_1351_paramI); + RAST._IExpr _1353_paramInit; + DCOMP._IOwnership _1354___v65; + Dafny.ISet> _1355___v66; + RAST._IExpr _out146; + DCOMP._IOwnership _out147; + Dafny.ISet> _out148; + (this).GenIdent(_1352_param, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out146, out _out147, out _out148); + _1353_paramInit = _out146; + _1354___v65 = _out147; + _1355___v66 = _out148; + generated = (generated).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), _1352_param, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(_1353_paramInit))); + if (((env).dtor_types).Contains(_1352_param)) { + RAST._IType _1356_declaredType; + _1356_declaredType = (Dafny.Map, RAST._IType>.Select((env).dtor_types,_1352_param)).ToOwned(); + newEnv = (newEnv).AddAssigned(_1352_param, _1356_declaredType); + } } + RAST._IExpr _1357_bodyExpr; + Dafny.ISet> _1358_bodyIdents; + DCOMP._IEnvironment _1359_bodyEnv; + RAST._IExpr _out149; + Dafny.ISet> _out150; + DCOMP._IEnvironment _out151; + (this).GenStmts(_1350_body, ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) ? (Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("_this"))) : (Std.Wrappers.Option>.create_None())), newEnv, false, earlyReturn, out _out149, out _out150, out _out151); + _1357_bodyExpr = _out149; + _1358_bodyIdents = _out150; + _1359_bodyEnv = _out151; + readIdents = _1358_bodyIdents; + generated = (generated).Then(RAST.Expr.create_Labelled(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), _1357_bodyExpr))); } - newEnv = env; + goto after_match15; } - goto after_match15; } - if (_source58.is_Return) { - DAST._IExpression _1387_exprDafny = _source58.dtor_expr; - { - RAST._IExpr _1388_expr; - DCOMP._IOwnership _1389___v72; - Dafny.ISet> _1390_recIdents; - RAST._IExpr _out160; - DCOMP._IOwnership _out161; - Dafny.ISet> _out162; - (this).GenExpr(_1387_exprDafny, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out160, out _out161, out _out162); - _1388_expr = _out160; - _1389___v72 = _out161; - _1390_recIdents = _out162; - readIdents = _1390_recIdents; - if (isLast) { - generated = _1388_expr; - } else { - generated = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(_1388_expr)); + { + if (_source58.is_JumpTailCallStart) { + { + generated = RAST.Expr.create_Continue(Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"))); + readIdents = Dafny.Set>.FromElements(); + newEnv = env; } - newEnv = env; + goto after_match15; } - goto after_match15; } - if (_source58.is_EarlyReturn) { - { - generated = earlyReturn; - readIdents = Dafny.Set>.FromElements(); - newEnv = env; - } - goto after_match15; + { + if (_source58.is_Call) { + DAST._IExpression _1360_on = _source58.dtor_on; + DAST._ICallName _1361_name = _source58.dtor_callName; + Dafny.ISequence _1362_typeArgs = _source58.dtor_typeArgs; + Dafny.ISequence _1363_args = _source58.dtor_args; + Std.Wrappers._IOption>> _1364_maybeOutVars = _source58.dtor_outs; + { + readIdents = Dafny.Set>.FromElements(); + RAST._IExpr _1365_onExpr; + DCOMP._IOwnership _1366___v67; + Dafny.ISet> _1367_enclosingIdents; + RAST._IExpr _out152; + DCOMP._IOwnership _out153; + Dafny.ISet> _out154; + (this).GenExpr(_1360_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out152, out _out153, out _out154); + _1365_onExpr = _out152; + _1366___v67 = _out153; + _1367_enclosingIdents = _out154; + Dafny.ISequence _1368_typeArgsR; + _1368_typeArgsR = Dafny.Sequence.FromElements(); + if ((new BigInteger((_1362_typeArgs).Count)) >= (BigInteger.One)) { + BigInteger _1369_typeI; + _1369_typeI = BigInteger.Zero; + while ((_1369_typeI) < (new BigInteger((_1362_typeArgs).Count))) { + RAST._IType _1370_tpe; + RAST._IType _out155; + _out155 = (this).GenType((_1362_typeArgs).Select(_1369_typeI), false, false); + _1370_tpe = _out155; + _1368_typeArgsR = Dafny.Sequence.Concat(_1368_typeArgsR, Dafny.Sequence.FromElements(_1370_tpe)); + _1369_typeI = (_1369_typeI) + (BigInteger.One); + } + } + Dafny.ISequence _1371_argExprs; + _1371_argExprs = Dafny.Sequence.FromElements(); + BigInteger _hi28 = new BigInteger((_1363_args).Count); + for (BigInteger _1372_i = BigInteger.Zero; _1372_i < _hi28; _1372_i++) { + DCOMP._IOwnership _1373_argOwnership; + _1373_argOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + if (((_1361_name).is_CallName) && ((_1372_i) < (new BigInteger((((_1361_name).dtor_signature)).Count)))) { + RAST._IType _1374_tpe; + RAST._IType _out156; + _out156 = (this).GenType(((((_1361_name).dtor_signature)).Select(_1372_i)).dtor_typ, false, false); + _1374_tpe = _out156; + if ((_1374_tpe).CanReadWithoutClone()) { + _1373_argOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } + } + RAST._IExpr _1375_argExpr; + DCOMP._IOwnership _1376_ownership; + Dafny.ISet> _1377_argIdents; + RAST._IExpr _out157; + DCOMP._IOwnership _out158; + Dafny.ISet> _out159; + (this).GenExpr((_1363_args).Select(_1372_i), selfIdent, env, _1373_argOwnership, out _out157, out _out158, out _out159); + _1375_argExpr = _out157; + _1376_ownership = _out158; + _1377_argIdents = _out159; + _1371_argExprs = Dafny.Sequence.Concat(_1371_argExprs, Dafny.Sequence.FromElements(_1375_argExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1377_argIdents); + } + readIdents = Dafny.Set>.Union(readIdents, _1367_enclosingIdents); + Dafny.ISequence _1378_renderedName; + DAST._ICallName _source60 = _1361_name; + { + if (_source60.is_CallName) { + Dafny.ISequence _1379_name = _source60.dtor_name; + _1378_renderedName = DCOMP.__default.escapeName(_1379_name); + goto after_match17; + } + } + { + bool disjunctiveMatch9 = false; + if (_source60.is_MapBuilderAdd) { + disjunctiveMatch9 = true; + } + if (_source60.is_SetBuilderAdd) { + disjunctiveMatch9 = true; + } + if (disjunctiveMatch9) { + _1378_renderedName = Dafny.Sequence.UnicodeFromString("add"); + goto after_match17; + } + } + { + _1378_renderedName = Dafny.Sequence.UnicodeFromString("build"); + } + after_match17: ; + DAST._IExpression _source61 = _1360_on; + { + if (_source61.is_Companion) { + { + _1365_onExpr = (_1365_onExpr).MSel(_1378_renderedName); + } + goto after_match18; + } + } + { + { + _1365_onExpr = (_1365_onExpr).Sel(_1378_renderedName); + } + } + after_match18: ; + generated = _1365_onExpr; + if ((new BigInteger((_1368_typeArgsR).Count)).Sign == 1) { + generated = (generated).ApplyType(_1368_typeArgsR); + } + generated = (generated).Apply(_1371_argExprs); + if (((_1364_maybeOutVars).is_Some) && ((new BigInteger(((_1364_maybeOutVars).dtor_value).Count)) == (BigInteger.One))) { + Dafny.ISequence _1380_outVar; + _1380_outVar = DCOMP.__default.escapeName((((_1364_maybeOutVars).dtor_value).Select(BigInteger.Zero))); + generated = RAST.__default.AssignVar(_1380_outVar, generated); + } else if (((_1364_maybeOutVars).is_None) || ((new BigInteger(((_1364_maybeOutVars).dtor_value).Count)).Sign == 0)) { + } else { + Dafny.ISequence _1381_tmpVar; + _1381_tmpVar = Dafny.Sequence.UnicodeFromString("_x"); + RAST._IExpr _1382_tmpId; + _1382_tmpId = RAST.Expr.create_Identifier(_1381_tmpVar); + generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), _1381_tmpVar, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(generated)); + Dafny.ISequence> _1383_outVars; + _1383_outVars = (_1364_maybeOutVars).dtor_value; + BigInteger _hi29 = new BigInteger((_1383_outVars).Count); + for (BigInteger _1384_outI = BigInteger.Zero; _1384_outI < _hi29; _1384_outI++) { + Dafny.ISequence _1385_outVar; + _1385_outVar = DCOMP.__default.escapeName(((_1383_outVars).Select(_1384_outI))); + RAST._IExpr _1386_rhs; + _1386_rhs = (_1382_tmpId).Sel(Std.Strings.__default.OfNat(_1384_outI)); + generated = (generated).Then(RAST.__default.AssignVar(_1385_outVar, _1386_rhs)); + } + } + newEnv = env; + } + goto after_match15; + } } - if (_source58.is_Halt) { - { - generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("panic!"))).Apply1(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("Halt"), false, false)); - readIdents = Dafny.Set>.FromElements(); - newEnv = env; + { + if (_source58.is_Return) { + DAST._IExpression _1387_exprDafny = _source58.dtor_expr; + { + RAST._IExpr _1388_expr; + DCOMP._IOwnership _1389___v72; + Dafny.ISet> _1390_recIdents; + RAST._IExpr _out160; + DCOMP._IOwnership _out161; + Dafny.ISet> _out162; + (this).GenExpr(_1387_exprDafny, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out160, out _out161, out _out162); + _1388_expr = _out160; + _1389___v72 = _out161; + _1390_recIdents = _out162; + readIdents = _1390_recIdents; + if (isLast) { + generated = _1388_expr; + } else { + generated = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(_1388_expr)); + } + newEnv = env; + } + goto after_match15; + } + } + { + if (_source58.is_EarlyReturn) { + { + generated = earlyReturn; + readIdents = Dafny.Set>.FromElements(); + newEnv = env; + } + goto after_match15; + } + } + { + if (_source58.is_Halt) { + { + generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("panic!"))).Apply1(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("Halt"), false, false)); + readIdents = Dafny.Set>.FromElements(); + newEnv = env; + } + goto after_match15; } - goto after_match15; } - DAST._IExpression _1391_e = _source58.dtor_Print_a0; { - RAST._IExpr _1392_printedExpr; - DCOMP._IOwnership _1393_recOwnership; - Dafny.ISet> _1394_recIdents; - RAST._IExpr _out163; - DCOMP._IOwnership _out164; - Dafny.ISet> _out165; - (this).GenExpr(_1391_e, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out163, out _out164, out _out165); - _1392_printedExpr = _out163; - _1393_recOwnership = _out164; - _1394_recIdents = _out165; - generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("print!"))).Apply(Dafny.Sequence.FromElements(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("{}"), false, false), ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("DafnyPrintWrapper"))).Apply1(_1392_printedExpr))); - readIdents = _1394_recIdents; - newEnv = env; + DAST._IExpression _1391_e = _source58.dtor_Print_a0; + { + RAST._IExpr _1392_printedExpr; + DCOMP._IOwnership _1393_recOwnership; + Dafny.ISet> _1394_recIdents; + RAST._IExpr _out163; + DCOMP._IOwnership _out164; + Dafny.ISet> _out165; + (this).GenExpr(_1391_e, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out163, out _out164, out _out165); + _1392_printedExpr = _out163; + _1393_recOwnership = _out164; + _1394_recIdents = _out165; + generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("print!"))).Apply(Dafny.Sequence.FromElements(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("{}"), false, false), ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("DafnyPrintWrapper"))).Apply1(_1392_printedExpr))); + readIdents = _1394_recIdents; + newEnv = env; + } } after_match15: ; } public static Std.Wrappers._IOption NewtypeToRustType(DAST._IType @base, DAST._INewtypeRange range) { DAST._INewtypeRange _source62 = range; - if (_source62.is_NoRange) { - return Std.Wrappers.Option.create_None(); + { + if (_source62.is_NoRange) { + return Std.Wrappers.Option.create_None(); + } + } + { + if (_source62.is_U8) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U8()); + } } - if (_source62.is_U8) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_U8()); + { + if (_source62.is_U16) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U16()); + } } - if (_source62.is_U16) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_U16()); + { + if (_source62.is_U32) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U32()); + } } - if (_source62.is_U32) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_U32()); + { + if (_source62.is_U64) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U64()); + } } - if (_source62.is_U64) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_U64()); + { + if (_source62.is_U128) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_U128()); + } } - if (_source62.is_U128) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_U128()); + { + if (_source62.is_I8) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I8()); + } } - if (_source62.is_I8) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_I8()); + { + if (_source62.is_I16) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I16()); + } } - if (_source62.is_I16) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_I16()); + { + if (_source62.is_I32) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I32()); + } } - if (_source62.is_I32) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_I32()); + { + if (_source62.is_I64) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I64()); + } } - if (_source62.is_I64) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_I64()); + { + if (_source62.is_I128) { + return Std.Wrappers.Option.create_Some(RAST.Type.create_I128()); + } } - if (_source62.is_I128) { - return Std.Wrappers.Option.create_Some(RAST.Type.create_I128()); + { + return Std.Wrappers.Option.create_None(); } - return Std.Wrappers.Option.create_None(); } public static void FromOwned(RAST._IExpr r, DCOMP._IOwnership expectedOwnership, out RAST._IExpr @out, out DCOMP._IOwnership resultingOwnership) { @@ -2271,177 +2433,199 @@ public void GenExprLiteral(DAST._IExpression e, Std.Wrappers._IOption>.Empty; DAST._IExpression _source63 = e; - if (_source63.is_Literal) { - DAST._ILiteral _h140 = _source63.dtor_Literal_a0; - if (_h140.is_BoolLiteral) { - bool _1395_b = _h140.dtor_BoolLiteral_a0; - { - RAST._IExpr _out170; - DCOMP._IOwnership _out171; - DCOMP.COMP.FromOwned(RAST.Expr.create_LiteralBool(_1395_b), expectedOwnership, out _out170, out _out171); - r = _out170; - resultingOwnership = _out171; - readIdents = Dafny.Set>.FromElements(); - return ; + { + if (_source63.is_Literal) { + DAST._ILiteral _h140 = _source63.dtor_Literal_a0; + if (_h140.is_BoolLiteral) { + bool _1395_b = _h140.dtor_BoolLiteral_a0; + { + RAST._IExpr _out170; + DCOMP._IOwnership _out171; + DCOMP.COMP.FromOwned(RAST.Expr.create_LiteralBool(_1395_b), expectedOwnership, out _out170, out _out171); + r = _out170; + resultingOwnership = _out171; + readIdents = Dafny.Set>.FromElements(); + return ; + } + goto after_match19; } - goto after_match19; } } - if (_source63.is_Literal) { - DAST._ILiteral _h141 = _source63.dtor_Literal_a0; - if (_h141.is_IntLiteral) { - Dafny.ISequence _1396_i = _h141.dtor_IntLiteral_a0; - DAST._IType _1397_t = _h141.dtor_IntLiteral_a1; - { - DAST._IType _source64 = _1397_t; - if (_source64.is_Primitive) { - DAST._IPrimitive _h80 = _source64.dtor_Primitive_a0; - if (_h80.is_Int) { - { - if ((new BigInteger((_1396_i).Count)) <= (new BigInteger(4))) { - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralInt(_1396_i)); - } else { - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralString(_1396_i, true, false)); + { + if (_source63.is_Literal) { + DAST._ILiteral _h141 = _source63.dtor_Literal_a0; + if (_h141.is_IntLiteral) { + Dafny.ISequence _1396_i = _h141.dtor_IntLiteral_a0; + DAST._IType _1397_t = _h141.dtor_IntLiteral_a1; + { + DAST._IType _source64 = _1397_t; + { + if (_source64.is_Primitive) { + DAST._IPrimitive _h80 = _source64.dtor_Primitive_a0; + if (_h80.is_Int) { + { + if ((new BigInteger((_1396_i).Count)) <= (new BigInteger(4))) { + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralInt(_1396_i)); + } else { + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralString(_1396_i, true, false)); + } + } + goto after_match20; } } - goto after_match20; } + { + DAST._IType _1398_o = _source64; + { + RAST._IType _1399_genType; + RAST._IType _out172; + _out172 = (this).GenType(_1398_o, false, false); + _1399_genType = _out172; + r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(_1396_i), _1399_genType); + } + } + after_match20: ; + RAST._IExpr _out173; + DCOMP._IOwnership _out174; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out173, out _out174); + r = _out173; + resultingOwnership = _out174; + readIdents = Dafny.Set>.FromElements(); + return ; } - DAST._IType _1398_o = _source64; - { - RAST._IType _1399_genType; - RAST._IType _out172; - _out172 = (this).GenType(_1398_o, false, false); - _1399_genType = _out172; - r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(_1396_i), _1399_genType); - } - after_match20: ; - RAST._IExpr _out173; - DCOMP._IOwnership _out174; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out173, out _out174); - r = _out173; - resultingOwnership = _out174; - readIdents = Dafny.Set>.FromElements(); - return ; + goto after_match19; } - goto after_match19; } } - if (_source63.is_Literal) { - DAST._ILiteral _h142 = _source63.dtor_Literal_a0; - if (_h142.is_DecLiteral) { - Dafny.ISequence _1400_n = _h142.dtor_DecLiteral_a0; - Dafny.ISequence _1401_d = _h142.dtor_DecLiteral_a1; - DAST._IType _1402_t = _h142.dtor_DecLiteral_a2; - { - DAST._IType _source65 = _1402_t; - if (_source65.is_Primitive) { - DAST._IPrimitive _h81 = _source65.dtor_Primitive_a0; - if (_h81.is_Real) { + { + if (_source63.is_Literal) { + DAST._ILiteral _h142 = _source63.dtor_Literal_a0; + if (_h142.is_DecLiteral) { + Dafny.ISequence _1400_n = _h142.dtor_DecLiteral_a0; + Dafny.ISequence _1401_d = _h142.dtor_DecLiteral_a1; + DAST._IType _1402_t = _h142.dtor_DecLiteral_a2; + { + DAST._IType _source65 = _1402_t; + { + if (_source65.is_Primitive) { + DAST._IPrimitive _h81 = _source65.dtor_Primitive_a0; + if (_h81.is_Real) { + { + r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::new(::dafny_runtime::BigInt::parse_bytes(b\""), _1400_n), Dafny.Sequence.UnicodeFromString("\", 10).unwrap(), ::dafny_runtime::BigInt::parse_bytes(b\"")), _1401_d), Dafny.Sequence.UnicodeFromString("\", 10).unwrap())")))); + } + goto after_match21; + } + } + } + { + DAST._IType _1403_o = _source65; { - r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::new(::dafny_runtime::BigInt::parse_bytes(b\""), _1400_n), Dafny.Sequence.UnicodeFromString("\", 10).unwrap(), ::dafny_runtime::BigInt::parse_bytes(b\"")), _1401_d), Dafny.Sequence.UnicodeFromString("\", 10).unwrap())")))); + RAST._IType _1404_genType; + RAST._IType _out175; + _out175 = (this).GenType(_1403_o, false, false); + _1404_genType = _out175; + r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), _1400_n), Dafny.Sequence.UnicodeFromString(".0 / ")), _1401_d), Dafny.Sequence.UnicodeFromString(".0")), Dafny.Sequence.UnicodeFromString(")"))), _1404_genType); } - goto after_match21; } + after_match21: ; + RAST._IExpr _out176; + DCOMP._IOwnership _out177; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out176, out _out177); + r = _out176; + resultingOwnership = _out177; + readIdents = Dafny.Set>.FromElements(); + return ; } - DAST._IType _1403_o = _source65; - { - RAST._IType _1404_genType; - RAST._IType _out175; - _out175 = (this).GenType(_1403_o, false, false); - _1404_genType = _out175; - r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), _1400_n), Dafny.Sequence.UnicodeFromString(".0 / ")), _1401_d), Dafny.Sequence.UnicodeFromString(".0")), Dafny.Sequence.UnicodeFromString(")"))), _1404_genType); - } - after_match21: ; - RAST._IExpr _out176; - DCOMP._IOwnership _out177; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out176, out _out177); - r = _out176; - resultingOwnership = _out177; - readIdents = Dafny.Set>.FromElements(); - return ; + goto after_match19; } - goto after_match19; } } - if (_source63.is_Literal) { - DAST._ILiteral _h143 = _source63.dtor_Literal_a0; - if (_h143.is_StringLiteral) { - Dafny.ISequence _1405_l = _h143.dtor_StringLiteral_a0; - bool _1406_verbatim = _h143.dtor_verbatim; - { - if (_1406_verbatim) { - (this).error = Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("Verbatim strings prefixed by @ not supported yet.")); + { + if (_source63.is_Literal) { + DAST._ILiteral _h143 = _source63.dtor_Literal_a0; + if (_h143.is_StringLiteral) { + Dafny.ISequence _1405_l = _h143.dtor_StringLiteral_a0; + bool _1406_verbatim = _h143.dtor_verbatim; + { + if (_1406_verbatim) { + (this).error = Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("Verbatim strings prefixed by @ not supported yet.")); + } + r = ((RAST.__default.dafny__runtime).MSel((this).string__of)).Apply1(RAST.Expr.create_LiteralString(_1405_l, false, _1406_verbatim)); + RAST._IExpr _out178; + DCOMP._IOwnership _out179; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out178, out _out179); + r = _out178; + resultingOwnership = _out179; + readIdents = Dafny.Set>.FromElements(); + return ; } - r = ((RAST.__default.dafny__runtime).MSel((this).string__of)).Apply1(RAST.Expr.create_LiteralString(_1405_l, false, _1406_verbatim)); - RAST._IExpr _out178; - DCOMP._IOwnership _out179; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out178, out _out179); - r = _out178; - resultingOwnership = _out179; - readIdents = Dafny.Set>.FromElements(); - return ; + goto after_match19; } - goto after_match19; } } - if (_source63.is_Literal) { - DAST._ILiteral _h144 = _source63.dtor_Literal_a0; - if (_h144.is_CharLiteralUTF16) { - BigInteger _1407_c = _h144.dtor_CharLiteralUTF16_a0; - { - r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(_1407_c)); - r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); - r = ((RAST.__default.dafny__runtime).MSel((this).DafnyChar)).Apply1(r); - RAST._IExpr _out180; - DCOMP._IOwnership _out181; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out180, out _out181); - r = _out180; - resultingOwnership = _out181; - readIdents = Dafny.Set>.FromElements(); - return ; + { + if (_source63.is_Literal) { + DAST._ILiteral _h144 = _source63.dtor_Literal_a0; + if (_h144.is_CharLiteralUTF16) { + BigInteger _1407_c = _h144.dtor_CharLiteralUTF16_a0; + { + r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(_1407_c)); + r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); + r = ((RAST.__default.dafny__runtime).MSel((this).DafnyChar)).Apply1(r); + RAST._IExpr _out180; + DCOMP._IOwnership _out181; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out180, out _out181); + r = _out180; + resultingOwnership = _out181; + readIdents = Dafny.Set>.FromElements(); + return ; + } + goto after_match19; } - goto after_match19; } } - if (_source63.is_Literal) { - DAST._ILiteral _h145 = _source63.dtor_Literal_a0; - if (_h145.is_CharLiteral) { - Dafny.Rune _1408_c = _h145.dtor_CharLiteral_a0; - { - r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(new BigInteger((_1408_c).Value))); - if (!((this).UnicodeChars)) { - r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); - } else { - r = (((((((RAST.__default.@global).MSel(Dafny.Sequence.UnicodeFromString("std"))).MSel(Dafny.Sequence.UnicodeFromString("primitive"))).MSel(Dafny.Sequence.UnicodeFromString("char"))).MSel(Dafny.Sequence.UnicodeFromString("from_u32"))).Apply1(r)).Sel(Dafny.Sequence.UnicodeFromString("unwrap"))).Apply(Dafny.Sequence.FromElements()); + { + if (_source63.is_Literal) { + DAST._ILiteral _h145 = _source63.dtor_Literal_a0; + if (_h145.is_CharLiteral) { + Dafny.Rune _1408_c = _h145.dtor_CharLiteral_a0; + { + r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(new BigInteger((_1408_c).Value))); + if (!((this).UnicodeChars)) { + r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); + } else { + r = (((((((RAST.__default.@global).MSel(Dafny.Sequence.UnicodeFromString("std"))).MSel(Dafny.Sequence.UnicodeFromString("primitive"))).MSel(Dafny.Sequence.UnicodeFromString("char"))).MSel(Dafny.Sequence.UnicodeFromString("from_u32"))).Apply1(r)).Sel(Dafny.Sequence.UnicodeFromString("unwrap"))).Apply(Dafny.Sequence.FromElements()); + } + r = ((RAST.__default.dafny__runtime).MSel((this).DafnyChar)).Apply1(r); + RAST._IExpr _out182; + DCOMP._IOwnership _out183; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out182, out _out183); + r = _out182; + resultingOwnership = _out183; + readIdents = Dafny.Set>.FromElements(); + return ; } - r = ((RAST.__default.dafny__runtime).MSel((this).DafnyChar)).Apply1(r); - RAST._IExpr _out182; - DCOMP._IOwnership _out183; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out182, out _out183); - r = _out182; - resultingOwnership = _out183; - readIdents = Dafny.Set>.FromElements(); - return ; + goto after_match19; } - goto after_match19; } } - DAST._ILiteral _h146 = _source63.dtor_Literal_a0; - DAST._IType _1409_tpe = _h146.dtor_Null_a0; { - RAST._IType _1410_tpeGen; - RAST._IType _out184; - _out184 = (this).GenType(_1409_tpe, false, false); - _1410_tpeGen = _out184; - r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("None")), _1410_tpeGen); - RAST._IExpr _out185; - DCOMP._IOwnership _out186; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out185, out _out186); - r = _out185; - resultingOwnership = _out186; - readIdents = Dafny.Set>.FromElements(); - return ; + DAST._ILiteral _h146 = _source63.dtor_Literal_a0; + DAST._IType _1409_tpe = _h146.dtor_Null_a0; + { + RAST._IType _1410_tpeGen; + RAST._IType _out184; + _out184 = (this).GenType(_1409_tpe, false, false); + _1410_tpeGen = _out184; + r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("None")), _1410_tpeGen); + RAST._IExpr _out185; + DCOMP._IOwnership _out186; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out185, out _out186); + r = _out185; + resultingOwnership = _out186; + readIdents = Dafny.Set>.FromElements(); + return ; + } } after_match19: ; } @@ -2457,111 +2641,145 @@ public void GenExprBinary(DAST._IExpression e, Std.Wrappers._IOption.UnicodeFromString("contains"))).Apply1(_1420_left); + { + if (_source69.is_In) { + { + r = ((_1423_right).Sel(Dafny.Sequence.UnicodeFromString("contains"))).Apply1(_1420_left); + } + goto after_match25; } - goto after_match25; - } - if (_source69.is_SeqProperPrefix) { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); - goto after_match25; } - if (_source69.is_SeqPrefix) { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); - goto after_match25; - } - if (_source69.is_SetMerge) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); + { + if (_source69.is_SeqProperPrefix) { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); + goto after_match25; } - goto after_match25; } - if (_source69.is_SetSubtraction) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); + { + if (_source69.is_SeqPrefix) { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); + goto after_match25; } - goto after_match25; } - if (_source69.is_SetIntersection) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1423_right); + { + if (_source69.is_SetMerge) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_Subset) { - { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); + { + if (_source69.is_SetSubtraction) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_ProperSubset) { - { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); + { + if (_source69.is_SetIntersection) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_SetDisjoint) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1423_right); + { + if (_source69.is_Subset) { + { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_MapMerge) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); + { + if (_source69.is_ProperSubset) { + { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_MapSubtraction) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); + { + if (_source69.is_SetDisjoint) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_MultisetMerge) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); + { + if (_source69.is_MapMerge) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_MultisetSubtraction) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); + { + if (_source69.is_MapSubtraction) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_MultisetIntersection) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1423_right); + { + if (_source69.is_MultisetMerge) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_Submultiset) { - { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); + { + if (_source69.is_MultisetSubtraction) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_ProperSubmultiset) { - { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); + { + if (_source69.is_MultisetIntersection) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1423_right); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_MultisetDisjoint) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1423_right); + { + if (_source69.is_Submultiset) { + { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1420_left, _1423_right, _1414_format); + } + goto after_match25; } - goto after_match25; } - if (_source69.is_Concat) { - { - r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("concat"))).Apply1(_1423_right); + { + if (_source69.is_ProperSubmultiset) { + { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1420_left, _1423_right, _1414_format); + } + goto after_match25; } - goto after_match25; } { - if ((DCOMP.COMP.OpTable).Contains(_1411_op)) { - r = RAST.Expr.create_BinaryOp(Dafny.Map>.Select(DCOMP.COMP.OpTable,_1411_op), _1420_left, _1423_right, _1414_format); - } else { - DAST._IBinOp _source70 = _1411_op; - if (_source70.is_Eq) { - bool _1426_referential = _source70.dtor_referential; - bool _1427_nullable = _source70.dtor_nullable; + if (_source69.is_MultisetDisjoint) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1423_right); + } + goto after_match25; + } + } + { + if (_source69.is_Concat) { + { + r = ((_1420_left).Sel(Dafny.Sequence.UnicodeFromString("concat"))).Apply1(_1423_right); + } + goto after_match25; + } + } + { + { + if ((DCOMP.COMP.OpTable).Contains(_1411_op)) { + r = RAST.Expr.create_BinaryOp(Dafny.Map>.Select(DCOMP.COMP.OpTable,_1411_op), _1420_left, _1423_right, _1414_format); + } else { + DAST._IBinOp _source70 = _1411_op; { - if (_1426_referential) { - if (_1427_nullable) { - r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::nullable_referential_equality"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); - } else { - r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::ptr_eq"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + if (_source70.is_Eq) { + bool _1426_referential = _source70.dtor_referential; + bool _1427_nullable = _source70.dtor_nullable; + { + if (_1426_referential) { + if (_1427_nullable) { + r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::nullable_referential_equality"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + } else { + r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::ptr_eq"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + } + } else { + r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("=="), _1420_left, _1423_right, DAST.Format.BinaryOpFormat.create_NoFormat()); + } } - } else { - r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("=="), _1420_left, _1423_right, DAST.Format.BinaryOpFormat.create_NoFormat()); + goto after_match26; + } + } + { + if (_source70.is_EuclidianDiv) { + { + r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_division"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + } + goto after_match26; } } - goto after_match26; - } - if (_source70.is_EuclidianDiv) { { - r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_division"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + if (_source70.is_EuclidianMod) { + { + r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_modulo"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + } + goto after_match26; + } } - goto after_match26; - } - if (_source70.is_EuclidianMod) { { - r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_modulo"))).Apply(Dafny.Sequence.FromElements(_1420_left, _1423_right)); + Dafny.ISequence _1428_op = _source70.dtor_Passthrough_a0; + { + r = RAST.Expr.create_BinaryOp(_1428_op, _1420_left, _1423_right, _1414_format); + } } - goto after_match26; - } - Dafny.ISequence _1428_op = _source70.dtor_Passthrough_a0; - { - r = RAST.Expr.create_BinaryOp(_1428_op, _1420_left, _1423_right, _1414_format); + after_match26: ; } - after_match26: ; } } after_match25: ; @@ -2847,30 +3111,34 @@ public void GenExprConvertToNewtype(DAST._IExpression e, Std.Wrappers._IOption _source71 = _1450_nativeToType; - if (_source71.is_Some) { - RAST._IType _1454_v = _source71.dtor_value; - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("truncate!"))).Apply(Dafny.Sequence.FromElements(_1451_recursiveGen, RAST.Expr.create_ExprFromType(_1454_v))); - RAST._IExpr _out208; - DCOMP._IOwnership _out209; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out208, out _out209); - r = _out208; - resultingOwnership = _out209; - goto after_match27; - } - if (_1448_erase) { - r = _1451_recursiveGen; - } else { - RAST._IType _1455_rhsType; - RAST._IType _out210; - _out210 = (this).GenType(_1443_toTpe, true, false); - _1455_rhsType = _out210; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_1455_rhsType)._ToString(DCOMP.__default.IND), Dafny.Sequence.UnicodeFromString("(")), (_1451_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); - } - RAST._IExpr _out211; - DCOMP._IOwnership _out212; - DCOMP.COMP.FromOwnership(r, _1452_recOwned, expectedOwnership, out _out211, out _out212); - r = _out211; - resultingOwnership = _out212; + { + if (_source71.is_Some) { + RAST._IType _1454_v = _source71.dtor_value; + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("truncate!"))).Apply(Dafny.Sequence.FromElements(_1451_recursiveGen, RAST.Expr.create_ExprFromType(_1454_v))); + RAST._IExpr _out208; + DCOMP._IOwnership _out209; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out208, out _out209); + r = _out208; + resultingOwnership = _out209; + goto after_match27; + } + } + { + if (_1448_erase) { + r = _1451_recursiveGen; + } else { + RAST._IType _1455_rhsType; + RAST._IType _out210; + _out210 = (this).GenType(_1443_toTpe, true, false); + _1455_rhsType = _out210; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_1455_rhsType)._ToString(DCOMP.__default.IND), Dafny.Sequence.UnicodeFromString("(")), (_1451_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); + } + RAST._IExpr _out211; + DCOMP._IOwnership _out212; + DCOMP.COMP.FromOwnership(r, _1452_recOwned, expectedOwnership, out _out211, out _out212); + r = _out211; + resultingOwnership = _out212; + } after_match27: ; } else { RAST._IExpr _out213; @@ -2914,30 +3182,34 @@ public void GenExprConvertFromNewtype(DAST._IExpression e, Std.Wrappers._IOption _1468_recIdents = _out218; readIdents = _1468_recIdents; Std.Wrappers._IOption _source72 = _1465_nativeFromType; - if (_source72.is_Some) { - RAST._IType _1469_v = _source72.dtor_value; - RAST._IType _1470_toTpeRust; - RAST._IType _out219; - _out219 = (this).GenType(_1458_toTpe, false, false); - _1470_toTpeRust = _out219; - r = (((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("Into"))).ApplyType(Dafny.Sequence.FromElements(_1470_toTpeRust))).MSel(Dafny.Sequence.UnicodeFromString("into"))).Apply(Dafny.Sequence.FromElements(_1466_recursiveGen)); - RAST._IExpr _out220; - DCOMP._IOwnership _out221; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out220, out _out221); - r = _out220; - resultingOwnership = _out221; - goto after_match28; - } - if (_1463_erase) { - r = _1466_recursiveGen; - } else { - r = (_1466_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("0")); + { + if (_source72.is_Some) { + RAST._IType _1469_v = _source72.dtor_value; + RAST._IType _1470_toTpeRust; + RAST._IType _out219; + _out219 = (this).GenType(_1458_toTpe, false, false); + _1470_toTpeRust = _out219; + r = (((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("Into"))).ApplyType(Dafny.Sequence.FromElements(_1470_toTpeRust))).MSel(Dafny.Sequence.UnicodeFromString("into"))).Apply(Dafny.Sequence.FromElements(_1466_recursiveGen)); + RAST._IExpr _out220; + DCOMP._IOwnership _out221; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out220, out _out221); + r = _out220; + resultingOwnership = _out221; + goto after_match28; + } + } + { + if (_1463_erase) { + r = _1466_recursiveGen; + } else { + r = (_1466_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("0")); + } + RAST._IExpr _out222; + DCOMP._IOwnership _out223; + DCOMP.COMP.FromOwnership(r, _1467_recOwned, expectedOwnership, out _out222, out _out223); + r = _out222; + resultingOwnership = _out223; } - RAST._IExpr _out222; - DCOMP._IOwnership _out223; - DCOMP.COMP.FromOwnership(r, _1467_recOwned, expectedOwnership, out _out222, out _out223); - r = _out222; - resultingOwnership = _out223; after_match28: ; } else { if ((_1465_nativeFromType).is_Some) { @@ -3037,312 +3309,336 @@ public void GenExprConvert(DAST._IExpression e, Std.Wrappers._IOption _source73 = _System.Tuple2.create(_1484_fromTpe, _1485_toTpe); - DAST._IType _01 = _source73.dtor__0; - if (_01.is_Nullable) { - { - RAST._IExpr _out244; - DCOMP._IOwnership _out245; - Dafny.ISet> _out246; - (this).GenExprConvertFromNullable(e, selfIdent, env, expectedOwnership, out _out244, out _out245, out _out246); - r = _out244; - resultingOwnership = _out245; - readIdents = _out246; - } - goto after_match29; - } - DAST._IType _11 = _source73.dtor__1; - if (_11.is_Nullable) { - { - RAST._IExpr _out247; - DCOMP._IOwnership _out248; - Dafny.ISet> _out249; - (this).GenExprConvertToNullable(e, selfIdent, env, expectedOwnership, out _out247, out _out248, out _out249); - r = _out247; - resultingOwnership = _out248; - readIdents = _out249; - } - goto after_match29; - } - DAST._IType _12 = _source73.dtor__1; - if (_12.is_Path) { - DAST._IResolvedType resolved1 = _12.dtor_resolved; - if (resolved1.is_Newtype) { - DAST._IType _1489_b = resolved1.dtor_baseType; - DAST._INewtypeRange _1490_range = resolved1.dtor_range; - bool _1491_erase = resolved1.dtor_erase; - Dafny.ISequence _1492_attributes = resolved1.dtor_attributes; + { + DAST._IType _01 = _source73.dtor__0; + if (_01.is_Nullable) { { - RAST._IExpr _out250; - DCOMP._IOwnership _out251; - Dafny.ISet> _out252; - (this).GenExprConvertToNewtype(e, selfIdent, env, expectedOwnership, out _out250, out _out251, out _out252); - r = _out250; - resultingOwnership = _out251; - readIdents = _out252; + RAST._IExpr _out244; + DCOMP._IOwnership _out245; + Dafny.ISet> _out246; + (this).GenExprConvertFromNullable(e, selfIdent, env, expectedOwnership, out _out244, out _out245, out _out246); + r = _out244; + resultingOwnership = _out245; + readIdents = _out246; } goto after_match29; } } - DAST._IType _02 = _source73.dtor__0; - if (_02.is_Path) { - DAST._IResolvedType resolved2 = _02.dtor_resolved; - if (resolved2.is_Newtype) { - DAST._IType _1493_b = resolved2.dtor_baseType; - DAST._INewtypeRange _1494_range = resolved2.dtor_range; - bool _1495_erase = resolved2.dtor_erase; - Dafny.ISequence _1496_attributes = resolved2.dtor_attributes; + { + DAST._IType _11 = _source73.dtor__1; + if (_11.is_Nullable) { { - RAST._IExpr _out253; - DCOMP._IOwnership _out254; - Dafny.ISet> _out255; - (this).GenExprConvertFromNewtype(e, selfIdent, env, expectedOwnership, out _out253, out _out254, out _out255); - r = _out253; - resultingOwnership = _out254; - readIdents = _out255; + RAST._IExpr _out247; + DCOMP._IOwnership _out248; + Dafny.ISet> _out249; + (this).GenExprConvertToNullable(e, selfIdent, env, expectedOwnership, out _out247, out _out248, out _out249); + r = _out247; + resultingOwnership = _out248; + readIdents = _out249; } goto after_match29; } } - DAST._IType _03 = _source73.dtor__0; - if (_03.is_Primitive) { - DAST._IPrimitive _h82 = _03.dtor_Primitive_a0; - if (_h82.is_Int) { - DAST._IType _13 = _source73.dtor__1; - if (_13.is_Primitive) { - DAST._IPrimitive _h83 = _13.dtor_Primitive_a0; - if (_h83.is_Real) { - { - RAST._IExpr _1497_recursiveGen; - DCOMP._IOwnership _1498___v94; - Dafny.ISet> _1499_recIdents; - RAST._IExpr _out256; - DCOMP._IOwnership _out257; - Dafny.ISet> _out258; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out256, out _out257, out _out258); - _1497_recursiveGen = _out256; - _1498___v94 = _out257; - _1499_recIdents = _out258; - r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::from_integer("), (_1497_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")))); - RAST._IExpr _out259; - DCOMP._IOwnership _out260; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out259, out _out260); - r = _out259; - resultingOwnership = _out260; - readIdents = _1499_recIdents; - } - goto after_match29; + { + DAST._IType _12 = _source73.dtor__1; + if (_12.is_Path) { + DAST._IResolvedType resolved1 = _12.dtor_resolved; + if (resolved1.is_Newtype) { + DAST._IType _1489_b = resolved1.dtor_baseType; + DAST._INewtypeRange _1490_range = resolved1.dtor_range; + bool _1491_erase = resolved1.dtor_erase; + Dafny.ISequence _1492_attributes = resolved1.dtor_attributes; + { + RAST._IExpr _out250; + DCOMP._IOwnership _out251; + Dafny.ISet> _out252; + (this).GenExprConvertToNewtype(e, selfIdent, env, expectedOwnership, out _out250, out _out251, out _out252); + r = _out250; + resultingOwnership = _out251; + readIdents = _out252; } + goto after_match29; } } } - DAST._IType _04 = _source73.dtor__0; - if (_04.is_Primitive) { - DAST._IPrimitive _h84 = _04.dtor_Primitive_a0; - if (_h84.is_Real) { - DAST._IType _14 = _source73.dtor__1; - if (_14.is_Primitive) { - DAST._IPrimitive _h85 = _14.dtor_Primitive_a0; - if (_h85.is_Int) { - { - RAST._IExpr _1500_recursiveGen; - DCOMP._IOwnership _1501___v95; - Dafny.ISet> _1502_recIdents; - RAST._IExpr _out261; - DCOMP._IOwnership _out262; - Dafny.ISet> _out263; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out261, out _out262, out _out263); - _1500_recursiveGen = _out261; - _1501___v95 = _out262; - _1502_recIdents = _out263; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::dafny_rational_to_int("), (_1500_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); - RAST._IExpr _out264; - DCOMP._IOwnership _out265; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out264, out _out265); - r = _out264; - resultingOwnership = _out265; - readIdents = _1502_recIdents; - } - goto after_match29; + { + DAST._IType _02 = _source73.dtor__0; + if (_02.is_Path) { + DAST._IResolvedType resolved2 = _02.dtor_resolved; + if (resolved2.is_Newtype) { + DAST._IType _1493_b = resolved2.dtor_baseType; + DAST._INewtypeRange _1494_range = resolved2.dtor_range; + bool _1495_erase = resolved2.dtor_erase; + Dafny.ISequence _1496_attributes = resolved2.dtor_attributes; + { + RAST._IExpr _out253; + DCOMP._IOwnership _out254; + Dafny.ISet> _out255; + (this).GenExprConvertFromNewtype(e, selfIdent, env, expectedOwnership, out _out253, out _out254, out _out255); + r = _out253; + resultingOwnership = _out254; + readIdents = _out255; } + goto after_match29; } } } - DAST._IType _05 = _source73.dtor__0; - if (_05.is_Primitive) { - DAST._IPrimitive _h86 = _05.dtor_Primitive_a0; - if (_h86.is_Int) { - DAST._IType _15 = _source73.dtor__1; - if (_15.is_Passthrough) { - { - RAST._IType _1503_rhsType; - RAST._IType _out266; - _out266 = (this).GenType(_1485_toTpe, true, false); - _1503_rhsType = _out266; - RAST._IExpr _1504_recursiveGen; - DCOMP._IOwnership _1505___v97; - Dafny.ISet> _1506_recIdents; - RAST._IExpr _out267; - DCOMP._IOwnership _out268; - Dafny.ISet> _out269; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out267, out _out268, out _out269); - _1504_recursiveGen = _out267; - _1505___v97 = _out268; - _1506_recIdents = _out269; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1503_rhsType)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as ::dafny_runtime::NumCast>::from(")), (_1504_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()"))); - RAST._IExpr _out270; - DCOMP._IOwnership _out271; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out270, out _out271); - r = _out270; - resultingOwnership = _out271; - readIdents = _1506_recIdents; + { + DAST._IType _03 = _source73.dtor__0; + if (_03.is_Primitive) { + DAST._IPrimitive _h82 = _03.dtor_Primitive_a0; + if (_h82.is_Int) { + DAST._IType _13 = _source73.dtor__1; + if (_13.is_Primitive) { + DAST._IPrimitive _h83 = _13.dtor_Primitive_a0; + if (_h83.is_Real) { + { + RAST._IExpr _1497_recursiveGen; + DCOMP._IOwnership _1498___v94; + Dafny.ISet> _1499_recIdents; + RAST._IExpr _out256; + DCOMP._IOwnership _out257; + Dafny.ISet> _out258; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out256, out _out257, out _out258); + _1497_recursiveGen = _out256; + _1498___v94 = _out257; + _1499_recIdents = _out258; + r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::from_integer("), (_1497_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")))); + RAST._IExpr _out259; + DCOMP._IOwnership _out260; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out259, out _out260); + r = _out259; + resultingOwnership = _out260; + readIdents = _1499_recIdents; + } + goto after_match29; + } } - goto after_match29; } } } - DAST._IType _06 = _source73.dtor__0; - if (_06.is_Passthrough) { - DAST._IType _16 = _source73.dtor__1; - if (_16.is_Primitive) { - DAST._IPrimitive _h87 = _16.dtor_Primitive_a0; - if (_h87.is_Int) { - { - RAST._IType _1507_rhsType; - RAST._IType _out272; - _out272 = (this).GenType(_1484_fromTpe, true, false); - _1507_rhsType = _out272; - RAST._IExpr _1508_recursiveGen; - DCOMP._IOwnership _1509___v99; - Dafny.ISet> _1510_recIdents; - RAST._IExpr _out273; - DCOMP._IOwnership _out274; - Dafny.ISet> _out275; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out273, out _out274, out _out275); - _1508_recursiveGen = _out273; - _1509___v99 = _out274; - _1510_recIdents = _out275; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::DafnyInt{data: ::dafny_runtime::BigInt::from("), (_1508_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")}"))); - RAST._IExpr _out276; - DCOMP._IOwnership _out277; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out276, out _out277); - r = _out276; - resultingOwnership = _out277; - readIdents = _1510_recIdents; + { + DAST._IType _04 = _source73.dtor__0; + if (_04.is_Primitive) { + DAST._IPrimitive _h84 = _04.dtor_Primitive_a0; + if (_h84.is_Real) { + DAST._IType _14 = _source73.dtor__1; + if (_14.is_Primitive) { + DAST._IPrimitive _h85 = _14.dtor_Primitive_a0; + if (_h85.is_Int) { + { + RAST._IExpr _1500_recursiveGen; + DCOMP._IOwnership _1501___v95; + Dafny.ISet> _1502_recIdents; + RAST._IExpr _out261; + DCOMP._IOwnership _out262; + Dafny.ISet> _out263; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out261, out _out262, out _out263); + _1500_recursiveGen = _out261; + _1501___v95 = _out262; + _1502_recIdents = _out263; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::dafny_rational_to_int("), (_1500_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); + RAST._IExpr _out264; + DCOMP._IOwnership _out265; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out264, out _out265); + r = _out264; + resultingOwnership = _out265; + readIdents = _1502_recIdents; + } + goto after_match29; + } } - goto after_match29; } } } - DAST._IType _07 = _source73.dtor__0; - if (_07.is_Primitive) { - DAST._IPrimitive _h88 = _07.dtor_Primitive_a0; - if (_h88.is_Int) { - DAST._IType _17 = _source73.dtor__1; - if (_17.is_Primitive) { - DAST._IPrimitive _h89 = _17.dtor_Primitive_a0; - if (_h89.is_Char) { + { + DAST._IType _05 = _source73.dtor__0; + if (_05.is_Primitive) { + DAST._IPrimitive _h86 = _05.dtor_Primitive_a0; + if (_h86.is_Int) { + DAST._IType _15 = _source73.dtor__1; + if (_15.is_Passthrough) { { - RAST._IType _1511_rhsType; - RAST._IType _out278; - _out278 = (this).GenType(_1485_toTpe, true, false); - _1511_rhsType = _out278; - RAST._IExpr _1512_recursiveGen; - DCOMP._IOwnership _1513___v100; - Dafny.ISet> _1514_recIdents; - RAST._IExpr _out279; - DCOMP._IOwnership _out280; - Dafny.ISet> _out281; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out279, out _out280, out _out281); - _1512_recursiveGen = _out279; - _1513___v100 = _out280; - _1514_recIdents = _out281; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("char::from_u32(::from("), (_1512_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()).unwrap()"))); - RAST._IExpr _out282; - DCOMP._IOwnership _out283; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out282, out _out283); - r = _out282; - resultingOwnership = _out283; - readIdents = _1514_recIdents; + RAST._IType _1503_rhsType; + RAST._IType _out266; + _out266 = (this).GenType(_1485_toTpe, true, false); + _1503_rhsType = _out266; + RAST._IExpr _1504_recursiveGen; + DCOMP._IOwnership _1505___v97; + Dafny.ISet> _1506_recIdents; + RAST._IExpr _out267; + DCOMP._IOwnership _out268; + Dafny.ISet> _out269; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out267, out _out268, out _out269); + _1504_recursiveGen = _out267; + _1505___v97 = _out268; + _1506_recIdents = _out269; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1503_rhsType)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as ::dafny_runtime::NumCast>::from(")), (_1504_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()"))); + RAST._IExpr _out270; + DCOMP._IOwnership _out271; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out270, out _out271); + r = _out270; + resultingOwnership = _out271; + readIdents = _1506_recIdents; } goto after_match29; } } } } - DAST._IType _08 = _source73.dtor__0; - if (_08.is_Primitive) { - DAST._IPrimitive _h810 = _08.dtor_Primitive_a0; - if (_h810.is_Char) { - DAST._IType _18 = _source73.dtor__1; - if (_18.is_Primitive) { - DAST._IPrimitive _h811 = _18.dtor_Primitive_a0; - if (_h811.is_Int) { + { + DAST._IType _06 = _source73.dtor__0; + if (_06.is_Passthrough) { + DAST._IType _16 = _source73.dtor__1; + if (_16.is_Primitive) { + DAST._IPrimitive _h87 = _16.dtor_Primitive_a0; + if (_h87.is_Int) { { - RAST._IType _1515_rhsType; - RAST._IType _out284; - _out284 = (this).GenType(_1484_fromTpe, true, false); - _1515_rhsType = _out284; - RAST._IExpr _1516_recursiveGen; - DCOMP._IOwnership _1517___v101; - Dafny.ISet> _1518_recIdents; - RAST._IExpr _out285; - DCOMP._IOwnership _out286; - Dafny.ISet> _out287; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out285, out _out286, out _out287); - _1516_recursiveGen = _out285; - _1517___v101 = _out286; - _1518_recIdents = _out287; - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1((_1516_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("0"))); - RAST._IExpr _out288; - DCOMP._IOwnership _out289; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out288, out _out289); - r = _out288; - resultingOwnership = _out289; - readIdents = _1518_recIdents; + RAST._IType _1507_rhsType; + RAST._IType _out272; + _out272 = (this).GenType(_1484_fromTpe, true, false); + _1507_rhsType = _out272; + RAST._IExpr _1508_recursiveGen; + DCOMP._IOwnership _1509___v99; + Dafny.ISet> _1510_recIdents; + RAST._IExpr _out273; + DCOMP._IOwnership _out274; + Dafny.ISet> _out275; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out273, out _out274, out _out275); + _1508_recursiveGen = _out273; + _1509___v99 = _out274; + _1510_recIdents = _out275; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::DafnyInt{data: ::dafny_runtime::BigInt::from("), (_1508_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")}"))); + RAST._IExpr _out276; + DCOMP._IOwnership _out277; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out276, out _out277); + r = _out276; + resultingOwnership = _out277; + readIdents = _1510_recIdents; } goto after_match29; } } } } - DAST._IType _09 = _source73.dtor__0; - if (_09.is_Passthrough) { - DAST._IType _19 = _source73.dtor__1; - if (_19.is_Passthrough) { - { - RAST._IExpr _1519_recursiveGen; - DCOMP._IOwnership _1520___v104; - Dafny.ISet> _1521_recIdents; - RAST._IExpr _out290; - DCOMP._IOwnership _out291; - Dafny.ISet> _out292; - (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out290, out _out291, out _out292); - _1519_recursiveGen = _out290; - _1520___v104 = _out291; - _1521_recIdents = _out292; - RAST._IType _1522_toTpeGen; - RAST._IType _out293; - _out293 = (this).GenType(_1485_toTpe, true, false); - _1522_toTpeGen = _out293; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("(("), (_1519_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(") as ")), (_1522_toTpeGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); - RAST._IExpr _out294; - DCOMP._IOwnership _out295; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out294, out _out295); - r = _out294; - resultingOwnership = _out295; - readIdents = _1521_recIdents; + { + DAST._IType _07 = _source73.dtor__0; + if (_07.is_Primitive) { + DAST._IPrimitive _h88 = _07.dtor_Primitive_a0; + if (_h88.is_Int) { + DAST._IType _17 = _source73.dtor__1; + if (_17.is_Primitive) { + DAST._IPrimitive _h89 = _17.dtor_Primitive_a0; + if (_h89.is_Char) { + { + RAST._IType _1511_rhsType; + RAST._IType _out278; + _out278 = (this).GenType(_1485_toTpe, true, false); + _1511_rhsType = _out278; + RAST._IExpr _1512_recursiveGen; + DCOMP._IOwnership _1513___v100; + Dafny.ISet> _1514_recIdents; + RAST._IExpr _out279; + DCOMP._IOwnership _out280; + Dafny.ISet> _out281; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out279, out _out280, out _out281); + _1512_recursiveGen = _out279; + _1513___v100 = _out280; + _1514_recIdents = _out281; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("char::from_u32(::from("), (_1512_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()).unwrap()"))); + RAST._IExpr _out282; + DCOMP._IOwnership _out283; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out282, out _out283); + r = _out282; + resultingOwnership = _out283; + readIdents = _1514_recIdents; + } + goto after_match29; + } + } + } + } + } + { + DAST._IType _08 = _source73.dtor__0; + if (_08.is_Primitive) { + DAST._IPrimitive _h810 = _08.dtor_Primitive_a0; + if (_h810.is_Char) { + DAST._IType _18 = _source73.dtor__1; + if (_18.is_Primitive) { + DAST._IPrimitive _h811 = _18.dtor_Primitive_a0; + if (_h811.is_Int) { + { + RAST._IType _1515_rhsType; + RAST._IType _out284; + _out284 = (this).GenType(_1484_fromTpe, true, false); + _1515_rhsType = _out284; + RAST._IExpr _1516_recursiveGen; + DCOMP._IOwnership _1517___v101; + Dafny.ISet> _1518_recIdents; + RAST._IExpr _out285; + DCOMP._IOwnership _out286; + Dafny.ISet> _out287; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out285, out _out286, out _out287); + _1516_recursiveGen = _out285; + _1517___v101 = _out286; + _1518_recIdents = _out287; + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1((_1516_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("0"))); + RAST._IExpr _out288; + DCOMP._IOwnership _out289; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out288, out _out289); + r = _out288; + resultingOwnership = _out289; + readIdents = _1518_recIdents; + } + goto after_match29; + } + } + } + } + } + { + DAST._IType _09 = _source73.dtor__0; + if (_09.is_Passthrough) { + DAST._IType _19 = _source73.dtor__1; + if (_19.is_Passthrough) { + { + RAST._IExpr _1519_recursiveGen; + DCOMP._IOwnership _1520___v104; + Dafny.ISet> _1521_recIdents; + RAST._IExpr _out290; + DCOMP._IOwnership _out291; + Dafny.ISet> _out292; + (this).GenExpr(_1483_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out290, out _out291, out _out292); + _1519_recursiveGen = _out290; + _1520___v104 = _out291; + _1521_recIdents = _out292; + RAST._IType _1522_toTpeGen; + RAST._IType _out293; + _out293 = (this).GenType(_1485_toTpe, true, false); + _1522_toTpeGen = _out293; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("(("), (_1519_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(") as ")), (_1522_toTpeGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")"))); + RAST._IExpr _out294; + DCOMP._IOwnership _out295; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out294, out _out295); + r = _out294; + resultingOwnership = _out295; + readIdents = _1521_recIdents; + } + goto after_match29; } - goto after_match29; } } { - RAST._IExpr _out296; - DCOMP._IOwnership _out297; - Dafny.ISet> _out298; - (this).GenExprConvertNotImplemented(e, selfIdent, env, expectedOwnership, out _out296, out _out297, out _out298); - r = _out296; - resultingOwnership = _out297; - readIdents = _out298; + { + RAST._IExpr _out296; + DCOMP._IOwnership _out297; + Dafny.ISet> _out298; + (this).GenExprConvertNotImplemented(e, selfIdent, env, expectedOwnership, out _out296, out _out297, out _out298); + r = _out296; + resultingOwnership = _out297; + readIdents = _out298; + } } after_match29: ; } @@ -3391,1729 +3687,1843 @@ public void GenExpr(DAST._IExpression e, Std.Wrappers._IOption>.Empty; DAST._IExpression _source74 = e; - if (_source74.is_Literal) { - RAST._IExpr _out299; - DCOMP._IOwnership _out300; - Dafny.ISet> _out301; - (this).GenExprLiteral(e, selfIdent, env, expectedOwnership, out _out299, out _out300, out _out301); - r = _out299; - resultingOwnership = _out300; - readIdents = _out301; - goto after_match30; - } - if (_source74.is_Ident) { - Dafny.ISequence _1526_name = _source74.dtor_Ident_a0; - { - RAST._IExpr _out302; - DCOMP._IOwnership _out303; - Dafny.ISet> _out304; - (this).GenIdent(DCOMP.__default.escapeName(_1526_name), selfIdent, env, expectedOwnership, out _out302, out _out303, out _out304); - r = _out302; - resultingOwnership = _out303; - readIdents = _out304; - } - goto after_match30; - } - if (_source74.is_Companion) { - Dafny.ISequence> _1527_path = _source74.dtor_Companion_a0; - { - RAST._IExpr _out305; - _out305 = DCOMP.COMP.GenPathExpr(_1527_path); - r = _out305; - if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowed())) { - resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); - } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwned())) { - resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); - } else { - RAST._IExpr _out306; - DCOMP._IOwnership _out307; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out306, out _out307); - r = _out306; - resultingOwnership = _out307; - } - readIdents = Dafny.Set>.FromElements(); - return ; - } - goto after_match30; - } - if (_source74.is_InitializationValue) { - DAST._IType _1528_typ = _source74.dtor_typ; - { - RAST._IType _1529_typExpr; - RAST._IType _out308; - _out308 = (this).GenType(_1528_typ, false, false); - _1529_typExpr = _out308; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1529_typExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as std::default::Default>::default()"))); - RAST._IExpr _out309; - DCOMP._IOwnership _out310; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out309, out _out310); - r = _out309; - resultingOwnership = _out310; - readIdents = Dafny.Set>.FromElements(); - return ; + { + if (_source74.is_Literal) { + RAST._IExpr _out299; + DCOMP._IOwnership _out300; + Dafny.ISet> _out301; + (this).GenExprLiteral(e, selfIdent, env, expectedOwnership, out _out299, out _out300, out _out301); + r = _out299; + resultingOwnership = _out300; + readIdents = _out301; + goto after_match30; } - goto after_match30; } - if (_source74.is_Tuple) { - Dafny.ISequence _1530_values = _source74.dtor_Tuple_a0; - { - Dafny.ISequence _1531_exprs; - _1531_exprs = Dafny.Sequence.FromElements(); - readIdents = Dafny.Set>.FromElements(); - BigInteger _hi30 = new BigInteger((_1530_values).Count); - for (BigInteger _1532_i = BigInteger.Zero; _1532_i < _hi30; _1532_i++) { - RAST._IExpr _1533_recursiveGen; - DCOMP._IOwnership _1534___v107; - Dafny.ISet> _1535_recIdents; - RAST._IExpr _out311; - DCOMP._IOwnership _out312; - Dafny.ISet> _out313; - (this).GenExpr((_1530_values).Select(_1532_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out311, out _out312, out _out313); - _1533_recursiveGen = _out311; - _1534___v107 = _out312; - _1535_recIdents = _out313; - _1531_exprs = Dafny.Sequence.Concat(_1531_exprs, Dafny.Sequence.FromElements(_1533_recursiveGen)); - readIdents = Dafny.Set>.Union(readIdents, _1535_recIdents); - } - if ((new BigInteger((_1530_values).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) { - r = RAST.Expr.create_Tuple(_1531_exprs); - } else { - r = RAST.__default.SystemTuple(_1531_exprs); + { + if (_source74.is_Ident) { + Dafny.ISequence _1526_name = _source74.dtor_Ident_a0; + { + RAST._IExpr _out302; + DCOMP._IOwnership _out303; + Dafny.ISet> _out304; + (this).GenIdent(DCOMP.__default.escapeName(_1526_name), selfIdent, env, expectedOwnership, out _out302, out _out303, out _out304); + r = _out302; + resultingOwnership = _out303; + readIdents = _out304; } - RAST._IExpr _out314; - DCOMP._IOwnership _out315; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out314, out _out315); - r = _out314; - resultingOwnership = _out315; - return ; + goto after_match30; } - goto after_match30; } - if (_source74.is_New) { - Dafny.ISequence> _1536_path = _source74.dtor_path; - Dafny.ISequence _1537_typeArgs = _source74.dtor_typeArgs; - Dafny.ISequence _1538_args = _source74.dtor_args; - { - RAST._IExpr _out316; - _out316 = DCOMP.COMP.GenPathExpr(_1536_path); - r = _out316; - if ((new BigInteger((_1537_typeArgs).Count)).Sign == 1) { - Dafny.ISequence _1539_typeExprs; - _1539_typeExprs = Dafny.Sequence.FromElements(); - BigInteger _hi31 = new BigInteger((_1537_typeArgs).Count); - for (BigInteger _1540_i = BigInteger.Zero; _1540_i < _hi31; _1540_i++) { - RAST._IType _1541_typeExpr; - RAST._IType _out317; - _out317 = (this).GenType((_1537_typeArgs).Select(_1540_i), false, false); - _1541_typeExpr = _out317; - _1539_typeExprs = Dafny.Sequence.Concat(_1539_typeExprs, Dafny.Sequence.FromElements(_1541_typeExpr)); + { + if (_source74.is_Companion) { + Dafny.ISequence> _1527_path = _source74.dtor_Companion_a0; + { + RAST._IExpr _out305; + _out305 = DCOMP.COMP.GenPathExpr(_1527_path); + r = _out305; + if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowed())) { + resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwned())) { + resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } else { + RAST._IExpr _out306; + DCOMP._IOwnership _out307; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out306, out _out307); + r = _out306; + resultingOwnership = _out307; } - r = (r).ApplyType(_1539_typeExprs); + readIdents = Dafny.Set>.FromElements(); + return ; } - r = (r).MSel(Dafny.Sequence.UnicodeFromString("new")); - readIdents = Dafny.Set>.FromElements(); - Dafny.ISequence _1542_arguments; - _1542_arguments = Dafny.Sequence.FromElements(); - BigInteger _hi32 = new BigInteger((_1538_args).Count); - for (BigInteger _1543_i = BigInteger.Zero; _1543_i < _hi32; _1543_i++) { - RAST._IExpr _1544_recursiveGen; - DCOMP._IOwnership _1545___v108; - Dafny.ISet> _1546_recIdents; - RAST._IExpr _out318; - DCOMP._IOwnership _out319; - Dafny.ISet> _out320; - (this).GenExpr((_1538_args).Select(_1543_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out318, out _out319, out _out320); - _1544_recursiveGen = _out318; - _1545___v108 = _out319; - _1546_recIdents = _out320; - _1542_arguments = Dafny.Sequence.Concat(_1542_arguments, Dafny.Sequence.FromElements(_1544_recursiveGen)); - readIdents = Dafny.Set>.Union(readIdents, _1546_recIdents); - } - r = (r).Apply(_1542_arguments); - RAST._IExpr _out321; - DCOMP._IOwnership _out322; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out321, out _out322); - r = _out321; - resultingOwnership = _out322; - return ; + goto after_match30; } - goto after_match30; } - if (_source74.is_NewArray) { - Dafny.ISequence _1547_dims = _source74.dtor_dims; - DAST._IType _1548_typ = _source74.dtor_typ; - { - BigInteger _1549_i; - _1549_i = (new BigInteger((_1547_dims).Count)) - (BigInteger.One); - RAST._IType _1550_genTyp; - RAST._IType _out323; - _out323 = (this).GenType(_1548_typ, false, false); - _1550_genTyp = _out323; - Dafny.ISequence _1551_s; - _1551_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1550_genTyp)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as ::std::default::Default>::default()")); - readIdents = Dafny.Set>.FromElements(); - while ((_1549_i).Sign != -1) { - RAST._IExpr _1552_recursiveGen; - DCOMP._IOwnership _1553___v109; - Dafny.ISet> _1554_recIdents; - RAST._IExpr _out324; - DCOMP._IOwnership _out325; - Dafny.ISet> _out326; - (this).GenExpr((_1547_dims).Select(_1549_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out324, out _out325, out _out326); - _1552_recursiveGen = _out324; - _1553___v109 = _out325; - _1554_recIdents = _out326; - _1551_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::new(::std::cell::RefCell::new(vec!["), _1551_s), Dafny.Sequence.UnicodeFromString("; ::from(")), (_1552_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()]))")); - readIdents = Dafny.Set>.Union(readIdents, _1554_recIdents); - _1549_i = (_1549_i) - (BigInteger.One); - } - r = RAST.Expr.create_RawExpr(_1551_s); - RAST._IExpr _out327; - DCOMP._IOwnership _out328; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out327, out _out328); - r = _out327; - resultingOwnership = _out328; - return ; + { + if (_source74.is_InitializationValue) { + DAST._IType _1528_typ = _source74.dtor_typ; + { + RAST._IType _1529_typExpr; + RAST._IType _out308; + _out308 = (this).GenType(_1528_typ, false, false); + _1529_typExpr = _out308; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1529_typExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as std::default::Default>::default()"))); + RAST._IExpr _out309; + DCOMP._IOwnership _out310; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out309, out _out310); + r = _out309; + resultingOwnership = _out310; + readIdents = Dafny.Set>.FromElements(); + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_DatatypeValue) { - DAST._IDatatypeType _1555_datatypeType = _source74.dtor_datatypeType; - Dafny.ISequence _1556_typeArgs = _source74.dtor_typeArgs; - Dafny.ISequence _1557_variant = _source74.dtor_variant; - bool _1558_isCo = _source74.dtor_isCo; - Dafny.ISequence<_System._ITuple2, DAST._IExpression>> _1559_values = _source74.dtor_contents; - { - RAST._IExpr _out329; - _out329 = DCOMP.COMP.GenPathExpr((_1555_datatypeType).dtor_path); - r = _out329; - Dafny.ISequence _1560_genTypeArgs; - _1560_genTypeArgs = Dafny.Sequence.FromElements(); - BigInteger _hi33 = new BigInteger((_1556_typeArgs).Count); - for (BigInteger _1561_i = BigInteger.Zero; _1561_i < _hi33; _1561_i++) { - RAST._IType _1562_typeExpr; - RAST._IType _out330; - _out330 = (this).GenType((_1556_typeArgs).Select(_1561_i), false, false); - _1562_typeExpr = _out330; - _1560_genTypeArgs = Dafny.Sequence.Concat(_1560_genTypeArgs, Dafny.Sequence.FromElements(_1562_typeExpr)); - } - if ((new BigInteger((_1556_typeArgs).Count)).Sign == 1) { - r = (r).ApplyType(_1560_genTypeArgs); - } - r = (r).MSel(DCOMP.__default.escapeName(_1557_variant)); - readIdents = Dafny.Set>.FromElements(); - Dafny.ISequence _1563_assignments; - _1563_assignments = Dafny.Sequence.FromElements(); - BigInteger _hi34 = new BigInteger((_1559_values).Count); - for (BigInteger _1564_i = BigInteger.Zero; _1564_i < _hi34; _1564_i++) { - _System._ITuple2, DAST._IExpression> _let_tmp_rhs63 = (_1559_values).Select(_1564_i); - Dafny.ISequence _1565_name = _let_tmp_rhs63.dtor__0; - DAST._IExpression _1566_value = _let_tmp_rhs63.dtor__1; - if (_1558_isCo) { - RAST._IExpr _1567_recursiveGen; - DCOMP._IOwnership _1568___v110; - Dafny.ISet> _1569_recIdents; - RAST._IExpr _out331; - DCOMP._IOwnership _out332; - Dafny.ISet> _out333; - (this).GenExpr(_1566_value, selfIdent, DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out331, out _out332, out _out333); - _1567_recursiveGen = _out331; - _1568___v110 = _out332; - _1569_recIdents = _out333; - readIdents = Dafny.Set>.Union(readIdents, _1569_recIdents); - Dafny.ISequence _1570_allReadCloned; - _1570_allReadCloned = Dafny.Sequence.UnicodeFromString(""); - while (!(_1569_recIdents).Equals(Dafny.Set>.FromElements())) { - Dafny.ISequence _1571_next; - foreach (Dafny.ISequence _assign_such_that_2 in (_1569_recIdents).Elements) { - _1571_next = (Dafny.ISequence)_assign_such_that_2; - if ((_1569_recIdents).Contains(_1571_next)) { - goto after__ASSIGN_SUCH_THAT_2; - } - } - throw new System.Exception("assign-such-that search produced no value (line 3271)"); - after__ASSIGN_SUCH_THAT_2: ; - _1570_allReadCloned = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1570_allReadCloned, Dafny.Sequence.UnicodeFromString("let ")), _1571_next), Dafny.Sequence.UnicodeFromString(" = ")), _1571_next), Dafny.Sequence.UnicodeFromString(".clone();\n")); - _1569_recIdents = Dafny.Set>.Difference(_1569_recIdents, Dafny.Set>.FromElements(_1571_next)); - } - Dafny.ISequence _1572_wasAssigned; - _1572_wasAssigned = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::LazyFieldWrapper(::dafny_runtime::Lazy::new(::std::boxed::Box::new({\n"), _1570_allReadCloned), Dafny.Sequence.UnicodeFromString("move || (")), (_1567_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")})))")); - _1563_assignments = Dafny.Sequence.Concat(_1563_assignments, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1565_name, RAST.Expr.create_RawExpr(_1572_wasAssigned)))); + { + if (_source74.is_Tuple) { + Dafny.ISequence _1530_values = _source74.dtor_Tuple_a0; + { + Dafny.ISequence _1531_exprs; + _1531_exprs = Dafny.Sequence.FromElements(); + readIdents = Dafny.Set>.FromElements(); + BigInteger _hi30 = new BigInteger((_1530_values).Count); + for (BigInteger _1532_i = BigInteger.Zero; _1532_i < _hi30; _1532_i++) { + RAST._IExpr _1533_recursiveGen; + DCOMP._IOwnership _1534___v107; + Dafny.ISet> _1535_recIdents; + RAST._IExpr _out311; + DCOMP._IOwnership _out312; + Dafny.ISet> _out313; + (this).GenExpr((_1530_values).Select(_1532_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out311, out _out312, out _out313); + _1533_recursiveGen = _out311; + _1534___v107 = _out312; + _1535_recIdents = _out313; + _1531_exprs = Dafny.Sequence.Concat(_1531_exprs, Dafny.Sequence.FromElements(_1533_recursiveGen)); + readIdents = Dafny.Set>.Union(readIdents, _1535_recIdents); + } + if ((new BigInteger((_1530_values).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) { + r = RAST.Expr.create_Tuple(_1531_exprs); } else { - RAST._IExpr _1573_recursiveGen; - DCOMP._IOwnership _1574___v111; - Dafny.ISet> _1575_recIdents; - RAST._IExpr _out334; - DCOMP._IOwnership _out335; - Dafny.ISet> _out336; - (this).GenExpr(_1566_value, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out334, out _out335, out _out336); - _1573_recursiveGen = _out334; - _1574___v111 = _out335; - _1575_recIdents = _out336; - _1563_assignments = Dafny.Sequence.Concat(_1563_assignments, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1565_name, _1573_recursiveGen))); - readIdents = Dafny.Set>.Union(readIdents, _1575_recIdents); + r = RAST.__default.SystemTuple(_1531_exprs); } + RAST._IExpr _out314; + DCOMP._IOwnership _out315; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out314, out _out315); + r = _out314; + resultingOwnership = _out315; + return ; } - r = RAST.Expr.create_StructBuild(r, _1563_assignments); - if ((this).IsRcWrapped((_1555_datatypeType).dtor_attributes)) { - r = RAST.__default.RcNew(r); - } - RAST._IExpr _out337; - DCOMP._IOwnership _out338; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out337, out _out338); - r = _out337; - resultingOwnership = _out338; - return ; + goto after_match30; } - goto after_match30; } - if (_source74.is_Convert) { - { - RAST._IExpr _out339; - DCOMP._IOwnership _out340; - Dafny.ISet> _out341; - (this).GenExprConvert(e, selfIdent, env, expectedOwnership, out _out339, out _out340, out _out341); - r = _out339; - resultingOwnership = _out340; - readIdents = _out341; - } - goto after_match30; - } - if (_source74.is_SeqConstruct) { - DAST._IExpression _1576_length = _source74.dtor_length; - DAST._IExpression _1577_expr = _source74.dtor_elem; - { - RAST._IExpr _1578_recursiveGen; - DCOMP._IOwnership _1579___v115; - Dafny.ISet> _1580_recIdents; - RAST._IExpr _out342; - DCOMP._IOwnership _out343; - Dafny.ISet> _out344; - (this).GenExpr(_1577_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out342, out _out343, out _out344); - _1578_recursiveGen = _out342; - _1579___v115 = _out343; - _1580_recIdents = _out344; - RAST._IExpr _1581_lengthGen; - DCOMP._IOwnership _1582___v116; - Dafny.ISet> _1583_lengthIdents; - RAST._IExpr _out345; - DCOMP._IOwnership _out346; - Dafny.ISet> _out347; - (this).GenExpr(_1576_length, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out345, out _out346, out _out347); - _1581_lengthGen = _out345; - _1582___v116 = _out346; - _1583_lengthIdents = _out347; - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\nlet _initializer = "), (_1578_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";\n::dafny_runtime::integer_range(::dafny_runtime::Zero::zero(), ")), (_1581_lengthGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").map(|i| _initializer(&i)).collect::<::dafny_runtime::Sequence<_>>()\n}"))); - readIdents = Dafny.Set>.Union(_1580_recIdents, _1583_lengthIdents); - RAST._IExpr _out348; - DCOMP._IOwnership _out349; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out348, out _out349); - r = _out348; - resultingOwnership = _out349; - return ; + { + if (_source74.is_New) { + Dafny.ISequence> _1536_path = _source74.dtor_path; + Dafny.ISequence _1537_typeArgs = _source74.dtor_typeArgs; + Dafny.ISequence _1538_args = _source74.dtor_args; + { + RAST._IExpr _out316; + _out316 = DCOMP.COMP.GenPathExpr(_1536_path); + r = _out316; + if ((new BigInteger((_1537_typeArgs).Count)).Sign == 1) { + Dafny.ISequence _1539_typeExprs; + _1539_typeExprs = Dafny.Sequence.FromElements(); + BigInteger _hi31 = new BigInteger((_1537_typeArgs).Count); + for (BigInteger _1540_i = BigInteger.Zero; _1540_i < _hi31; _1540_i++) { + RAST._IType _1541_typeExpr; + RAST._IType _out317; + _out317 = (this).GenType((_1537_typeArgs).Select(_1540_i), false, false); + _1541_typeExpr = _out317; + _1539_typeExprs = Dafny.Sequence.Concat(_1539_typeExprs, Dafny.Sequence.FromElements(_1541_typeExpr)); + } + r = (r).ApplyType(_1539_typeExprs); + } + r = (r).MSel(Dafny.Sequence.UnicodeFromString("new")); + readIdents = Dafny.Set>.FromElements(); + Dafny.ISequence _1542_arguments; + _1542_arguments = Dafny.Sequence.FromElements(); + BigInteger _hi32 = new BigInteger((_1538_args).Count); + for (BigInteger _1543_i = BigInteger.Zero; _1543_i < _hi32; _1543_i++) { + RAST._IExpr _1544_recursiveGen; + DCOMP._IOwnership _1545___v108; + Dafny.ISet> _1546_recIdents; + RAST._IExpr _out318; + DCOMP._IOwnership _out319; + Dafny.ISet> _out320; + (this).GenExpr((_1538_args).Select(_1543_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out318, out _out319, out _out320); + _1544_recursiveGen = _out318; + _1545___v108 = _out319; + _1546_recIdents = _out320; + _1542_arguments = Dafny.Sequence.Concat(_1542_arguments, Dafny.Sequence.FromElements(_1544_recursiveGen)); + readIdents = Dafny.Set>.Union(readIdents, _1546_recIdents); + } + r = (r).Apply(_1542_arguments); + RAST._IExpr _out321; + DCOMP._IOwnership _out322; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out321, out _out322); + r = _out321; + resultingOwnership = _out322; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_SeqValue) { - Dafny.ISequence _1584_exprs = _source74.dtor_elements; - DAST._IType _1585_typ = _source74.dtor_typ; - { - readIdents = Dafny.Set>.FromElements(); - RAST._IType _1586_genTpe; - RAST._IType _out350; - _out350 = (this).GenType(_1585_typ, false, false); - _1586_genTpe = _out350; - BigInteger _1587_i; - _1587_i = BigInteger.Zero; - Dafny.ISequence _1588_args; - _1588_args = Dafny.Sequence.FromElements(); - while ((_1587_i) < (new BigInteger((_1584_exprs).Count))) { - RAST._IExpr _1589_recursiveGen; - DCOMP._IOwnership _1590___v117; - Dafny.ISet> _1591_recIdents; - RAST._IExpr _out351; - DCOMP._IOwnership _out352; - Dafny.ISet> _out353; - (this).GenExpr((_1584_exprs).Select(_1587_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out351, out _out352, out _out353); - _1589_recursiveGen = _out351; - _1590___v117 = _out352; - _1591_recIdents = _out353; - readIdents = Dafny.Set>.Union(readIdents, _1591_recIdents); - _1588_args = Dafny.Sequence.Concat(_1588_args, Dafny.Sequence.FromElements(_1589_recursiveGen)); - _1587_i = (_1587_i) + (BigInteger.One); - } - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("seq!"))).Apply(_1588_args); - if ((new BigInteger((_1588_args).Count)).Sign == 0) { - r = RAST.Expr.create_TypeAscription(r, ((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence"))).Apply1(_1586_genTpe)); - } - RAST._IExpr _out354; - DCOMP._IOwnership _out355; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out354, out _out355); - r = _out354; - resultingOwnership = _out355; - return ; + { + if (_source74.is_NewArray) { + Dafny.ISequence _1547_dims = _source74.dtor_dims; + DAST._IType _1548_typ = _source74.dtor_typ; + { + BigInteger _1549_i; + _1549_i = (new BigInteger((_1547_dims).Count)) - (BigInteger.One); + RAST._IType _1550_genTyp; + RAST._IType _out323; + _out323 = (this).GenType(_1548_typ, false, false); + _1550_genTyp = _out323; + Dafny.ISequence _1551_s; + _1551_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), (_1550_genTyp)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(" as ::std::default::Default>::default()")); + readIdents = Dafny.Set>.FromElements(); + while ((_1549_i).Sign != -1) { + RAST._IExpr _1552_recursiveGen; + DCOMP._IOwnership _1553___v109; + Dafny.ISet> _1554_recIdents; + RAST._IExpr _out324; + DCOMP._IOwnership _out325; + Dafny.ISet> _out326; + (this).GenExpr((_1547_dims).Select(_1549_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out324, out _out325, out _out326); + _1552_recursiveGen = _out324; + _1553___v109 = _out325; + _1554_recIdents = _out326; + _1551_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::new(::std::cell::RefCell::new(vec!["), _1551_s), Dafny.Sequence.UnicodeFromString("; ::from(")), (_1552_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").unwrap()]))")); + readIdents = Dafny.Set>.Union(readIdents, _1554_recIdents); + _1549_i = (_1549_i) - (BigInteger.One); + } + r = RAST.Expr.create_RawExpr(_1551_s); + RAST._IExpr _out327; + DCOMP._IOwnership _out328; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out327, out _out328); + r = _out327; + resultingOwnership = _out328; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_SetValue) { - Dafny.ISequence _1592_exprs = _source74.dtor_elements; - { - Dafny.ISequence _1593_generatedValues; - _1593_generatedValues = Dafny.Sequence.FromElements(); - readIdents = Dafny.Set>.FromElements(); - BigInteger _1594_i; - _1594_i = BigInteger.Zero; - while ((_1594_i) < (new BigInteger((_1592_exprs).Count))) { - RAST._IExpr _1595_recursiveGen; - DCOMP._IOwnership _1596___v118; - Dafny.ISet> _1597_recIdents; - RAST._IExpr _out356; - DCOMP._IOwnership _out357; - Dafny.ISet> _out358; - (this).GenExpr((_1592_exprs).Select(_1594_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out356, out _out357, out _out358); - _1595_recursiveGen = _out356; - _1596___v118 = _out357; - _1597_recIdents = _out358; - _1593_generatedValues = Dafny.Sequence.Concat(_1593_generatedValues, Dafny.Sequence.FromElements(_1595_recursiveGen)); - readIdents = Dafny.Set>.Union(readIdents, _1597_recIdents); - _1594_i = (_1594_i) + (BigInteger.One); - } - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("set!"))).Apply(_1593_generatedValues); - RAST._IExpr _out359; - DCOMP._IOwnership _out360; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out359, out _out360); - r = _out359; - resultingOwnership = _out360; - return ; + { + if (_source74.is_DatatypeValue) { + DAST._IDatatypeType _1555_datatypeType = _source74.dtor_datatypeType; + Dafny.ISequence _1556_typeArgs = _source74.dtor_typeArgs; + Dafny.ISequence _1557_variant = _source74.dtor_variant; + bool _1558_isCo = _source74.dtor_isCo; + Dafny.ISequence<_System._ITuple2, DAST._IExpression>> _1559_values = _source74.dtor_contents; + { + RAST._IExpr _out329; + _out329 = DCOMP.COMP.GenPathExpr((_1555_datatypeType).dtor_path); + r = _out329; + Dafny.ISequence _1560_genTypeArgs; + _1560_genTypeArgs = Dafny.Sequence.FromElements(); + BigInteger _hi33 = new BigInteger((_1556_typeArgs).Count); + for (BigInteger _1561_i = BigInteger.Zero; _1561_i < _hi33; _1561_i++) { + RAST._IType _1562_typeExpr; + RAST._IType _out330; + _out330 = (this).GenType((_1556_typeArgs).Select(_1561_i), false, false); + _1562_typeExpr = _out330; + _1560_genTypeArgs = Dafny.Sequence.Concat(_1560_genTypeArgs, Dafny.Sequence.FromElements(_1562_typeExpr)); + } + if ((new BigInteger((_1556_typeArgs).Count)).Sign == 1) { + r = (r).ApplyType(_1560_genTypeArgs); + } + r = (r).MSel(DCOMP.__default.escapeName(_1557_variant)); + readIdents = Dafny.Set>.FromElements(); + Dafny.ISequence _1563_assignments; + _1563_assignments = Dafny.Sequence.FromElements(); + BigInteger _hi34 = new BigInteger((_1559_values).Count); + for (BigInteger _1564_i = BigInteger.Zero; _1564_i < _hi34; _1564_i++) { + _System._ITuple2, DAST._IExpression> _let_tmp_rhs63 = (_1559_values).Select(_1564_i); + Dafny.ISequence _1565_name = _let_tmp_rhs63.dtor__0; + DAST._IExpression _1566_value = _let_tmp_rhs63.dtor__1; + if (_1558_isCo) { + RAST._IExpr _1567_recursiveGen; + DCOMP._IOwnership _1568___v110; + Dafny.ISet> _1569_recIdents; + RAST._IExpr _out331; + DCOMP._IOwnership _out332; + Dafny.ISet> _out333; + (this).GenExpr(_1566_value, selfIdent, DCOMP.Environment.Empty(), DCOMP.Ownership.create_OwnershipOwned(), out _out331, out _out332, out _out333); + _1567_recursiveGen = _out331; + _1568___v110 = _out332; + _1569_recIdents = _out333; + readIdents = Dafny.Set>.Union(readIdents, _1569_recIdents); + Dafny.ISequence _1570_allReadCloned; + _1570_allReadCloned = Dafny.Sequence.UnicodeFromString(""); + while (!(_1569_recIdents).Equals(Dafny.Set>.FromElements())) { + Dafny.ISequence _1571_next; + foreach (Dafny.ISequence _assign_such_that_2 in (_1569_recIdents).Elements) { + _1571_next = (Dafny.ISequence)_assign_such_that_2; + if ((_1569_recIdents).Contains(_1571_next)) { + goto after__ASSIGN_SUCH_THAT_2; + } + } + throw new System.Exception("assign-such-that search produced no value (line 3271)"); + after__ASSIGN_SUCH_THAT_2: ; + _1570_allReadCloned = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1570_allReadCloned, Dafny.Sequence.UnicodeFromString("let ")), _1571_next), Dafny.Sequence.UnicodeFromString(" = ")), _1571_next), Dafny.Sequence.UnicodeFromString(".clone();\n")); + _1569_recIdents = Dafny.Set>.Difference(_1569_recIdents, Dafny.Set>.FromElements(_1571_next)); + } + Dafny.ISequence _1572_wasAssigned; + _1572_wasAssigned = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::LazyFieldWrapper(::dafny_runtime::Lazy::new(::std::boxed::Box::new({\n"), _1570_allReadCloned), Dafny.Sequence.UnicodeFromString("move || (")), (_1567_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")})))")); + _1563_assignments = Dafny.Sequence.Concat(_1563_assignments, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1565_name, RAST.Expr.create_RawExpr(_1572_wasAssigned)))); + } else { + RAST._IExpr _1573_recursiveGen; + DCOMP._IOwnership _1574___v111; + Dafny.ISet> _1575_recIdents; + RAST._IExpr _out334; + DCOMP._IOwnership _out335; + Dafny.ISet> _out336; + (this).GenExpr(_1566_value, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out334, out _out335, out _out336); + _1573_recursiveGen = _out334; + _1574___v111 = _out335; + _1575_recIdents = _out336; + _1563_assignments = Dafny.Sequence.Concat(_1563_assignments, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1565_name, _1573_recursiveGen))); + readIdents = Dafny.Set>.Union(readIdents, _1575_recIdents); + } + } + r = RAST.Expr.create_StructBuild(r, _1563_assignments); + if ((this).IsRcWrapped((_1555_datatypeType).dtor_attributes)) { + r = RAST.__default.RcNew(r); + } + RAST._IExpr _out337; + DCOMP._IOwnership _out338; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out337, out _out338); + r = _out337; + resultingOwnership = _out338; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_MultisetValue) { - Dafny.ISequence _1598_exprs = _source74.dtor_elements; - { - Dafny.ISequence _1599_generatedValues; - _1599_generatedValues = Dafny.Sequence.FromElements(); - readIdents = Dafny.Set>.FromElements(); - BigInteger _1600_i; - _1600_i = BigInteger.Zero; - while ((_1600_i) < (new BigInteger((_1598_exprs).Count))) { - RAST._IExpr _1601_recursiveGen; - DCOMP._IOwnership _1602___v119; - Dafny.ISet> _1603_recIdents; - RAST._IExpr _out361; - DCOMP._IOwnership _out362; - Dafny.ISet> _out363; - (this).GenExpr((_1598_exprs).Select(_1600_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out361, out _out362, out _out363); - _1601_recursiveGen = _out361; - _1602___v119 = _out362; - _1603_recIdents = _out363; - _1599_generatedValues = Dafny.Sequence.Concat(_1599_generatedValues, Dafny.Sequence.FromElements(_1601_recursiveGen)); - readIdents = Dafny.Set>.Union(readIdents, _1603_recIdents); - _1600_i = (_1600_i) + (BigInteger.One); - } - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("multiset!"))).Apply(_1599_generatedValues); - RAST._IExpr _out364; - DCOMP._IOwnership _out365; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out364, out _out365); - r = _out364; - resultingOwnership = _out365; - return ; + { + if (_source74.is_Convert) { + { + RAST._IExpr _out339; + DCOMP._IOwnership _out340; + Dafny.ISet> _out341; + (this).GenExprConvert(e, selfIdent, env, expectedOwnership, out _out339, out _out340, out _out341); + r = _out339; + resultingOwnership = _out340; + readIdents = _out341; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_ToMultiset) { - DAST._IExpression _1604_expr = _source74.dtor_ToMultiset_a0; - { - RAST._IExpr _1605_recursiveGen; - DCOMP._IOwnership _1606___v120; - Dafny.ISet> _1607_recIdents; - RAST._IExpr _out366; - DCOMP._IOwnership _out367; - Dafny.ISet> _out368; - (this).GenExpr(_1604_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out366, out _out367, out _out368); - _1605_recursiveGen = _out366; - _1606___v120 = _out367; - _1607_recIdents = _out368; - r = ((_1605_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("as_dafny_multiset"))).Apply(Dafny.Sequence.FromElements()); - readIdents = _1607_recIdents; - RAST._IExpr _out369; - DCOMP._IOwnership _out370; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out369, out _out370); - r = _out369; - resultingOwnership = _out370; - return ; + { + if (_source74.is_SeqConstruct) { + DAST._IExpression _1576_length = _source74.dtor_length; + DAST._IExpression _1577_expr = _source74.dtor_elem; + { + RAST._IExpr _1578_recursiveGen; + DCOMP._IOwnership _1579___v115; + Dafny.ISet> _1580_recIdents; + RAST._IExpr _out342; + DCOMP._IOwnership _out343; + Dafny.ISet> _out344; + (this).GenExpr(_1577_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out342, out _out343, out _out344); + _1578_recursiveGen = _out342; + _1579___v115 = _out343; + _1580_recIdents = _out344; + RAST._IExpr _1581_lengthGen; + DCOMP._IOwnership _1582___v116; + Dafny.ISet> _1583_lengthIdents; + RAST._IExpr _out345; + DCOMP._IOwnership _out346; + Dafny.ISet> _out347; + (this).GenExpr(_1576_length, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out345, out _out346, out _out347); + _1581_lengthGen = _out345; + _1582___v116 = _out346; + _1583_lengthIdents = _out347; + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\nlet _initializer = "), (_1578_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";\n::dafny_runtime::integer_range(::dafny_runtime::Zero::zero(), ")), (_1581_lengthGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").map(|i| _initializer(&i)).collect::<::dafny_runtime::Sequence<_>>()\n}"))); + readIdents = Dafny.Set>.Union(_1580_recIdents, _1583_lengthIdents); + RAST._IExpr _out348; + DCOMP._IOwnership _out349; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out348, out _out349); + r = _out348; + resultingOwnership = _out349; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_MapValue) { - Dafny.ISequence<_System._ITuple2> _1608_mapElems = _source74.dtor_mapElems; - { - Dafny.ISequence<_System._ITuple2> _1609_generatedValues; - _1609_generatedValues = Dafny.Sequence<_System._ITuple2>.FromElements(); - readIdents = Dafny.Set>.FromElements(); - BigInteger _1610_i; - _1610_i = BigInteger.Zero; - while ((_1610_i) < (new BigInteger((_1608_mapElems).Count))) { - RAST._IExpr _1611_recursiveGenKey; - DCOMP._IOwnership _1612___v121; - Dafny.ISet> _1613_recIdentsKey; - RAST._IExpr _out371; - DCOMP._IOwnership _out372; - Dafny.ISet> _out373; - (this).GenExpr(((_1608_mapElems).Select(_1610_i)).dtor__0, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out371, out _out372, out _out373); - _1611_recursiveGenKey = _out371; - _1612___v121 = _out372; - _1613_recIdentsKey = _out373; - RAST._IExpr _1614_recursiveGenValue; - DCOMP._IOwnership _1615___v122; - Dafny.ISet> _1616_recIdentsValue; - RAST._IExpr _out374; - DCOMP._IOwnership _out375; - Dafny.ISet> _out376; - (this).GenExpr(((_1608_mapElems).Select(_1610_i)).dtor__1, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out374, out _out375, out _out376); - _1614_recursiveGenValue = _out374; - _1615___v122 = _out375; - _1616_recIdentsValue = _out376; - _1609_generatedValues = Dafny.Sequence<_System._ITuple2>.Concat(_1609_generatedValues, Dafny.Sequence<_System._ITuple2>.FromElements(_System.Tuple2.create(_1611_recursiveGenKey, _1614_recursiveGenValue))); - readIdents = Dafny.Set>.Union(Dafny.Set>.Union(readIdents, _1613_recIdentsKey), _1616_recIdentsValue); - _1610_i = (_1610_i) + (BigInteger.One); - } - _1610_i = BigInteger.Zero; - Dafny.ISequence _1617_arguments; - _1617_arguments = Dafny.Sequence.FromElements(); - while ((_1610_i) < (new BigInteger((_1609_generatedValues).Count))) { - RAST._IExpr _1618_genKey; - _1618_genKey = ((_1609_generatedValues).Select(_1610_i)).dtor__0; - RAST._IExpr _1619_genValue; - _1619_genValue = ((_1609_generatedValues).Select(_1610_i)).dtor__1; - _1617_arguments = Dafny.Sequence.Concat(_1617_arguments, Dafny.Sequence.FromElements(RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("=>"), _1618_genKey, _1619_genValue, DAST.Format.BinaryOpFormat.create_NoFormat()))); - _1610_i = (_1610_i) + (BigInteger.One); - } - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("map!"))).Apply(_1617_arguments); - RAST._IExpr _out377; - DCOMP._IOwnership _out378; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out377, out _out378); - r = _out377; - resultingOwnership = _out378; - return ; + { + if (_source74.is_SeqValue) { + Dafny.ISequence _1584_exprs = _source74.dtor_elements; + DAST._IType _1585_typ = _source74.dtor_typ; + { + readIdents = Dafny.Set>.FromElements(); + RAST._IType _1586_genTpe; + RAST._IType _out350; + _out350 = (this).GenType(_1585_typ, false, false); + _1586_genTpe = _out350; + BigInteger _1587_i; + _1587_i = BigInteger.Zero; + Dafny.ISequence _1588_args; + _1588_args = Dafny.Sequence.FromElements(); + while ((_1587_i) < (new BigInteger((_1584_exprs).Count))) { + RAST._IExpr _1589_recursiveGen; + DCOMP._IOwnership _1590___v117; + Dafny.ISet> _1591_recIdents; + RAST._IExpr _out351; + DCOMP._IOwnership _out352; + Dafny.ISet> _out353; + (this).GenExpr((_1584_exprs).Select(_1587_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out351, out _out352, out _out353); + _1589_recursiveGen = _out351; + _1590___v117 = _out352; + _1591_recIdents = _out353; + readIdents = Dafny.Set>.Union(readIdents, _1591_recIdents); + _1588_args = Dafny.Sequence.Concat(_1588_args, Dafny.Sequence.FromElements(_1589_recursiveGen)); + _1587_i = (_1587_i) + (BigInteger.One); + } + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("seq!"))).Apply(_1588_args); + if ((new BigInteger((_1588_args).Count)).Sign == 0) { + r = RAST.Expr.create_TypeAscription(r, ((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence"))).Apply1(_1586_genTpe)); + } + RAST._IExpr _out354; + DCOMP._IOwnership _out355; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out354, out _out355); + r = _out354; + resultingOwnership = _out355; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_SeqUpdate) { - DAST._IExpression _1620_expr = _source74.dtor_expr; - DAST._IExpression _1621_index = _source74.dtor_indexExpr; - DAST._IExpression _1622_value = _source74.dtor_value; - { - RAST._IExpr _1623_exprR; - DCOMP._IOwnership _1624___v123; - Dafny.ISet> _1625_exprIdents; - RAST._IExpr _out379; - DCOMP._IOwnership _out380; - Dafny.ISet> _out381; - (this).GenExpr(_1620_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out379, out _out380, out _out381); - _1623_exprR = _out379; - _1624___v123 = _out380; - _1625_exprIdents = _out381; - RAST._IExpr _1626_indexR; - DCOMP._IOwnership _1627_indexOwnership; - Dafny.ISet> _1628_indexIdents; - RAST._IExpr _out382; - DCOMP._IOwnership _out383; - Dafny.ISet> _out384; - (this).GenExpr(_1621_index, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out382, out _out383, out _out384); - _1626_indexR = _out382; - _1627_indexOwnership = _out383; - _1628_indexIdents = _out384; - RAST._IExpr _1629_valueR; - DCOMP._IOwnership _1630_valueOwnership; - Dafny.ISet> _1631_valueIdents; - RAST._IExpr _out385; - DCOMP._IOwnership _out386; - Dafny.ISet> _out387; - (this).GenExpr(_1622_value, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out385, out _out386, out _out387); - _1629_valueR = _out385; - _1630_valueOwnership = _out386; - _1631_valueIdents = _out387; - r = ((_1623_exprR).Sel(Dafny.Sequence.UnicodeFromString("update_index"))).Apply(Dafny.Sequence.FromElements(_1626_indexR, _1629_valueR)); - RAST._IExpr _out388; - DCOMP._IOwnership _out389; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out388, out _out389); - r = _out388; - resultingOwnership = _out389; - readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1625_exprIdents, _1628_indexIdents), _1631_valueIdents); - return ; + { + if (_source74.is_SetValue) { + Dafny.ISequence _1592_exprs = _source74.dtor_elements; + { + Dafny.ISequence _1593_generatedValues; + _1593_generatedValues = Dafny.Sequence.FromElements(); + readIdents = Dafny.Set>.FromElements(); + BigInteger _1594_i; + _1594_i = BigInteger.Zero; + while ((_1594_i) < (new BigInteger((_1592_exprs).Count))) { + RAST._IExpr _1595_recursiveGen; + DCOMP._IOwnership _1596___v118; + Dafny.ISet> _1597_recIdents; + RAST._IExpr _out356; + DCOMP._IOwnership _out357; + Dafny.ISet> _out358; + (this).GenExpr((_1592_exprs).Select(_1594_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out356, out _out357, out _out358); + _1595_recursiveGen = _out356; + _1596___v118 = _out357; + _1597_recIdents = _out358; + _1593_generatedValues = Dafny.Sequence.Concat(_1593_generatedValues, Dafny.Sequence.FromElements(_1595_recursiveGen)); + readIdents = Dafny.Set>.Union(readIdents, _1597_recIdents); + _1594_i = (_1594_i) + (BigInteger.One); + } + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("set!"))).Apply(_1593_generatedValues); + RAST._IExpr _out359; + DCOMP._IOwnership _out360; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out359, out _out360); + r = _out359; + resultingOwnership = _out360; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_MapUpdate) { - DAST._IExpression _1632_expr = _source74.dtor_expr; - DAST._IExpression _1633_index = _source74.dtor_indexExpr; - DAST._IExpression _1634_value = _source74.dtor_value; - { - RAST._IExpr _1635_exprR; - DCOMP._IOwnership _1636___v124; - Dafny.ISet> _1637_exprIdents; - RAST._IExpr _out390; - DCOMP._IOwnership _out391; - Dafny.ISet> _out392; - (this).GenExpr(_1632_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out390, out _out391, out _out392); - _1635_exprR = _out390; - _1636___v124 = _out391; - _1637_exprIdents = _out392; - RAST._IExpr _1638_indexR; - DCOMP._IOwnership _1639_indexOwnership; - Dafny.ISet> _1640_indexIdents; - RAST._IExpr _out393; - DCOMP._IOwnership _out394; - Dafny.ISet> _out395; - (this).GenExpr(_1633_index, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out393, out _out394, out _out395); - _1638_indexR = _out393; - _1639_indexOwnership = _out394; - _1640_indexIdents = _out395; - RAST._IExpr _1641_valueR; - DCOMP._IOwnership _1642_valueOwnership; - Dafny.ISet> _1643_valueIdents; - RAST._IExpr _out396; - DCOMP._IOwnership _out397; - Dafny.ISet> _out398; - (this).GenExpr(_1634_value, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out396, out _out397, out _out398); - _1641_valueR = _out396; - _1642_valueOwnership = _out397; - _1643_valueIdents = _out398; - r = ((_1635_exprR).Sel(Dafny.Sequence.UnicodeFromString("update_index"))).Apply(Dafny.Sequence.FromElements(_1638_indexR, _1641_valueR)); - RAST._IExpr _out399; - DCOMP._IOwnership _out400; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out399, out _out400); - r = _out399; - resultingOwnership = _out400; - readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1637_exprIdents, _1640_indexIdents), _1643_valueIdents); - return ; + { + if (_source74.is_MultisetValue) { + Dafny.ISequence _1598_exprs = _source74.dtor_elements; + { + Dafny.ISequence _1599_generatedValues; + _1599_generatedValues = Dafny.Sequence.FromElements(); + readIdents = Dafny.Set>.FromElements(); + BigInteger _1600_i; + _1600_i = BigInteger.Zero; + while ((_1600_i) < (new BigInteger((_1598_exprs).Count))) { + RAST._IExpr _1601_recursiveGen; + DCOMP._IOwnership _1602___v119; + Dafny.ISet> _1603_recIdents; + RAST._IExpr _out361; + DCOMP._IOwnership _out362; + Dafny.ISet> _out363; + (this).GenExpr((_1598_exprs).Select(_1600_i), selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out361, out _out362, out _out363); + _1601_recursiveGen = _out361; + _1602___v119 = _out362; + _1603_recIdents = _out363; + _1599_generatedValues = Dafny.Sequence.Concat(_1599_generatedValues, Dafny.Sequence.FromElements(_1601_recursiveGen)); + readIdents = Dafny.Set>.Union(readIdents, _1603_recIdents); + _1600_i = (_1600_i) + (BigInteger.One); + } + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("multiset!"))).Apply(_1599_generatedValues); + RAST._IExpr _out364; + DCOMP._IOwnership _out365; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out364, out _out365); + r = _out364; + resultingOwnership = _out365; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_This) { - { - Std.Wrappers._IOption> _source75 = selfIdent; - if (_source75.is_Some) { - Dafny.ISequence _1644_id = _source75.dtor_value; - { - r = RAST.Expr.create_Identifier(_1644_id); - if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwned())) { - r = RAST.__default.Clone(r); - resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); - } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwnedBox())) { - r = RAST.__default.BoxNew(RAST.__default.Clone(r)); - resultingOwnership = DCOMP.Ownership.create_OwnershipOwnedBox(); - } else if ((object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowed())) || (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipAutoBorrowed()))) { - if (!(_1644_id).Equals(Dafny.Sequence.UnicodeFromString("self"))) { - r = RAST.__default.Borrow(r); - } - resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); - } else { - if (!(_1644_id).Equals(Dafny.Sequence.UnicodeFromString("self"))) { - r = RAST.__default.BorrowMut(r); - } - resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowedMut(); - } - readIdents = Dafny.Set>.FromElements(_1644_id); - } - goto after_match31; + { + if (_source74.is_ToMultiset) { + DAST._IExpression _1604_expr = _source74.dtor_ToMultiset_a0; + { + RAST._IExpr _1605_recursiveGen; + DCOMP._IOwnership _1606___v120; + Dafny.ISet> _1607_recIdents; + RAST._IExpr _out366; + DCOMP._IOwnership _out367; + Dafny.ISet> _out368; + (this).GenExpr(_1604_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out366, out _out367, out _out368); + _1605_recursiveGen = _out366; + _1606___v120 = _out367; + _1607_recIdents = _out368; + r = ((_1605_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("as_dafny_multiset"))).Apply(Dafny.Sequence.FromElements()); + readIdents = _1607_recIdents; + RAST._IExpr _out369; + DCOMP._IOwnership _out370; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out369, out _out370); + r = _out369; + resultingOwnership = _out370; + return ; } + goto after_match30; + } + } + { + if (_source74.is_MapValue) { + Dafny.ISequence<_System._ITuple2> _1608_mapElems = _source74.dtor_mapElems; { - r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("panic!(\"this outside of a method\")")); - RAST._IExpr _out401; - DCOMP._IOwnership _out402; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out401, out _out402); - r = _out401; - resultingOwnership = _out402; + Dafny.ISequence<_System._ITuple2> _1609_generatedValues; + _1609_generatedValues = Dafny.Sequence<_System._ITuple2>.FromElements(); readIdents = Dafny.Set>.FromElements(); + BigInteger _1610_i; + _1610_i = BigInteger.Zero; + while ((_1610_i) < (new BigInteger((_1608_mapElems).Count))) { + RAST._IExpr _1611_recursiveGenKey; + DCOMP._IOwnership _1612___v121; + Dafny.ISet> _1613_recIdentsKey; + RAST._IExpr _out371; + DCOMP._IOwnership _out372; + Dafny.ISet> _out373; + (this).GenExpr(((_1608_mapElems).Select(_1610_i)).dtor__0, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out371, out _out372, out _out373); + _1611_recursiveGenKey = _out371; + _1612___v121 = _out372; + _1613_recIdentsKey = _out373; + RAST._IExpr _1614_recursiveGenValue; + DCOMP._IOwnership _1615___v122; + Dafny.ISet> _1616_recIdentsValue; + RAST._IExpr _out374; + DCOMP._IOwnership _out375; + Dafny.ISet> _out376; + (this).GenExpr(((_1608_mapElems).Select(_1610_i)).dtor__1, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out374, out _out375, out _out376); + _1614_recursiveGenValue = _out374; + _1615___v122 = _out375; + _1616_recIdentsValue = _out376; + _1609_generatedValues = Dafny.Sequence<_System._ITuple2>.Concat(_1609_generatedValues, Dafny.Sequence<_System._ITuple2>.FromElements(_System.Tuple2.create(_1611_recursiveGenKey, _1614_recursiveGenValue))); + readIdents = Dafny.Set>.Union(Dafny.Set>.Union(readIdents, _1613_recIdentsKey), _1616_recIdentsValue); + _1610_i = (_1610_i) + (BigInteger.One); + } + _1610_i = BigInteger.Zero; + Dafny.ISequence _1617_arguments; + _1617_arguments = Dafny.Sequence.FromElements(); + while ((_1610_i) < (new BigInteger((_1609_generatedValues).Count))) { + RAST._IExpr _1618_genKey; + _1618_genKey = ((_1609_generatedValues).Select(_1610_i)).dtor__0; + RAST._IExpr _1619_genValue; + _1619_genValue = ((_1609_generatedValues).Select(_1610_i)).dtor__1; + _1617_arguments = Dafny.Sequence.Concat(_1617_arguments, Dafny.Sequence.FromElements(RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("=>"), _1618_genKey, _1619_genValue, DAST.Format.BinaryOpFormat.create_NoFormat()))); + _1610_i = (_1610_i) + (BigInteger.One); + } + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("map!"))).Apply(_1617_arguments); + RAST._IExpr _out377; + DCOMP._IOwnership _out378; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out377, out _out378); + r = _out377; + resultingOwnership = _out378; + return ; } - after_match31: ; - return ; + goto after_match30; } - goto after_match30; } - if (_source74.is_Ite) { - DAST._IExpression _1645_cond = _source74.dtor_cond; - DAST._IExpression _1646_t = _source74.dtor_thn; - DAST._IExpression _1647_f = _source74.dtor_els; - { - RAST._IExpr _1648_cond; - DCOMP._IOwnership _1649___v125; - Dafny.ISet> _1650_recIdentsCond; - RAST._IExpr _out403; - DCOMP._IOwnership _out404; - Dafny.ISet> _out405; - (this).GenExpr(_1645_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out403, out _out404, out _out405); - _1648_cond = _out403; - _1649___v125 = _out404; - _1650_recIdentsCond = _out405; - Dafny.ISequence _1651_condString; - _1651_condString = (_1648_cond)._ToString(DCOMP.__default.IND); - RAST._IExpr _1652___v126; - DCOMP._IOwnership _1653_tHasToBeOwned; - Dafny.ISet> _1654___v127; - RAST._IExpr _out406; - DCOMP._IOwnership _out407; - Dafny.ISet> _out408; - (this).GenExpr(_1646_t, selfIdent, env, expectedOwnership, out _out406, out _out407, out _out408); - _1652___v126 = _out406; - _1653_tHasToBeOwned = _out407; - _1654___v127 = _out408; - RAST._IExpr _1655_fExpr; - DCOMP._IOwnership _1656_fOwned; - Dafny.ISet> _1657_recIdentsF; - RAST._IExpr _out409; - DCOMP._IOwnership _out410; - Dafny.ISet> _out411; - (this).GenExpr(_1647_f, selfIdent, env, _1653_tHasToBeOwned, out _out409, out _out410, out _out411); - _1655_fExpr = _out409; - _1656_fOwned = _out410; - _1657_recIdentsF = _out411; - Dafny.ISequence _1658_fString; - _1658_fString = (_1655_fExpr)._ToString(DCOMP.__default.IND); - RAST._IExpr _1659_tExpr; - DCOMP._IOwnership _1660___v128; - Dafny.ISet> _1661_recIdentsT; - RAST._IExpr _out412; - DCOMP._IOwnership _out413; - Dafny.ISet> _out414; - (this).GenExpr(_1646_t, selfIdent, env, _1656_fOwned, out _out412, out _out413, out _out414); - _1659_tExpr = _out412; - _1660___v128 = _out413; - _1661_recIdentsT = _out414; - Dafny.ISequence _1662_tString; - _1662_tString = (_1659_tExpr)._ToString(DCOMP.__default.IND); - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("(if "), _1651_condString), Dafny.Sequence.UnicodeFromString(" {\n")), _1662_tString), Dafny.Sequence.UnicodeFromString("\n} else {\n")), _1658_fString), Dafny.Sequence.UnicodeFromString("\n})"))); - RAST._IExpr _out415; - DCOMP._IOwnership _out416; - DCOMP.COMP.FromOwnership(r, _1656_fOwned, expectedOwnership, out _out415, out _out416); - r = _out415; - resultingOwnership = _out416; - readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1650_recIdentsCond, _1661_recIdentsT), _1657_recIdentsF); - return ; + { + if (_source74.is_SeqUpdate) { + DAST._IExpression _1620_expr = _source74.dtor_expr; + DAST._IExpression _1621_index = _source74.dtor_indexExpr; + DAST._IExpression _1622_value = _source74.dtor_value; + { + RAST._IExpr _1623_exprR; + DCOMP._IOwnership _1624___v123; + Dafny.ISet> _1625_exprIdents; + RAST._IExpr _out379; + DCOMP._IOwnership _out380; + Dafny.ISet> _out381; + (this).GenExpr(_1620_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out379, out _out380, out _out381); + _1623_exprR = _out379; + _1624___v123 = _out380; + _1625_exprIdents = _out381; + RAST._IExpr _1626_indexR; + DCOMP._IOwnership _1627_indexOwnership; + Dafny.ISet> _1628_indexIdents; + RAST._IExpr _out382; + DCOMP._IOwnership _out383; + Dafny.ISet> _out384; + (this).GenExpr(_1621_index, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out382, out _out383, out _out384); + _1626_indexR = _out382; + _1627_indexOwnership = _out383; + _1628_indexIdents = _out384; + RAST._IExpr _1629_valueR; + DCOMP._IOwnership _1630_valueOwnership; + Dafny.ISet> _1631_valueIdents; + RAST._IExpr _out385; + DCOMP._IOwnership _out386; + Dafny.ISet> _out387; + (this).GenExpr(_1622_value, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out385, out _out386, out _out387); + _1629_valueR = _out385; + _1630_valueOwnership = _out386; + _1631_valueIdents = _out387; + r = ((_1623_exprR).Sel(Dafny.Sequence.UnicodeFromString("update_index"))).Apply(Dafny.Sequence.FromElements(_1626_indexR, _1629_valueR)); + RAST._IExpr _out388; + DCOMP._IOwnership _out389; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out388, out _out389); + r = _out388; + resultingOwnership = _out389; + readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1625_exprIdents, _1628_indexIdents), _1631_valueIdents); + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_UnOp) { - DAST._IUnaryOp unOp0 = _source74.dtor_unOp; - if (unOp0.is_Not) { - DAST._IExpression _1663_e = _source74.dtor_expr; - DAST.Format._IUnaryOpFormat _1664_format = _source74.dtor_format1; + { + if (_source74.is_MapUpdate) { + DAST._IExpression _1632_expr = _source74.dtor_expr; + DAST._IExpression _1633_index = _source74.dtor_indexExpr; + DAST._IExpression _1634_value = _source74.dtor_value; { - RAST._IExpr _1665_recursiveGen; - DCOMP._IOwnership _1666___v129; - Dafny.ISet> _1667_recIdents; - RAST._IExpr _out417; - DCOMP._IOwnership _out418; - Dafny.ISet> _out419; - (this).GenExpr(_1663_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out417, out _out418, out _out419); - _1665_recursiveGen = _out417; - _1666___v129 = _out418; - _1667_recIdents = _out419; - r = RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("!"), _1665_recursiveGen, _1664_format); - RAST._IExpr _out420; - DCOMP._IOwnership _out421; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out420, out _out421); - r = _out420; - resultingOwnership = _out421; - readIdents = _1667_recIdents; + RAST._IExpr _1635_exprR; + DCOMP._IOwnership _1636___v124; + Dafny.ISet> _1637_exprIdents; + RAST._IExpr _out390; + DCOMP._IOwnership _out391; + Dafny.ISet> _out392; + (this).GenExpr(_1632_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out390, out _out391, out _out392); + _1635_exprR = _out390; + _1636___v124 = _out391; + _1637_exprIdents = _out392; + RAST._IExpr _1638_indexR; + DCOMP._IOwnership _1639_indexOwnership; + Dafny.ISet> _1640_indexIdents; + RAST._IExpr _out393; + DCOMP._IOwnership _out394; + Dafny.ISet> _out395; + (this).GenExpr(_1633_index, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out393, out _out394, out _out395); + _1638_indexR = _out393; + _1639_indexOwnership = _out394; + _1640_indexIdents = _out395; + RAST._IExpr _1641_valueR; + DCOMP._IOwnership _1642_valueOwnership; + Dafny.ISet> _1643_valueIdents; + RAST._IExpr _out396; + DCOMP._IOwnership _out397; + Dafny.ISet> _out398; + (this).GenExpr(_1634_value, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out396, out _out397, out _out398); + _1641_valueR = _out396; + _1642_valueOwnership = _out397; + _1643_valueIdents = _out398; + r = ((_1635_exprR).Sel(Dafny.Sequence.UnicodeFromString("update_index"))).Apply(Dafny.Sequence.FromElements(_1638_indexR, _1641_valueR)); + RAST._IExpr _out399; + DCOMP._IOwnership _out400; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out399, out _out400); + r = _out399; + resultingOwnership = _out400; + readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1637_exprIdents, _1640_indexIdents), _1643_valueIdents); return ; } goto after_match30; } } - if (_source74.is_UnOp) { - DAST._IUnaryOp unOp1 = _source74.dtor_unOp; - if (unOp1.is_BitwiseNot) { - DAST._IExpression _1668_e = _source74.dtor_expr; - DAST.Format._IUnaryOpFormat _1669_format = _source74.dtor_format1; + { + if (_source74.is_This) { { - RAST._IExpr _1670_recursiveGen; - DCOMP._IOwnership _1671___v130; - Dafny.ISet> _1672_recIdents; - RAST._IExpr _out422; - DCOMP._IOwnership _out423; - Dafny.ISet> _out424; - (this).GenExpr(_1668_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out422, out _out423, out _out424); - _1670_recursiveGen = _out422; - _1671___v130 = _out423; - _1672_recIdents = _out424; - r = RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("~"), _1670_recursiveGen, _1669_format); - RAST._IExpr _out425; - DCOMP._IOwnership _out426; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out425, out _out426); - r = _out425; - resultingOwnership = _out426; - readIdents = _1672_recIdents; + Std.Wrappers._IOption> _source75 = selfIdent; + { + if (_source75.is_Some) { + Dafny.ISequence _1644_id = _source75.dtor_value; + { + r = RAST.Expr.create_Identifier(_1644_id); + if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwned())) { + r = RAST.__default.Clone(r); + resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipOwnedBox())) { + r = RAST.__default.BoxNew(RAST.__default.Clone(r)); + resultingOwnership = DCOMP.Ownership.create_OwnershipOwnedBox(); + } else if ((object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowed())) || (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipAutoBorrowed()))) { + if (!(_1644_id).Equals(Dafny.Sequence.UnicodeFromString("self"))) { + r = RAST.__default.Borrow(r); + } + resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else { + if (!(_1644_id).Equals(Dafny.Sequence.UnicodeFromString("self"))) { + r = RAST.__default.BorrowMut(r); + } + resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowedMut(); + } + readIdents = Dafny.Set>.FromElements(_1644_id); + } + goto after_match31; + } + } + { + { + r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("panic!(\"this outside of a method\")")); + RAST._IExpr _out401; + DCOMP._IOwnership _out402; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out401, out _out402); + r = _out401; + resultingOwnership = _out402; + readIdents = Dafny.Set>.FromElements(); + } + } + after_match31: ; return ; } goto after_match30; } } - if (_source74.is_UnOp) { - DAST._IUnaryOp unOp2 = _source74.dtor_unOp; - if (unOp2.is_Cardinality) { - DAST._IExpression _1673_e = _source74.dtor_expr; - DAST.Format._IUnaryOpFormat _1674_format = _source74.dtor_format1; + { + if (_source74.is_Ite) { + DAST._IExpression _1645_cond = _source74.dtor_cond; + DAST._IExpression _1646_t = _source74.dtor_thn; + DAST._IExpression _1647_f = _source74.dtor_els; { - RAST._IExpr _1675_recursiveGen; - DCOMP._IOwnership _1676_recOwned; - Dafny.ISet> _1677_recIdents; - RAST._IExpr _out427; - DCOMP._IOwnership _out428; - Dafny.ISet> _out429; - (this).GenExpr(_1673_e, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out427, out _out428, out _out429); - _1675_recursiveGen = _out427; - _1676_recOwned = _out428; - _1677_recIdents = _out429; - r = ((_1675_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("cardinality"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out430; - DCOMP._IOwnership _out431; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out430, out _out431); - r = _out430; - resultingOwnership = _out431; - readIdents = _1677_recIdents; + RAST._IExpr _1648_cond; + DCOMP._IOwnership _1649___v125; + Dafny.ISet> _1650_recIdentsCond; + RAST._IExpr _out403; + DCOMP._IOwnership _out404; + Dafny.ISet> _out405; + (this).GenExpr(_1645_cond, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out403, out _out404, out _out405); + _1648_cond = _out403; + _1649___v125 = _out404; + _1650_recIdentsCond = _out405; + Dafny.ISequence _1651_condString; + _1651_condString = (_1648_cond)._ToString(DCOMP.__default.IND); + RAST._IExpr _1652___v126; + DCOMP._IOwnership _1653_tHasToBeOwned; + Dafny.ISet> _1654___v127; + RAST._IExpr _out406; + DCOMP._IOwnership _out407; + Dafny.ISet> _out408; + (this).GenExpr(_1646_t, selfIdent, env, expectedOwnership, out _out406, out _out407, out _out408); + _1652___v126 = _out406; + _1653_tHasToBeOwned = _out407; + _1654___v127 = _out408; + RAST._IExpr _1655_fExpr; + DCOMP._IOwnership _1656_fOwned; + Dafny.ISet> _1657_recIdentsF; + RAST._IExpr _out409; + DCOMP._IOwnership _out410; + Dafny.ISet> _out411; + (this).GenExpr(_1647_f, selfIdent, env, _1653_tHasToBeOwned, out _out409, out _out410, out _out411); + _1655_fExpr = _out409; + _1656_fOwned = _out410; + _1657_recIdentsF = _out411; + Dafny.ISequence _1658_fString; + _1658_fString = (_1655_fExpr)._ToString(DCOMP.__default.IND); + RAST._IExpr _1659_tExpr; + DCOMP._IOwnership _1660___v128; + Dafny.ISet> _1661_recIdentsT; + RAST._IExpr _out412; + DCOMP._IOwnership _out413; + Dafny.ISet> _out414; + (this).GenExpr(_1646_t, selfIdent, env, _1656_fOwned, out _out412, out _out413, out _out414); + _1659_tExpr = _out412; + _1660___v128 = _out413; + _1661_recIdentsT = _out414; + Dafny.ISequence _1662_tString; + _1662_tString = (_1659_tExpr)._ToString(DCOMP.__default.IND); + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("(if "), _1651_condString), Dafny.Sequence.UnicodeFromString(" {\n")), _1662_tString), Dafny.Sequence.UnicodeFromString("\n} else {\n")), _1658_fString), Dafny.Sequence.UnicodeFromString("\n})"))); + RAST._IExpr _out415; + DCOMP._IOwnership _out416; + DCOMP.COMP.FromOwnership(r, _1656_fOwned, expectedOwnership, out _out415, out _out416); + r = _out415; + resultingOwnership = _out416; + readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1650_recIdentsCond, _1661_recIdentsT), _1657_recIdentsF); return ; } goto after_match30; } } - if (_source74.is_BinOp) { - RAST._IExpr _out432; - DCOMP._IOwnership _out433; - Dafny.ISet> _out434; - (this).GenExprBinary(e, selfIdent, env, expectedOwnership, out _out432, out _out433, out _out434); - r = _out432; - resultingOwnership = _out433; - readIdents = _out434; - goto after_match30; + { + if (_source74.is_UnOp) { + DAST._IUnaryOp unOp0 = _source74.dtor_unOp; + if (unOp0.is_Not) { + DAST._IExpression _1663_e = _source74.dtor_expr; + DAST.Format._IUnaryOpFormat _1664_format = _source74.dtor_format1; + { + RAST._IExpr _1665_recursiveGen; + DCOMP._IOwnership _1666___v129; + Dafny.ISet> _1667_recIdents; + RAST._IExpr _out417; + DCOMP._IOwnership _out418; + Dafny.ISet> _out419; + (this).GenExpr(_1663_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out417, out _out418, out _out419); + _1665_recursiveGen = _out417; + _1666___v129 = _out418; + _1667_recIdents = _out419; + r = RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("!"), _1665_recursiveGen, _1664_format); + RAST._IExpr _out420; + DCOMP._IOwnership _out421; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out420, out _out421); + r = _out420; + resultingOwnership = _out421; + readIdents = _1667_recIdents; + return ; + } + goto after_match30; + } + } } - if (_source74.is_ArrayLen) { - DAST._IExpression _1678_expr = _source74.dtor_expr; - BigInteger _1679_dim = _source74.dtor_dim; - { - RAST._IExpr _1680_recursiveGen; - DCOMP._IOwnership _1681___v135; - Dafny.ISet> _1682_recIdents; - RAST._IExpr _out435; - DCOMP._IOwnership _out436; - Dafny.ISet> _out437; - (this).GenExpr(_1678_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out435, out _out436, out _out437); - _1680_recursiveGen = _out435; - _1681___v135 = _out436; - _1682_recIdents = _out437; - if ((_1679_dim).Sign == 0) { - r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigInt::from(("), (_1680_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").borrow().len())"))); - } else { - Dafny.ISequence _1683_s; - _1683_s = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigInt::from(m.borrow().len())")))._ToString(DCOMP.__default.IND); - BigInteger _1684_i; - _1684_i = BigInteger.One; - while ((_1684_i) < (_1679_dim)) { - _1683_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("m.borrow().get(0).map(|m| "), _1683_s), Dafny.Sequence.UnicodeFromString(").unwrap_or(::dafny_runtime::BigInt::from(0))")); - _1684_i = (_1684_i) + (BigInteger.One); + { + if (_source74.is_UnOp) { + DAST._IUnaryOp unOp1 = _source74.dtor_unOp; + if (unOp1.is_BitwiseNot) { + DAST._IExpression _1668_e = _source74.dtor_expr; + DAST.Format._IUnaryOpFormat _1669_format = _source74.dtor_format1; + { + RAST._IExpr _1670_recursiveGen; + DCOMP._IOwnership _1671___v130; + Dafny.ISet> _1672_recIdents; + RAST._IExpr _out422; + DCOMP._IOwnership _out423; + Dafny.ISet> _out424; + (this).GenExpr(_1668_e, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out422, out _out423, out _out424); + _1670_recursiveGen = _out422; + _1671___v130 = _out423; + _1672_recIdents = _out424; + r = RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("~"), _1670_recursiveGen, _1669_format); + RAST._IExpr _out425; + DCOMP._IOwnership _out426; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out425, out _out426); + r = _out425; + resultingOwnership = _out426; + readIdents = _1672_recIdents; + return ; } - r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), (_1680_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")), Dafny.Sequence.UnicodeFromString(".borrow().get(0).map(|m| ")), _1683_s), Dafny.Sequence.UnicodeFromString(").unwrap_or(::dafny_runtime::BigInt::from(0))")))); - } - RAST._IExpr _out438; - DCOMP._IOwnership _out439; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out438, out _out439); - r = _out438; - resultingOwnership = _out439; - readIdents = _1682_recIdents; - return ; + goto after_match30; + } } - goto after_match30; } - if (_source74.is_MapKeys) { - DAST._IExpression _1685_expr = _source74.dtor_expr; - { - RAST._IExpr _1686_recursiveGen; - DCOMP._IOwnership _1687___v136; - Dafny.ISet> _1688_recIdents; - RAST._IExpr _out440; - DCOMP._IOwnership _out441; - Dafny.ISet> _out442; - (this).GenExpr(_1685_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out440, out _out441, out _out442); - _1686_recursiveGen = _out440; - _1687___v136 = _out441; - _1688_recIdents = _out442; - readIdents = _1688_recIdents; - r = ((_1686_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("keys"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out443; - DCOMP._IOwnership _out444; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out443, out _out444); - r = _out443; - resultingOwnership = _out444; - return ; + { + if (_source74.is_UnOp) { + DAST._IUnaryOp unOp2 = _source74.dtor_unOp; + if (unOp2.is_Cardinality) { + DAST._IExpression _1673_e = _source74.dtor_expr; + DAST.Format._IUnaryOpFormat _1674_format = _source74.dtor_format1; + { + RAST._IExpr _1675_recursiveGen; + DCOMP._IOwnership _1676_recOwned; + Dafny.ISet> _1677_recIdents; + RAST._IExpr _out427; + DCOMP._IOwnership _out428; + Dafny.ISet> _out429; + (this).GenExpr(_1673_e, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out427, out _out428, out _out429); + _1675_recursiveGen = _out427; + _1676_recOwned = _out428; + _1677_recIdents = _out429; + r = ((_1675_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("cardinality"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out430; + DCOMP._IOwnership _out431; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out430, out _out431); + r = _out430; + resultingOwnership = _out431; + readIdents = _1677_recIdents; + return ; + } + goto after_match30; + } } - goto after_match30; } - if (_source74.is_MapValues) { - DAST._IExpression _1689_expr = _source74.dtor_expr; - { - RAST._IExpr _1690_recursiveGen; - DCOMP._IOwnership _1691___v137; - Dafny.ISet> _1692_recIdents; - RAST._IExpr _out445; - DCOMP._IOwnership _out446; - Dafny.ISet> _out447; - (this).GenExpr(_1689_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out445, out _out446, out _out447); - _1690_recursiveGen = _out445; - _1691___v137 = _out446; - _1692_recIdents = _out447; - readIdents = _1692_recIdents; - r = ((_1690_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("values"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out448; - DCOMP._IOwnership _out449; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out448, out _out449); - r = _out448; - resultingOwnership = _out449; - return ; + { + if (_source74.is_BinOp) { + RAST._IExpr _out432; + DCOMP._IOwnership _out433; + Dafny.ISet> _out434; + (this).GenExprBinary(e, selfIdent, env, expectedOwnership, out _out432, out _out433, out _out434); + r = _out432; + resultingOwnership = _out433; + readIdents = _out434; + goto after_match30; } - goto after_match30; } - if (_source74.is_SelectFn) { - DAST._IExpression _1693_on = _source74.dtor_expr; - Dafny.ISequence _1694_field = _source74.dtor_field; - bool _1695_isDatatype = _source74.dtor_onDatatype; - bool _1696_isStatic = _source74.dtor_isStatic; - BigInteger _1697_arity = _source74.dtor_arity; - { - RAST._IExpr _1698_onExpr; - DCOMP._IOwnership _1699_onOwned; - Dafny.ISet> _1700_recIdents; - RAST._IExpr _out450; - DCOMP._IOwnership _out451; - Dafny.ISet> _out452; - (this).GenExpr(_1693_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out450, out _out451, out _out452); - _1698_onExpr = _out450; - _1699_onOwned = _out451; - _1700_recIdents = _out452; - Dafny.ISequence _1701_s = Dafny.Sequence.Empty; - Dafny.ISequence _1702_onString; - _1702_onString = (_1698_onExpr)._ToString(DCOMP.__default.IND); - if (_1696_isStatic) { - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1702_onString, Dafny.Sequence.UnicodeFromString("::")), DCOMP.__default.escapeName(_1694_field)); - } else { - _1701_s = Dafny.Sequence.UnicodeFromString("{\n"); - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("let callTarget = (")), _1702_onString), ((object.Equals(_1699_onOwned, DCOMP.Ownership.create_OwnershipOwned())) ? (Dafny.Sequence.UnicodeFromString(")")) : (Dafny.Sequence.UnicodeFromString(").clone()")))), Dafny.Sequence.UnicodeFromString(";\n")); - Dafny.ISequence _1703_args; - _1703_args = Dafny.Sequence.UnicodeFromString(""); - BigInteger _1704_i; - _1704_i = BigInteger.Zero; - while ((_1704_i) < (_1697_arity)) { - if ((_1704_i).Sign == 1) { - _1703_args = Dafny.Sequence.Concat(_1703_args, Dafny.Sequence.UnicodeFromString(", ")); + { + if (_source74.is_ArrayLen) { + DAST._IExpression _1678_expr = _source74.dtor_expr; + BigInteger _1679_dim = _source74.dtor_dim; + { + RAST._IExpr _1680_recursiveGen; + DCOMP._IOwnership _1681___v135; + Dafny.ISet> _1682_recIdents; + RAST._IExpr _out435; + DCOMP._IOwnership _out436; + Dafny.ISet> _out437; + (this).GenExpr(_1678_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out435, out _out436, out _out437); + _1680_recursiveGen = _out435; + _1681___v135 = _out436; + _1682_recIdents = _out437; + if ((_1679_dim).Sign == 0) { + r = RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigInt::from(("), (_1680_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(").borrow().len())"))); + } else { + Dafny.ISequence _1683_s; + _1683_s = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigInt::from(m.borrow().len())")))._ToString(DCOMP.__default.IND); + BigInteger _1684_i; + _1684_i = BigInteger.One; + while ((_1684_i) < (_1679_dim)) { + _1683_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("m.borrow().get(0).map(|m| "), _1683_s), Dafny.Sequence.UnicodeFromString(").unwrap_or(::dafny_runtime::BigInt::from(0))")); + _1684_i = (_1684_i) + (BigInteger.One); } - _1703_args = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1703_args, Dafny.Sequence.UnicodeFromString("arg")), Std.Strings.__default.OfNat(_1704_i)); - _1704_i = (_1704_i) + (BigInteger.One); - } - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("move |")), _1703_args), Dafny.Sequence.UnicodeFromString("| {\n")); - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("callTarget.")), DCOMP.__default.escapeName(_1694_field)), Dafny.Sequence.UnicodeFromString("(")), _1703_args), Dafny.Sequence.UnicodeFromString(")\n")); - _1701_s = Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("}\n")); - _1701_s = Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("}")); - } - Dafny.ISequence _1705_typeShape; - _1705_typeShape = Dafny.Sequence.UnicodeFromString("dyn ::std::ops::Fn("); - BigInteger _1706_i; - _1706_i = BigInteger.Zero; - while ((_1706_i) < (_1697_arity)) { - if ((_1706_i).Sign == 1) { - _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString(", ")); + r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), (_1680_recursiveGen)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")), Dafny.Sequence.UnicodeFromString(".borrow().get(0).map(|m| ")), _1683_s), Dafny.Sequence.UnicodeFromString(").unwrap_or(::dafny_runtime::BigInt::from(0))")))); } - _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString("&_")); - _1706_i = (_1706_i) + (BigInteger.One); - } - _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString(") -> _")); - _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::new("), _1701_s), Dafny.Sequence.UnicodeFromString(") as ::std::rc::Rc<")), _1705_typeShape), Dafny.Sequence.UnicodeFromString(">")); - r = RAST.Expr.create_RawExpr(_1701_s); - RAST._IExpr _out453; - DCOMP._IOwnership _out454; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out453, out _out454); - r = _out453; - resultingOwnership = _out454; - readIdents = _1700_recIdents; - return ; + RAST._IExpr _out438; + DCOMP._IOwnership _out439; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out438, out _out439); + r = _out438; + resultingOwnership = _out439; + readIdents = _1682_recIdents; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_Select) { - DAST._IExpression expr0 = _source74.dtor_expr; - if (expr0.is_Companion) { - Dafny.ISequence> _1707_c = expr0.dtor_Companion_a0; - Dafny.ISequence _1708_field = _source74.dtor_field; - bool _1709_isConstant = _source74.dtor_isConstant; - bool _1710_isDatatype = _source74.dtor_onDatatype; - DAST._IType _1711_fieldType = _source74.dtor_fieldType; + { + if (_source74.is_MapKeys) { + DAST._IExpression _1685_expr = _source74.dtor_expr; { - RAST._IExpr _1712_onExpr; - DCOMP._IOwnership _1713_onOwned; - Dafny.ISet> _1714_recIdents; - RAST._IExpr _out455; - DCOMP._IOwnership _out456; - Dafny.ISet> _out457; - (this).GenExpr(DAST.Expression.create_Companion(_1707_c), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out455, out _out456, out _out457); - _1712_onExpr = _out455; - _1713_onOwned = _out456; - _1714_recIdents = _out457; - r = ((_1712_onExpr).MSel(DCOMP.__default.escapeName(_1708_field))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out458; - DCOMP._IOwnership _out459; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out458, out _out459); - r = _out458; - resultingOwnership = _out459; - readIdents = _1714_recIdents; + RAST._IExpr _1686_recursiveGen; + DCOMP._IOwnership _1687___v136; + Dafny.ISet> _1688_recIdents; + RAST._IExpr _out440; + DCOMP._IOwnership _out441; + Dafny.ISet> _out442; + (this).GenExpr(_1685_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out440, out _out441, out _out442); + _1686_recursiveGen = _out440; + _1687___v136 = _out441; + _1688_recIdents = _out442; + readIdents = _1688_recIdents; + r = ((_1686_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("keys"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out443; + DCOMP._IOwnership _out444; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out443, out _out444); + r = _out443; + resultingOwnership = _out444; return ; } goto after_match30; } } - if (_source74.is_Select) { - DAST._IExpression _1715_on = _source74.dtor_expr; - Dafny.ISequence _1716_field = _source74.dtor_field; - bool _1717_isConstant = _source74.dtor_isConstant; - bool _1718_isDatatype = _source74.dtor_onDatatype; - DAST._IType _1719_fieldType = _source74.dtor_fieldType; - { - if (_1718_isDatatype) { - RAST._IExpr _1720_onExpr; - DCOMP._IOwnership _1721_onOwned; - Dafny.ISet> _1722_recIdents; - RAST._IExpr _out460; - DCOMP._IOwnership _out461; - Dafny.ISet> _out462; - (this).GenExpr(_1715_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out460, out _out461, out _out462); - _1720_onExpr = _out460; - _1721_onOwned = _out461; - _1722_recIdents = _out462; - r = ((_1720_onExpr).Sel(DCOMP.__default.escapeName(_1716_field))).Apply(Dafny.Sequence.FromElements()); - RAST._IType _1723_typ; - RAST._IType _out463; - _out463 = (this).GenType(_1719_fieldType, false, false); - _1723_typ = _out463; - RAST._IExpr _out464; - DCOMP._IOwnership _out465; - DCOMP.COMP.FromOwnership(r, DCOMP.Ownership.create_OwnershipBorrowed(), expectedOwnership, out _out464, out _out465); - r = _out464; - resultingOwnership = _out465; - readIdents = _1722_recIdents; - } else { - RAST._IExpr _1724_onExpr; - DCOMP._IOwnership _1725_onOwned; - Dafny.ISet> _1726_recIdents; - RAST._IExpr _out466; - DCOMP._IOwnership _out467; - Dafny.ISet> _out468; - (this).GenExpr(_1715_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out466, out _out467, out _out468); - _1724_onExpr = _out466; - _1725_onOwned = _out467; - _1726_recIdents = _out468; - r = _1724_onExpr; - r = (r).Sel(DCOMP.__default.escapeName(_1716_field)); - if (_1717_isConstant) { - r = (r).Apply(Dafny.Sequence.FromElements()); + { + if (_source74.is_MapValues) { + DAST._IExpression _1689_expr = _source74.dtor_expr; + { + RAST._IExpr _1690_recursiveGen; + DCOMP._IOwnership _1691___v137; + Dafny.ISet> _1692_recIdents; + RAST._IExpr _out445; + DCOMP._IOwnership _out446; + Dafny.ISet> _out447; + (this).GenExpr(_1689_expr, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out445, out _out446, out _out447); + _1690_recursiveGen = _out445; + _1691___v137 = _out446; + _1692_recIdents = _out447; + readIdents = _1692_recIdents; + r = ((_1690_recursiveGen).Sel(Dafny.Sequence.UnicodeFromString("values"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out448; + DCOMP._IOwnership _out449; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out448, out _out449); + r = _out448; + resultingOwnership = _out449; + return ; + } + goto after_match30; + } + } + { + if (_source74.is_SelectFn) { + DAST._IExpression _1693_on = _source74.dtor_expr; + Dafny.ISequence _1694_field = _source74.dtor_field; + bool _1695_isDatatype = _source74.dtor_onDatatype; + bool _1696_isStatic = _source74.dtor_isStatic; + BigInteger _1697_arity = _source74.dtor_arity; + { + RAST._IExpr _1698_onExpr; + DCOMP._IOwnership _1699_onOwned; + Dafny.ISet> _1700_recIdents; + RAST._IExpr _out450; + DCOMP._IOwnership _out451; + Dafny.ISet> _out452; + (this).GenExpr(_1693_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out450, out _out451, out _out452); + _1698_onExpr = _out450; + _1699_onOwned = _out451; + _1700_recIdents = _out452; + Dafny.ISequence _1701_s = Dafny.Sequence.Empty; + Dafny.ISequence _1702_onString; + _1702_onString = (_1698_onExpr)._ToString(DCOMP.__default.IND); + if (_1696_isStatic) { + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1702_onString, Dafny.Sequence.UnicodeFromString("::")), DCOMP.__default.escapeName(_1694_field)); } else { - Dafny.ISequence _1727_s; - _1727_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Deref::deref(&(("), (_1724_onExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")), Dafny.Sequence.UnicodeFromString(".")), DCOMP.__default.escapeName(_1716_field)), Dafny.Sequence.UnicodeFromString(".borrow()))")); - r = RAST.Expr.create_RawExpr(_1727_s); + _1701_s = Dafny.Sequence.UnicodeFromString("{\n"); + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("let callTarget = (")), _1702_onString), ((object.Equals(_1699_onOwned, DCOMP.Ownership.create_OwnershipOwned())) ? (Dafny.Sequence.UnicodeFromString(")")) : (Dafny.Sequence.UnicodeFromString(").clone()")))), Dafny.Sequence.UnicodeFromString(";\n")); + Dafny.ISequence _1703_args; + _1703_args = Dafny.Sequence.UnicodeFromString(""); + BigInteger _1704_i; + _1704_i = BigInteger.Zero; + while ((_1704_i) < (_1697_arity)) { + if ((_1704_i).Sign == 1) { + _1703_args = Dafny.Sequence.Concat(_1703_args, Dafny.Sequence.UnicodeFromString(", ")); + } + _1703_args = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1703_args, Dafny.Sequence.UnicodeFromString("arg")), Std.Strings.__default.OfNat(_1704_i)); + _1704_i = (_1704_i) + (BigInteger.One); + } + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("move |")), _1703_args), Dafny.Sequence.UnicodeFromString("| {\n")); + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("callTarget.")), DCOMP.__default.escapeName(_1694_field)), Dafny.Sequence.UnicodeFromString("(")), _1703_args), Dafny.Sequence.UnicodeFromString(")\n")); + _1701_s = Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("}\n")); + _1701_s = Dafny.Sequence.Concat(_1701_s, Dafny.Sequence.UnicodeFromString("}")); } - DCOMP._IOwnership _1728_fromOwnership; - if (_1717_isConstant) { - _1728_fromOwnership = DCOMP.Ownership.create_OwnershipOwned(); - } else { - _1728_fromOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + Dafny.ISequence _1705_typeShape; + _1705_typeShape = Dafny.Sequence.UnicodeFromString("dyn ::std::ops::Fn("); + BigInteger _1706_i; + _1706_i = BigInteger.Zero; + while ((_1706_i) < (_1697_arity)) { + if ((_1706_i).Sign == 1) { + _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString(", ")); + } + _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString("&_")); + _1706_i = (_1706_i) + (BigInteger.One); } - RAST._IExpr _out469; - DCOMP._IOwnership _out470; - DCOMP.COMP.FromOwnership(r, _1728_fromOwnership, expectedOwnership, out _out469, out _out470); - r = _out469; - resultingOwnership = _out470; - readIdents = _1726_recIdents; + _1705_typeShape = Dafny.Sequence.Concat(_1705_typeShape, Dafny.Sequence.UnicodeFromString(") -> _")); + _1701_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::rc::Rc::new("), _1701_s), Dafny.Sequence.UnicodeFromString(") as ::std::rc::Rc<")), _1705_typeShape), Dafny.Sequence.UnicodeFromString(">")); + r = RAST.Expr.create_RawExpr(_1701_s); + RAST._IExpr _out453; + DCOMP._IOwnership _out454; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out453, out _out454); + r = _out453; + resultingOwnership = _out454; + readIdents = _1700_recIdents; + return ; } - return ; + goto after_match30; } - goto after_match30; } - if (_source74.is_Index) { - DAST._IExpression _1729_on = _source74.dtor_expr; - DAST._ICollKind _1730_collKind = _source74.dtor_collKind; - Dafny.ISequence _1731_indices = _source74.dtor_indices; - { - RAST._IExpr _1732_onExpr; - DCOMP._IOwnership _1733_onOwned; - Dafny.ISet> _1734_recIdents; - RAST._IExpr _out471; - DCOMP._IOwnership _out472; - Dafny.ISet> _out473; - (this).GenExpr(_1729_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out471, out _out472, out _out473); - _1732_onExpr = _out471; - _1733_onOwned = _out472; - _1734_recIdents = _out473; - readIdents = _1734_recIdents; - r = _1732_onExpr; - BigInteger _1735_i; - _1735_i = BigInteger.Zero; - while ((_1735_i) < (new BigInteger((_1731_indices).Count))) { - if (object.Equals(_1730_collKind, DAST.CollKind.create_Array())) { - r = ((r).Sel(Dafny.Sequence.UnicodeFromString("borrow"))).Apply(Dafny.Sequence.FromElements()); + { + if (_source74.is_Select) { + DAST._IExpression expr0 = _source74.dtor_expr; + if (expr0.is_Companion) { + Dafny.ISequence> _1707_c = expr0.dtor_Companion_a0; + Dafny.ISequence _1708_field = _source74.dtor_field; + bool _1709_isConstant = _source74.dtor_isConstant; + bool _1710_isDatatype = _source74.dtor_onDatatype; + DAST._IType _1711_fieldType = _source74.dtor_fieldType; + { + RAST._IExpr _1712_onExpr; + DCOMP._IOwnership _1713_onOwned; + Dafny.ISet> _1714_recIdents; + RAST._IExpr _out455; + DCOMP._IOwnership _out456; + Dafny.ISet> _out457; + (this).GenExpr(DAST.Expression.create_Companion(_1707_c), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out455, out _out456, out _out457); + _1712_onExpr = _out455; + _1713_onOwned = _out456; + _1714_recIdents = _out457; + r = ((_1712_onExpr).MSel(DCOMP.__default.escapeName(_1708_field))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out458; + DCOMP._IOwnership _out459; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out458, out _out459); + r = _out458; + resultingOwnership = _out459; + readIdents = _1714_recIdents; + return ; } - RAST._IExpr _1736_idx; - DCOMP._IOwnership _1737_idxOwned; - Dafny.ISet> _1738_recIdentsIdx; - RAST._IExpr _out474; - DCOMP._IOwnership _out475; - Dafny.ISet> _out476; - (this).GenExpr((_1731_indices).Select(_1735_i), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out474, out _out475, out _out476); - _1736_idx = _out474; - _1737_idxOwned = _out475; - _1738_recIdentsIdx = _out476; - r = ((r).Sel(Dafny.Sequence.UnicodeFromString("get"))).Apply1(_1736_idx); - readIdents = Dafny.Set>.Union(readIdents, _1738_recIdentsIdx); - _1735_i = (_1735_i) + (BigInteger.One); - } - RAST._IExpr _out477; - DCOMP._IOwnership _out478; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out477, out _out478); - r = _out477; - resultingOwnership = _out478; - return ; + goto after_match30; + } } - goto after_match30; } - if (_source74.is_IndexRange) { - DAST._IExpression _1739_on = _source74.dtor_expr; - bool _1740_isArray = _source74.dtor_isArray; - Std.Wrappers._IOption _1741_low = _source74.dtor_low; - Std.Wrappers._IOption _1742_high = _source74.dtor_high; - { - RAST._IExpr _1743_onExpr; - DCOMP._IOwnership _1744_onOwned; - Dafny.ISet> _1745_recIdents; - RAST._IExpr _out479; - DCOMP._IOwnership _out480; - Dafny.ISet> _out481; - (this).GenExpr(_1739_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out479, out _out480, out _out481); - _1743_onExpr = _out479; - _1744_onOwned = _out480; - _1745_recIdents = _out481; - readIdents = _1745_recIdents; - Dafny.ISequence _1746_methodName; - if ((_1741_low).is_Some) { - if ((_1742_high).is_Some) { - _1746_methodName = Dafny.Sequence.UnicodeFromString("slice"); + { + if (_source74.is_Select) { + DAST._IExpression _1715_on = _source74.dtor_expr; + Dafny.ISequence _1716_field = _source74.dtor_field; + bool _1717_isConstant = _source74.dtor_isConstant; + bool _1718_isDatatype = _source74.dtor_onDatatype; + DAST._IType _1719_fieldType = _source74.dtor_fieldType; + { + if (_1718_isDatatype) { + RAST._IExpr _1720_onExpr; + DCOMP._IOwnership _1721_onOwned; + Dafny.ISet> _1722_recIdents; + RAST._IExpr _out460; + DCOMP._IOwnership _out461; + Dafny.ISet> _out462; + (this).GenExpr(_1715_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out460, out _out461, out _out462); + _1720_onExpr = _out460; + _1721_onOwned = _out461; + _1722_recIdents = _out462; + r = ((_1720_onExpr).Sel(DCOMP.__default.escapeName(_1716_field))).Apply(Dafny.Sequence.FromElements()); + RAST._IType _1723_typ; + RAST._IType _out463; + _out463 = (this).GenType(_1719_fieldType, false, false); + _1723_typ = _out463; + RAST._IExpr _out464; + DCOMP._IOwnership _out465; + DCOMP.COMP.FromOwnership(r, DCOMP.Ownership.create_OwnershipBorrowed(), expectedOwnership, out _out464, out _out465); + r = _out464; + resultingOwnership = _out465; + readIdents = _1722_recIdents; } else { - _1746_methodName = Dafny.Sequence.UnicodeFromString("drop"); + RAST._IExpr _1724_onExpr; + DCOMP._IOwnership _1725_onOwned; + Dafny.ISet> _1726_recIdents; + RAST._IExpr _out466; + DCOMP._IOwnership _out467; + Dafny.ISet> _out468; + (this).GenExpr(_1715_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out466, out _out467, out _out468); + _1724_onExpr = _out466; + _1725_onOwned = _out467; + _1726_recIdents = _out468; + r = _1724_onExpr; + r = (r).Sel(DCOMP.__default.escapeName(_1716_field)); + if (_1717_isConstant) { + r = (r).Apply(Dafny.Sequence.FromElements()); + } else { + Dafny.ISequence _1727_s; + _1727_s = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Deref::deref(&(("), (_1724_onExpr)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(")")), Dafny.Sequence.UnicodeFromString(".")), DCOMP.__default.escapeName(_1716_field)), Dafny.Sequence.UnicodeFromString(".borrow()))")); + r = RAST.Expr.create_RawExpr(_1727_s); + } + DCOMP._IOwnership _1728_fromOwnership; + if (_1717_isConstant) { + _1728_fromOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } else { + _1728_fromOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } + RAST._IExpr _out469; + DCOMP._IOwnership _out470; + DCOMP.COMP.FromOwnership(r, _1728_fromOwnership, expectedOwnership, out _out469, out _out470); + r = _out469; + resultingOwnership = _out470; + readIdents = _1726_recIdents; } - } else if ((_1742_high).is_Some) { - _1746_methodName = Dafny.Sequence.UnicodeFromString("take"); - } else { - _1746_methodName = Dafny.Sequence.UnicodeFromString(""); + return ; } - Dafny.ISequence _1747_arguments; - _1747_arguments = Dafny.Sequence.FromElements(); - Std.Wrappers._IOption _source76 = _1741_low; - if (_source76.is_Some) { - DAST._IExpression _1748_l = _source76.dtor_value; - { - RAST._IExpr _1749_lExpr; - DCOMP._IOwnership _1750___v138; - Dafny.ISet> _1751_recIdentsL; - RAST._IExpr _out482; - DCOMP._IOwnership _out483; - Dafny.ISet> _out484; - (this).GenExpr(_1748_l, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out482, out _out483, out _out484); - _1749_lExpr = _out482; - _1750___v138 = _out483; - _1751_recIdentsL = _out484; - _1747_arguments = Dafny.Sequence.Concat(_1747_arguments, Dafny.Sequence.FromElements(_1749_lExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1751_recIdentsL); + goto after_match30; + } + } + { + if (_source74.is_Index) { + DAST._IExpression _1729_on = _source74.dtor_expr; + DAST._ICollKind _1730_collKind = _source74.dtor_collKind; + Dafny.ISequence _1731_indices = _source74.dtor_indices; + { + RAST._IExpr _1732_onExpr; + DCOMP._IOwnership _1733_onOwned; + Dafny.ISet> _1734_recIdents; + RAST._IExpr _out471; + DCOMP._IOwnership _out472; + Dafny.ISet> _out473; + (this).GenExpr(_1729_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out471, out _out472, out _out473); + _1732_onExpr = _out471; + _1733_onOwned = _out472; + _1734_recIdents = _out473; + readIdents = _1734_recIdents; + r = _1732_onExpr; + BigInteger _1735_i; + _1735_i = BigInteger.Zero; + while ((_1735_i) < (new BigInteger((_1731_indices).Count))) { + if (object.Equals(_1730_collKind, DAST.CollKind.create_Array())) { + r = ((r).Sel(Dafny.Sequence.UnicodeFromString("borrow"))).Apply(Dafny.Sequence.FromElements()); + } + RAST._IExpr _1736_idx; + DCOMP._IOwnership _1737_idxOwned; + Dafny.ISet> _1738_recIdentsIdx; + RAST._IExpr _out474; + DCOMP._IOwnership _out475; + Dafny.ISet> _out476; + (this).GenExpr((_1731_indices).Select(_1735_i), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out474, out _out475, out _out476); + _1736_idx = _out474; + _1737_idxOwned = _out475; + _1738_recIdentsIdx = _out476; + r = ((r).Sel(Dafny.Sequence.UnicodeFromString("get"))).Apply1(_1736_idx); + readIdents = Dafny.Set>.Union(readIdents, _1738_recIdentsIdx); + _1735_i = (_1735_i) + (BigInteger.One); } - goto after_match32; + RAST._IExpr _out477; + DCOMP._IOwnership _out478; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out477, out _out478); + r = _out477; + resultingOwnership = _out478; + return ; } - after_match32: ; - Std.Wrappers._IOption _source77 = _1742_high; - if (_source77.is_Some) { - DAST._IExpression _1752_h = _source77.dtor_value; + goto after_match30; + } + } + { + if (_source74.is_IndexRange) { + DAST._IExpression _1739_on = _source74.dtor_expr; + bool _1740_isArray = _source74.dtor_isArray; + Std.Wrappers._IOption _1741_low = _source74.dtor_low; + Std.Wrappers._IOption _1742_high = _source74.dtor_high; + { + RAST._IExpr _1743_onExpr; + DCOMP._IOwnership _1744_onOwned; + Dafny.ISet> _1745_recIdents; + RAST._IExpr _out479; + DCOMP._IOwnership _out480; + Dafny.ISet> _out481; + (this).GenExpr(_1739_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out479, out _out480, out _out481); + _1743_onExpr = _out479; + _1744_onOwned = _out480; + _1745_recIdents = _out481; + readIdents = _1745_recIdents; + Dafny.ISequence _1746_methodName; + if ((_1741_low).is_Some) { + if ((_1742_high).is_Some) { + _1746_methodName = Dafny.Sequence.UnicodeFromString("slice"); + } else { + _1746_methodName = Dafny.Sequence.UnicodeFromString("drop"); + } + } else if ((_1742_high).is_Some) { + _1746_methodName = Dafny.Sequence.UnicodeFromString("take"); + } else { + _1746_methodName = Dafny.Sequence.UnicodeFromString(""); + } + Dafny.ISequence _1747_arguments; + _1747_arguments = Dafny.Sequence.FromElements(); + Std.Wrappers._IOption _source76 = _1741_low; { - RAST._IExpr _1753_hExpr; - DCOMP._IOwnership _1754___v139; - Dafny.ISet> _1755_recIdentsH; - RAST._IExpr _out485; - DCOMP._IOwnership _out486; - Dafny.ISet> _out487; - (this).GenExpr(_1752_h, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out485, out _out486, out _out487); - _1753_hExpr = _out485; - _1754___v139 = _out486; - _1755_recIdentsH = _out487; - _1747_arguments = Dafny.Sequence.Concat(_1747_arguments, Dafny.Sequence.FromElements(_1753_hExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1755_recIdentsH); + if (_source76.is_Some) { + DAST._IExpression _1748_l = _source76.dtor_value; + { + RAST._IExpr _1749_lExpr; + DCOMP._IOwnership _1750___v138; + Dafny.ISet> _1751_recIdentsL; + RAST._IExpr _out482; + DCOMP._IOwnership _out483; + Dafny.ISet> _out484; + (this).GenExpr(_1748_l, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out482, out _out483, out _out484); + _1749_lExpr = _out482; + _1750___v138 = _out483; + _1751_recIdentsL = _out484; + _1747_arguments = Dafny.Sequence.Concat(_1747_arguments, Dafny.Sequence.FromElements(_1749_lExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1751_recIdentsL); + } + goto after_match32; + } } - goto after_match33; - } - after_match33: ; - r = _1743_onExpr; - if (_1740_isArray) { - if (!(_1746_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { - _1746_methodName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _1746_methodName); + { } - r = ((RAST.__default.dafny__runtime__Sequence).MSel(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("from_array"), _1746_methodName))).Apply(_1747_arguments); - } else { - if (!(_1746_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { - r = ((r).Sel(_1746_methodName)).Apply(_1747_arguments); + after_match32: ; + Std.Wrappers._IOption _source77 = _1742_high; + { + if (_source77.is_Some) { + DAST._IExpression _1752_h = _source77.dtor_value; + { + RAST._IExpr _1753_hExpr; + DCOMP._IOwnership _1754___v139; + Dafny.ISet> _1755_recIdentsH; + RAST._IExpr _out485; + DCOMP._IOwnership _out486; + Dafny.ISet> _out487; + (this).GenExpr(_1752_h, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out485, out _out486, out _out487); + _1753_hExpr = _out485; + _1754___v139 = _out486; + _1755_recIdentsH = _out487; + _1747_arguments = Dafny.Sequence.Concat(_1747_arguments, Dafny.Sequence.FromElements(_1753_hExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1755_recIdentsH); + } + goto after_match33; + } + } + { + } + after_match33: ; + r = _1743_onExpr; + if (_1740_isArray) { + if (!(_1746_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { + _1746_methodName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _1746_methodName); + } + r = ((RAST.__default.dafny__runtime__Sequence).MSel(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("from_array"), _1746_methodName))).Apply(_1747_arguments); + } else { + if (!(_1746_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { + r = ((r).Sel(_1746_methodName)).Apply(_1747_arguments); + } } + RAST._IExpr _out488; + DCOMP._IOwnership _out489; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out488, out _out489); + r = _out488; + resultingOwnership = _out489; + return ; } - RAST._IExpr _out488; - DCOMP._IOwnership _out489; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out488, out _out489); - r = _out488; - resultingOwnership = _out489; - return ; + goto after_match30; } - goto after_match30; } - if (_source74.is_TupleSelect) { - DAST._IExpression _1756_on = _source74.dtor_expr; - BigInteger _1757_idx = _source74.dtor_index; - DAST._IType _1758_fieldType = _source74.dtor_fieldType; - { - RAST._IExpr _1759_onExpr; - DCOMP._IOwnership _1760_onOwnership; - Dafny.ISet> _1761_recIdents; - RAST._IExpr _out490; - DCOMP._IOwnership _out491; - Dafny.ISet> _out492; - (this).GenExpr(_1756_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out490, out _out491, out _out492); - _1759_onExpr = _out490; - _1760_onOwnership = _out491; - _1761_recIdents = _out492; - Dafny.ISequence _1762_selName; - _1762_selName = Std.Strings.__default.OfNat(_1757_idx); - DAST._IType _source78 = _1758_fieldType; - if (_source78.is_Tuple) { - Dafny.ISequence _1763_tps = _source78.dtor_Tuple_a0; - if (((_1758_fieldType).is_Tuple) && ((new BigInteger((_1763_tps).Count)) > (RAST.__default.MAX__TUPLE__SIZE))) { - _1762_selName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _1762_selName); + { + if (_source74.is_TupleSelect) { + DAST._IExpression _1756_on = _source74.dtor_expr; + BigInteger _1757_idx = _source74.dtor_index; + DAST._IType _1758_fieldType = _source74.dtor_fieldType; + { + RAST._IExpr _1759_onExpr; + DCOMP._IOwnership _1760_onOwnership; + Dafny.ISet> _1761_recIdents; + RAST._IExpr _out490; + DCOMP._IOwnership _out491; + Dafny.ISet> _out492; + (this).GenExpr(_1756_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out490, out _out491, out _out492); + _1759_onExpr = _out490; + _1760_onOwnership = _out491; + _1761_recIdents = _out492; + Dafny.ISequence _1762_selName; + _1762_selName = Std.Strings.__default.OfNat(_1757_idx); + DAST._IType _source78 = _1758_fieldType; + { + if (_source78.is_Tuple) { + Dafny.ISequence _1763_tps = _source78.dtor_Tuple_a0; + if (((_1758_fieldType).is_Tuple) && ((new BigInteger((_1763_tps).Count)) > (RAST.__default.MAX__TUPLE__SIZE))) { + _1762_selName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _1762_selName); + } + goto after_match34; + } } - goto after_match34; - } - after_match34: ; - r = (_1759_onExpr).Sel(_1762_selName); - RAST._IExpr _out493; - DCOMP._IOwnership _out494; - DCOMP.COMP.FromOwnership(r, _1760_onOwnership, expectedOwnership, out _out493, out _out494); - r = _out493; - resultingOwnership = _out494; - readIdents = _1761_recIdents; - return ; + { + } + after_match34: ; + r = (_1759_onExpr).Sel(_1762_selName); + RAST._IExpr _out493; + DCOMP._IOwnership _out494; + DCOMP.COMP.FromOwnership(r, _1760_onOwnership, expectedOwnership, out _out493, out _out494); + r = _out493; + resultingOwnership = _out494; + readIdents = _1761_recIdents; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_Call) { - DAST._IExpression _1764_on = _source74.dtor_on; - DAST._ICallName _1765_name = _source74.dtor_callName; - Dafny.ISequence _1766_typeArgs = _source74.dtor_typeArgs; - Dafny.ISequence _1767_args = _source74.dtor_args; - { - readIdents = Dafny.Set>.FromElements(); - RAST._IExpr _1768_onExpr; - DCOMP._IOwnership _1769___v141; - Dafny.ISet> _1770_recIdents; - RAST._IExpr _out495; - DCOMP._IOwnership _out496; - Dafny.ISet> _out497; - (this).GenExpr(_1764_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out495, out _out496, out _out497); - _1768_onExpr = _out495; - _1769___v141 = _out496; - _1770_recIdents = _out497; - Dafny.ISequence _1771_typeExprs; - _1771_typeExprs = Dafny.Sequence.FromElements(); - if ((new BigInteger((_1766_typeArgs).Count)) >= (BigInteger.One)) { - BigInteger _hi35 = new BigInteger((_1766_typeArgs).Count); - for (BigInteger _1772_typeI = BigInteger.Zero; _1772_typeI < _hi35; _1772_typeI++) { - RAST._IType _1773_typeExpr; - RAST._IType _out498; - _out498 = (this).GenType((_1766_typeArgs).Select(_1772_typeI), false, false); - _1773_typeExpr = _out498; - _1771_typeExprs = Dafny.Sequence.Concat(_1771_typeExprs, Dafny.Sequence.FromElements(_1773_typeExpr)); + { + if (_source74.is_Call) { + DAST._IExpression _1764_on = _source74.dtor_on; + DAST._ICallName _1765_name = _source74.dtor_callName; + Dafny.ISequence _1766_typeArgs = _source74.dtor_typeArgs; + Dafny.ISequence _1767_args = _source74.dtor_args; + { + readIdents = Dafny.Set>.FromElements(); + RAST._IExpr _1768_onExpr; + DCOMP._IOwnership _1769___v141; + Dafny.ISet> _1770_recIdents; + RAST._IExpr _out495; + DCOMP._IOwnership _out496; + Dafny.ISet> _out497; + (this).GenExpr(_1764_on, selfIdent, env, DCOMP.Ownership.create_OwnershipAutoBorrowed(), out _out495, out _out496, out _out497); + _1768_onExpr = _out495; + _1769___v141 = _out496; + _1770_recIdents = _out497; + Dafny.ISequence _1771_typeExprs; + _1771_typeExprs = Dafny.Sequence.FromElements(); + if ((new BigInteger((_1766_typeArgs).Count)) >= (BigInteger.One)) { + BigInteger _hi35 = new BigInteger((_1766_typeArgs).Count); + for (BigInteger _1772_typeI = BigInteger.Zero; _1772_typeI < _hi35; _1772_typeI++) { + RAST._IType _1773_typeExpr; + RAST._IType _out498; + _out498 = (this).GenType((_1766_typeArgs).Select(_1772_typeI), false, false); + _1773_typeExpr = _out498; + _1771_typeExprs = Dafny.Sequence.Concat(_1771_typeExprs, Dafny.Sequence.FromElements(_1773_typeExpr)); + } } - } - Dafny.ISequence _1774_argExprs; - _1774_argExprs = Dafny.Sequence.FromElements(); - BigInteger _hi36 = new BigInteger((_1767_args).Count); - for (BigInteger _1775_i = BigInteger.Zero; _1775_i < _hi36; _1775_i++) { - DCOMP._IOwnership _1776_argOwnership; - _1776_argOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); - if (((_1765_name).is_CallName) && ((_1775_i) < (new BigInteger((((_1765_name).dtor_signature)).Count)))) { - RAST._IType _1777_tpe; - RAST._IType _out499; - _out499 = (this).GenType(((((_1765_name).dtor_signature)).Select(_1775_i)).dtor_typ, false, false); - _1777_tpe = _out499; - if ((_1777_tpe).CanReadWithoutClone()) { - _1776_argOwnership = DCOMP.Ownership.create_OwnershipOwned(); + Dafny.ISequence _1774_argExprs; + _1774_argExprs = Dafny.Sequence.FromElements(); + BigInteger _hi36 = new BigInteger((_1767_args).Count); + for (BigInteger _1775_i = BigInteger.Zero; _1775_i < _hi36; _1775_i++) { + DCOMP._IOwnership _1776_argOwnership; + _1776_argOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + if (((_1765_name).is_CallName) && ((_1775_i) < (new BigInteger((((_1765_name).dtor_signature)).Count)))) { + RAST._IType _1777_tpe; + RAST._IType _out499; + _out499 = (this).GenType(((((_1765_name).dtor_signature)).Select(_1775_i)).dtor_typ, false, false); + _1777_tpe = _out499; + if ((_1777_tpe).CanReadWithoutClone()) { + _1776_argOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } + } + RAST._IExpr _1778_argExpr; + DCOMP._IOwnership _1779___v142; + Dafny.ISet> _1780_argIdents; + RAST._IExpr _out500; + DCOMP._IOwnership _out501; + Dafny.ISet> _out502; + (this).GenExpr((_1767_args).Select(_1775_i), selfIdent, env, _1776_argOwnership, out _out500, out _out501, out _out502); + _1778_argExpr = _out500; + _1779___v142 = _out501; + _1780_argIdents = _out502; + _1774_argExprs = Dafny.Sequence.Concat(_1774_argExprs, Dafny.Sequence.FromElements(_1778_argExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1780_argIdents); + } + readIdents = Dafny.Set>.Union(readIdents, _1770_recIdents); + Dafny.ISequence _1781_renderedName; + DAST._ICallName _source79 = _1765_name; + { + if (_source79.is_CallName) { + Dafny.ISequence _1782_ident = _source79.dtor_name; + _1781_renderedName = DCOMP.__default.escapeName(_1782_ident); + goto after_match35; + } + } + { + bool disjunctiveMatch11 = false; + if (_source79.is_MapBuilderAdd) { + disjunctiveMatch11 = true; + } + if (_source79.is_SetBuilderAdd) { + disjunctiveMatch11 = true; + } + if (disjunctiveMatch11) { + _1781_renderedName = Dafny.Sequence.UnicodeFromString("add"); + goto after_match35; + } + } + { + _1781_renderedName = Dafny.Sequence.UnicodeFromString("build"); + } + after_match35: ; + DAST._IExpression _source80 = _1764_on; + { + if (_source80.is_Companion) { + { + _1768_onExpr = (_1768_onExpr).MSel(_1781_renderedName); + } + goto after_match36; } } - RAST._IExpr _1778_argExpr; - DCOMP._IOwnership _1779___v142; - Dafny.ISet> _1780_argIdents; - RAST._IExpr _out500; - DCOMP._IOwnership _out501; - Dafny.ISet> _out502; - (this).GenExpr((_1767_args).Select(_1775_i), selfIdent, env, _1776_argOwnership, out _out500, out _out501, out _out502); - _1778_argExpr = _out500; - _1779___v142 = _out501; - _1780_argIdents = _out502; - _1774_argExprs = Dafny.Sequence.Concat(_1774_argExprs, Dafny.Sequence.FromElements(_1778_argExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1780_argIdents); - } - readIdents = Dafny.Set>.Union(readIdents, _1770_recIdents); - Dafny.ISequence _1781_renderedName; - DAST._ICallName _source79 = _1765_name; - if (_source79.is_CallName) { - Dafny.ISequence _1782_ident = _source79.dtor_name; - _1781_renderedName = DCOMP.__default.escapeName(_1782_ident); - goto after_match35; - } - bool disjunctiveMatch11 = false; - if (_source79.is_MapBuilderAdd) { - disjunctiveMatch11 = true; - } - if (_source79.is_SetBuilderAdd) { - disjunctiveMatch11 = true; - } - if (disjunctiveMatch11) { - _1781_renderedName = Dafny.Sequence.UnicodeFromString("add"); - goto after_match35; - } - _1781_renderedName = Dafny.Sequence.UnicodeFromString("build"); - after_match35: ; - DAST._IExpression _source80 = _1764_on; - if (_source80.is_Companion) { { - _1768_onExpr = (_1768_onExpr).MSel(_1781_renderedName); + { + _1768_onExpr = (_1768_onExpr).Sel(_1781_renderedName); + } } - goto after_match36; + after_match36: ; + r = _1768_onExpr; + if ((new BigInteger((_1771_typeExprs).Count)).Sign == 1) { + r = (r).ApplyType(_1771_typeExprs); + } + r = (r).Apply(_1774_argExprs); + RAST._IExpr _out503; + DCOMP._IOwnership _out504; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out503, out _out504); + r = _out503; + resultingOwnership = _out504; + return ; } - { - _1768_onExpr = (_1768_onExpr).Sel(_1781_renderedName); - } - after_match36: ; - r = _1768_onExpr; - if ((new BigInteger((_1771_typeExprs).Count)).Sign == 1) { - r = (r).ApplyType(_1771_typeExprs); - } - r = (r).Apply(_1774_argExprs); - RAST._IExpr _out503; - DCOMP._IOwnership _out504; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out503, out _out504); - r = _out503; - resultingOwnership = _out504; - return ; + goto after_match30; } - goto after_match30; } - if (_source74.is_Lambda) { - Dafny.ISequence _1783_paramsDafny = _source74.dtor_params; - DAST._IType _1784_retType = _source74.dtor_retType; - Dafny.ISequence _1785_body = _source74.dtor_body; - { - Dafny.ISequence _1786_params; - Dafny.ISequence _out505; - _out505 = (this).GenParams(_1783_paramsDafny); - _1786_params = _out505; - Dafny.ISequence> _1787_paramNames; - _1787_paramNames = Dafny.Sequence>.FromElements(); - Dafny.IMap,RAST._IType> _1788_paramTypesMap; - _1788_paramTypesMap = Dafny.Map, RAST._IType>.FromElements(); - BigInteger _hi37 = new BigInteger((_1786_params).Count); - for (BigInteger _1789_i = BigInteger.Zero; _1789_i < _hi37; _1789_i++) { - Dafny.ISequence _1790_name; - _1790_name = ((_1786_params).Select(_1789_i)).dtor_name; - _1787_paramNames = Dafny.Sequence>.Concat(_1787_paramNames, Dafny.Sequence>.FromElements(_1790_name)); - _1788_paramTypesMap = Dafny.Map, RAST._IType>.Update(_1788_paramTypesMap, _1790_name, ((_1786_params).Select(_1789_i)).dtor_tpe); - } - DCOMP._IEnvironment _1791_env; - _1791_env = DCOMP.Environment.create(_1787_paramNames, _1788_paramTypesMap); - RAST._IExpr _1792_recursiveGen; - Dafny.ISet> _1793_recIdents; - DCOMP._IEnvironment _1794___v147; - RAST._IExpr _out506; - Dafny.ISet> _out507; - DCOMP._IEnvironment _out508; - (this).GenStmts(_1785_body, ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) ? (Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("_this"))) : (Std.Wrappers.Option>.create_None())), _1791_env, true, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")), out _out506, out _out507, out _out508); - _1792_recursiveGen = _out506; - _1793_recIdents = _out507; - _1794___v147 = _out508; - readIdents = Dafny.Set>.FromElements(); - _1793_recIdents = Dafny.Set>.Difference(_1793_recIdents, Dafny.Helpers.Id>, Dafny.ISet>>>((_1795_paramNames) => ((System.Func>>)(() => { - var _coll6 = new System.Collections.Generic.List>(); - foreach (Dafny.ISequence _compr_6 in (_1795_paramNames).CloneAsArray()) { - Dafny.ISequence _1796_name = (Dafny.ISequence)_compr_6; - if ((_1795_paramNames).Contains(_1796_name)) { - _coll6.Add(_1796_name); - } + { + if (_source74.is_Lambda) { + Dafny.ISequence _1783_paramsDafny = _source74.dtor_params; + DAST._IType _1784_retType = _source74.dtor_retType; + Dafny.ISequence _1785_body = _source74.dtor_body; + { + Dafny.ISequence _1786_params; + Dafny.ISequence _out505; + _out505 = (this).GenParams(_1783_paramsDafny); + _1786_params = _out505; + Dafny.ISequence> _1787_paramNames; + _1787_paramNames = Dafny.Sequence>.FromElements(); + Dafny.IMap,RAST._IType> _1788_paramTypesMap; + _1788_paramTypesMap = Dafny.Map, RAST._IType>.FromElements(); + BigInteger _hi37 = new BigInteger((_1786_params).Count); + for (BigInteger _1789_i = BigInteger.Zero; _1789_i < _hi37; _1789_i++) { + Dafny.ISequence _1790_name; + _1790_name = ((_1786_params).Select(_1789_i)).dtor_name; + _1787_paramNames = Dafny.Sequence>.Concat(_1787_paramNames, Dafny.Sequence>.FromElements(_1790_name)); + _1788_paramTypesMap = Dafny.Map, RAST._IType>.Update(_1788_paramTypesMap, _1790_name, ((_1786_params).Select(_1789_i)).dtor_tpe); } - return Dafny.Set>.FromCollection(_coll6); - }))())(_1787_paramNames)); - RAST._IExpr _1797_allReadCloned; - _1797_allReadCloned = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); - while (!(_1793_recIdents).Equals(Dafny.Set>.FromElements())) { - Dafny.ISequence _1798_next; - foreach (Dafny.ISequence _assign_such_that_3 in (_1793_recIdents).Elements) { - _1798_next = (Dafny.ISequence)_assign_such_that_3; - if ((_1793_recIdents).Contains(_1798_next)) { - goto after__ASSIGN_SUCH_THAT_3; + DCOMP._IEnvironment _1791_env; + _1791_env = DCOMP.Environment.create(_1787_paramNames, _1788_paramTypesMap); + RAST._IExpr _1792_recursiveGen; + Dafny.ISet> _1793_recIdents; + DCOMP._IEnvironment _1794___v147; + RAST._IExpr _out506; + Dafny.ISet> _out507; + DCOMP._IEnvironment _out508; + (this).GenStmts(_1785_body, ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) ? (Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("_this"))) : (Std.Wrappers.Option>.create_None())), _1791_env, true, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")), out _out506, out _out507, out _out508); + _1792_recursiveGen = _out506; + _1793_recIdents = _out507; + _1794___v147 = _out508; + readIdents = Dafny.Set>.FromElements(); + _1793_recIdents = Dafny.Set>.Difference(_1793_recIdents, Dafny.Helpers.Id>, Dafny.ISet>>>((_1795_paramNames) => ((System.Func>>)(() => { + var _coll6 = new System.Collections.Generic.List>(); + foreach (Dafny.ISequence _compr_6 in (_1795_paramNames).CloneAsArray()) { + Dafny.ISequence _1796_name = (Dafny.ISequence)_compr_6; + if ((_1795_paramNames).Contains(_1796_name)) { + _coll6.Add(_1796_name); + } } - } - throw new System.Exception("assign-such-that search produced no value (line 3735)"); - after__ASSIGN_SUCH_THAT_3: ; - if ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) && ((_1798_next).Equals(Dafny.Sequence.UnicodeFromString("_this")))) { - if (!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) { - _1797_allReadCloned = (_1797_allReadCloned).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), Dafny.Sequence.UnicodeFromString("_this"), Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.__default.self).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); + return Dafny.Set>.FromCollection(_coll6); + }))())(_1787_paramNames)); + RAST._IExpr _1797_allReadCloned; + _1797_allReadCloned = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); + while (!(_1793_recIdents).Equals(Dafny.Set>.FromElements())) { + Dafny.ISequence _1798_next; + foreach (Dafny.ISequence _assign_such_that_3 in (_1793_recIdents).Elements) { + _1798_next = (Dafny.ISequence)_assign_such_that_3; + if ((_1793_recIdents).Contains(_1798_next)) { + goto after__ASSIGN_SUCH_THAT_3; + } } - } else if (!((_1787_paramNames).Contains(_1798_next))) { - _1797_allReadCloned = (_1797_allReadCloned).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), _1798_next, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.Expr.create_Identifier(_1798_next)).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); - readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.FromElements(_1798_next)); + throw new System.Exception("assign-such-that search produced no value (line 3735)"); + after__ASSIGN_SUCH_THAT_3: ; + if ((!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) && ((_1798_next).Equals(Dafny.Sequence.UnicodeFromString("_this")))) { + if (!object.Equals(selfIdent, Std.Wrappers.Option>.create_None())) { + _1797_allReadCloned = (_1797_allReadCloned).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), Dafny.Sequence.UnicodeFromString("_this"), Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.__default.self).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); + } + } else if (!((_1787_paramNames).Contains(_1798_next))) { + _1797_allReadCloned = (_1797_allReadCloned).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), _1798_next, Std.Wrappers.Option.create_None(), Std.Wrappers.Option.create_Some(((RAST.Expr.create_Identifier(_1798_next)).Sel(Dafny.Sequence.UnicodeFromString("clone"))).Apply(Dafny.Sequence.FromElements())))); + readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.FromElements(_1798_next)); + } + _1793_recIdents = Dafny.Set>.Difference(_1793_recIdents, Dafny.Set>.FromElements(_1798_next)); } - _1793_recIdents = Dafny.Set>.Difference(_1793_recIdents, Dafny.Set>.FromElements(_1798_next)); - } - RAST._IType _1799_retTypeGen; - RAST._IType _out509; - _out509 = (this).GenType(_1784_retType, false, true); - _1799_retTypeGen = _out509; - r = RAST.Expr.create_Block((_1797_allReadCloned).Then(RAST.__default.RcNew(RAST.Expr.create_Lambda(_1786_params, Std.Wrappers.Option.create_Some(_1799_retTypeGen), RAST.Expr.create_Block(_1792_recursiveGen))))); - RAST._IExpr _out510; - DCOMP._IOwnership _out511; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out510, out _out511); - r = _out510; - resultingOwnership = _out511; - return ; + RAST._IType _1799_retTypeGen; + RAST._IType _out509; + _out509 = (this).GenType(_1784_retType, false, true); + _1799_retTypeGen = _out509; + r = RAST.Expr.create_Block((_1797_allReadCloned).Then(RAST.__default.RcNew(RAST.Expr.create_Lambda(_1786_params, Std.Wrappers.Option.create_Some(_1799_retTypeGen), RAST.Expr.create_Block(_1792_recursiveGen))))); + RAST._IExpr _out510; + DCOMP._IOwnership _out511; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out510, out _out511); + r = _out510; + resultingOwnership = _out511; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_BetaRedex) { - Dafny.ISequence<_System._ITuple2> _1800_values = _source74.dtor_values; - DAST._IType _1801_retType = _source74.dtor_retType; - DAST._IExpression _1802_expr = _source74.dtor_expr; - { - Dafny.ISequence> _1803_paramNames; - _1803_paramNames = Dafny.Sequence>.FromElements(); - Dafny.ISequence _1804_paramFormals; - Dafny.ISequence _out512; - _out512 = (this).GenParams(Std.Collections.Seq.__default.Map<_System._ITuple2, DAST._IFormal>(((System.Func<_System._ITuple2, DAST._IFormal>)((_1805_value) => { - return (_1805_value).dtor__0; - })), _1800_values)); - _1804_paramFormals = _out512; - Dafny.IMap,RAST._IType> _1806_paramTypes; - _1806_paramTypes = Dafny.Map, RAST._IType>.FromElements(); - Dafny.ISet> _1807_paramNamesSet; - _1807_paramNamesSet = Dafny.Set>.FromElements(); - BigInteger _hi38 = new BigInteger((_1800_values).Count); - for (BigInteger _1808_i = BigInteger.Zero; _1808_i < _hi38; _1808_i++) { - Dafny.ISequence _1809_name; - _1809_name = (((_1800_values).Select(_1808_i)).dtor__0).dtor_name; - Dafny.ISequence _1810_rName; - _1810_rName = DCOMP.__default.escapeName(_1809_name); - _1803_paramNames = Dafny.Sequence>.Concat(_1803_paramNames, Dafny.Sequence>.FromElements(_1810_rName)); - _1806_paramTypes = Dafny.Map, RAST._IType>.Update(_1806_paramTypes, _1810_rName, ((_1804_paramFormals).Select(_1808_i)).dtor_tpe); - _1807_paramNamesSet = Dafny.Set>.Union(_1807_paramNamesSet, Dafny.Set>.FromElements(_1810_rName)); + { + if (_source74.is_BetaRedex) { + Dafny.ISequence<_System._ITuple2> _1800_values = _source74.dtor_values; + DAST._IType _1801_retType = _source74.dtor_retType; + DAST._IExpression _1802_expr = _source74.dtor_expr; + { + Dafny.ISequence> _1803_paramNames; + _1803_paramNames = Dafny.Sequence>.FromElements(); + Dafny.ISequence _1804_paramFormals; + Dafny.ISequence _out512; + _out512 = (this).GenParams(Std.Collections.Seq.__default.Map<_System._ITuple2, DAST._IFormal>(((System.Func<_System._ITuple2, DAST._IFormal>)((_1805_value) => { + return (_1805_value).dtor__0; + })), _1800_values)); + _1804_paramFormals = _out512; + Dafny.IMap,RAST._IType> _1806_paramTypes; + _1806_paramTypes = Dafny.Map, RAST._IType>.FromElements(); + Dafny.ISet> _1807_paramNamesSet; + _1807_paramNamesSet = Dafny.Set>.FromElements(); + BigInteger _hi38 = new BigInteger((_1800_values).Count); + for (BigInteger _1808_i = BigInteger.Zero; _1808_i < _hi38; _1808_i++) { + Dafny.ISequence _1809_name; + _1809_name = (((_1800_values).Select(_1808_i)).dtor__0).dtor_name; + Dafny.ISequence _1810_rName; + _1810_rName = DCOMP.__default.escapeName(_1809_name); + _1803_paramNames = Dafny.Sequence>.Concat(_1803_paramNames, Dafny.Sequence>.FromElements(_1810_rName)); + _1806_paramTypes = Dafny.Map, RAST._IType>.Update(_1806_paramTypes, _1810_rName, ((_1804_paramFormals).Select(_1808_i)).dtor_tpe); + _1807_paramNamesSet = Dafny.Set>.Union(_1807_paramNamesSet, Dafny.Set>.FromElements(_1810_rName)); + } + readIdents = Dafny.Set>.FromElements(); + r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); + BigInteger _hi39 = new BigInteger((_1800_values).Count); + for (BigInteger _1811_i = BigInteger.Zero; _1811_i < _hi39; _1811_i++) { + RAST._IType _1812_typeGen; + RAST._IType _out513; + _out513 = (this).GenType((((_1800_values).Select(_1811_i)).dtor__0).dtor_typ, false, true); + _1812_typeGen = _out513; + RAST._IExpr _1813_valueGen; + DCOMP._IOwnership _1814___v148; + Dafny.ISet> _1815_recIdents; + RAST._IExpr _out514; + DCOMP._IOwnership _out515; + Dafny.ISet> _out516; + (this).GenExpr(((_1800_values).Select(_1811_i)).dtor__1, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out514, out _out515, out _out516); + _1813_valueGen = _out514; + _1814___v148 = _out515; + _1815_recIdents = _out516; + r = (r).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), DCOMP.__default.escapeName((((_1800_values).Select(_1811_i)).dtor__0).dtor_name), Std.Wrappers.Option.create_Some(_1812_typeGen), Std.Wrappers.Option.create_Some(_1813_valueGen))); + readIdents = Dafny.Set>.Union(readIdents, _1815_recIdents); + } + DCOMP._IEnvironment _1816_newEnv; + _1816_newEnv = DCOMP.Environment.create(_1803_paramNames, _1806_paramTypes); + RAST._IExpr _1817_recGen; + DCOMP._IOwnership _1818_recOwned; + Dafny.ISet> _1819_recIdents; + RAST._IExpr _out517; + DCOMP._IOwnership _out518; + Dafny.ISet> _out519; + (this).GenExpr(_1802_expr, selfIdent, _1816_newEnv, expectedOwnership, out _out517, out _out518, out _out519); + _1817_recGen = _out517; + _1818_recOwned = _out518; + _1819_recIdents = _out519; + readIdents = Dafny.Set>.Difference(_1819_recIdents, _1807_paramNamesSet); + r = RAST.Expr.create_Block((r).Then(_1817_recGen)); + RAST._IExpr _out520; + DCOMP._IOwnership _out521; + DCOMP.COMP.FromOwnership(r, _1818_recOwned, expectedOwnership, out _out520, out _out521); + r = _out520; + resultingOwnership = _out521; + return ; } - readIdents = Dafny.Set>.FromElements(); - r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); - BigInteger _hi39 = new BigInteger((_1800_values).Count); - for (BigInteger _1811_i = BigInteger.Zero; _1811_i < _hi39; _1811_i++) { - RAST._IType _1812_typeGen; - RAST._IType _out513; - _out513 = (this).GenType((((_1800_values).Select(_1811_i)).dtor__0).dtor_typ, false, true); - _1812_typeGen = _out513; - RAST._IExpr _1813_valueGen; - DCOMP._IOwnership _1814___v148; - Dafny.ISet> _1815_recIdents; - RAST._IExpr _out514; - DCOMP._IOwnership _out515; - Dafny.ISet> _out516; - (this).GenExpr(((_1800_values).Select(_1811_i)).dtor__1, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out514, out _out515, out _out516); - _1813_valueGen = _out514; - _1814___v148 = _out515; - _1815_recIdents = _out516; - r = (r).Then(RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), DCOMP.__default.escapeName((((_1800_values).Select(_1811_i)).dtor__0).dtor_name), Std.Wrappers.Option.create_Some(_1812_typeGen), Std.Wrappers.Option.create_Some(_1813_valueGen))); - readIdents = Dafny.Set>.Union(readIdents, _1815_recIdents); - } - DCOMP._IEnvironment _1816_newEnv; - _1816_newEnv = DCOMP.Environment.create(_1803_paramNames, _1806_paramTypes); - RAST._IExpr _1817_recGen; - DCOMP._IOwnership _1818_recOwned; - Dafny.ISet> _1819_recIdents; - RAST._IExpr _out517; - DCOMP._IOwnership _out518; - Dafny.ISet> _out519; - (this).GenExpr(_1802_expr, selfIdent, _1816_newEnv, expectedOwnership, out _out517, out _out518, out _out519); - _1817_recGen = _out517; - _1818_recOwned = _out518; - _1819_recIdents = _out519; - readIdents = Dafny.Set>.Difference(_1819_recIdents, _1807_paramNamesSet); - r = RAST.Expr.create_Block((r).Then(_1817_recGen)); - RAST._IExpr _out520; - DCOMP._IOwnership _out521; - DCOMP.COMP.FromOwnership(r, _1818_recOwned, expectedOwnership, out _out520, out _out521); - r = _out520; - resultingOwnership = _out521; - return ; + goto after_match30; } - goto after_match30; } - if (_source74.is_IIFE) { - Dafny.ISequence _1820_name = _source74.dtor_name; - DAST._IType _1821_tpe = _source74.dtor_typ; - DAST._IExpression _1822_value = _source74.dtor_value; - DAST._IExpression _1823_iifeBody = _source74.dtor_iifeBody; - { - RAST._IExpr _1824_valueGen; - DCOMP._IOwnership _1825___v149; - Dafny.ISet> _1826_recIdents; - RAST._IExpr _out522; - DCOMP._IOwnership _out523; - Dafny.ISet> _out524; - (this).GenExpr(_1822_value, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out522, out _out523, out _out524); - _1824_valueGen = _out522; - _1825___v149 = _out523; - _1826_recIdents = _out524; - readIdents = _1826_recIdents; - RAST._IType _1827_valueTypeGen; - RAST._IType _out525; - _out525 = (this).GenType(_1821_tpe, false, true); - _1827_valueTypeGen = _out525; - RAST._IExpr _1828_bodyGen; - DCOMP._IOwnership _1829___v150; - Dafny.ISet> _1830_bodyIdents; - RAST._IExpr _out526; - DCOMP._IOwnership _out527; - Dafny.ISet> _out528; - (this).GenExpr(_1823_iifeBody, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out526, out _out527, out _out528); - _1828_bodyGen = _out526; - _1829___v150 = _out527; - _1830_bodyIdents = _out528; - readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.Difference(_1830_bodyIdents, Dafny.Set>.FromElements(DCOMP.__default.escapeName((_1820_name))))); - r = RAST.Expr.create_Block((RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), DCOMP.__default.escapeName((_1820_name)), Std.Wrappers.Option.create_Some(_1827_valueTypeGen), Std.Wrappers.Option.create_Some(_1824_valueGen))).Then(_1828_bodyGen)); - RAST._IExpr _out529; - DCOMP._IOwnership _out530; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out529, out _out530); - r = _out529; - resultingOwnership = _out530; - return ; + { + if (_source74.is_IIFE) { + Dafny.ISequence _1820_name = _source74.dtor_name; + DAST._IType _1821_tpe = _source74.dtor_typ; + DAST._IExpression _1822_value = _source74.dtor_value; + DAST._IExpression _1823_iifeBody = _source74.dtor_iifeBody; + { + RAST._IExpr _1824_valueGen; + DCOMP._IOwnership _1825___v149; + Dafny.ISet> _1826_recIdents; + RAST._IExpr _out522; + DCOMP._IOwnership _out523; + Dafny.ISet> _out524; + (this).GenExpr(_1822_value, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out522, out _out523, out _out524); + _1824_valueGen = _out522; + _1825___v149 = _out523; + _1826_recIdents = _out524; + readIdents = _1826_recIdents; + RAST._IType _1827_valueTypeGen; + RAST._IType _out525; + _out525 = (this).GenType(_1821_tpe, false, true); + _1827_valueTypeGen = _out525; + RAST._IExpr _1828_bodyGen; + DCOMP._IOwnership _1829___v150; + Dafny.ISet> _1830_bodyIdents; + RAST._IExpr _out526; + DCOMP._IOwnership _out527; + Dafny.ISet> _out528; + (this).GenExpr(_1823_iifeBody, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out526, out _out527, out _out528); + _1828_bodyGen = _out526; + _1829___v150 = _out527; + _1830_bodyIdents = _out528; + readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.Difference(_1830_bodyIdents, Dafny.Set>.FromElements(DCOMP.__default.escapeName((_1820_name))))); + r = RAST.Expr.create_Block((RAST.Expr.create_DeclareVar(RAST.DeclareType.create_CONST(), DCOMP.__default.escapeName((_1820_name)), Std.Wrappers.Option.create_Some(_1827_valueTypeGen), Std.Wrappers.Option.create_Some(_1824_valueGen))).Then(_1828_bodyGen)); + RAST._IExpr _out529; + DCOMP._IOwnership _out530; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out529, out _out530); + r = _out529; + resultingOwnership = _out530; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_Apply) { - DAST._IExpression _1831_func = _source74.dtor_expr; - Dafny.ISequence _1832_args = _source74.dtor_args; - { - RAST._IExpr _1833_funcExpr; - DCOMP._IOwnership _1834___v151; - Dafny.ISet> _1835_recIdents; - RAST._IExpr _out531; - DCOMP._IOwnership _out532; - Dafny.ISet> _out533; - (this).GenExpr(_1831_func, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out531, out _out532, out _out533); - _1833_funcExpr = _out531; - _1834___v151 = _out532; - _1835_recIdents = _out533; - readIdents = _1835_recIdents; - Dafny.ISequence _1836_rArgs; - _1836_rArgs = Dafny.Sequence.FromElements(); - BigInteger _hi40 = new BigInteger((_1832_args).Count); - for (BigInteger _1837_i = BigInteger.Zero; _1837_i < _hi40; _1837_i++) { - RAST._IExpr _1838_argExpr; - DCOMP._IOwnership _1839_argOwned; - Dafny.ISet> _1840_argIdents; - RAST._IExpr _out534; - DCOMP._IOwnership _out535; - Dafny.ISet> _out536; - (this).GenExpr((_1832_args).Select(_1837_i), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out534, out _out535, out _out536); - _1838_argExpr = _out534; - _1839_argOwned = _out535; - _1840_argIdents = _out536; - _1836_rArgs = Dafny.Sequence.Concat(_1836_rArgs, Dafny.Sequence.FromElements(_1838_argExpr)); - readIdents = Dafny.Set>.Union(readIdents, _1840_argIdents); - } - r = (_1833_funcExpr).Apply(_1836_rArgs); - RAST._IExpr _out537; - DCOMP._IOwnership _out538; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out537, out _out538); - r = _out537; - resultingOwnership = _out538; - return ; + { + if (_source74.is_Apply) { + DAST._IExpression _1831_func = _source74.dtor_expr; + Dafny.ISequence _1832_args = _source74.dtor_args; + { + RAST._IExpr _1833_funcExpr; + DCOMP._IOwnership _1834___v151; + Dafny.ISet> _1835_recIdents; + RAST._IExpr _out531; + DCOMP._IOwnership _out532; + Dafny.ISet> _out533; + (this).GenExpr(_1831_func, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out531, out _out532, out _out533); + _1833_funcExpr = _out531; + _1834___v151 = _out532; + _1835_recIdents = _out533; + readIdents = _1835_recIdents; + Dafny.ISequence _1836_rArgs; + _1836_rArgs = Dafny.Sequence.FromElements(); + BigInteger _hi40 = new BigInteger((_1832_args).Count); + for (BigInteger _1837_i = BigInteger.Zero; _1837_i < _hi40; _1837_i++) { + RAST._IExpr _1838_argExpr; + DCOMP._IOwnership _1839_argOwned; + Dafny.ISet> _1840_argIdents; + RAST._IExpr _out534; + DCOMP._IOwnership _out535; + Dafny.ISet> _out536; + (this).GenExpr((_1832_args).Select(_1837_i), selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out534, out _out535, out _out536); + _1838_argExpr = _out534; + _1839_argOwned = _out535; + _1840_argIdents = _out536; + _1836_rArgs = Dafny.Sequence.Concat(_1836_rArgs, Dafny.Sequence.FromElements(_1838_argExpr)); + readIdents = Dafny.Set>.Union(readIdents, _1840_argIdents); + } + r = (_1833_funcExpr).Apply(_1836_rArgs); + RAST._IExpr _out537; + DCOMP._IOwnership _out538; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out537, out _out538); + r = _out537; + resultingOwnership = _out538; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_TypeTest) { - DAST._IExpression _1841_on = _source74.dtor_on; - Dafny.ISequence> _1842_dType = _source74.dtor_dType; - Dafny.ISequence _1843_variant = _source74.dtor_variant; - { - RAST._IExpr _1844_exprGen; - DCOMP._IOwnership _1845___v152; - Dafny.ISet> _1846_recIdents; - RAST._IExpr _out539; - DCOMP._IOwnership _out540; - Dafny.ISet> _out541; - (this).GenExpr(_1841_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out539, out _out540, out _out541); - _1844_exprGen = _out539; - _1845___v152 = _out540; - _1846_recIdents = _out541; - RAST._IType _1847_dTypePath; - RAST._IType _out542; - _out542 = DCOMP.COMP.GenPath(_1842_dType); - _1847_dTypePath = _out542; - r = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("matches!"))).Apply(Dafny.Sequence.FromElements(((_1844_exprGen).Sel(Dafny.Sequence.UnicodeFromString("as_ref"))).Apply(Dafny.Sequence.FromElements()), RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(((_1847_dTypePath).MSel(DCOMP.__default.escapeName(_1843_variant)))._ToString(DCOMP.__default.IND), Dafny.Sequence.UnicodeFromString("{ .. }"))))); - RAST._IExpr _out543; - DCOMP._IOwnership _out544; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out543, out _out544); - r = _out543; - resultingOwnership = _out544; - readIdents = _1846_recIdents; - return ; + { + if (_source74.is_TypeTest) { + DAST._IExpression _1841_on = _source74.dtor_on; + Dafny.ISequence> _1842_dType = _source74.dtor_dType; + Dafny.ISequence _1843_variant = _source74.dtor_variant; + { + RAST._IExpr _1844_exprGen; + DCOMP._IOwnership _1845___v152; + Dafny.ISet> _1846_recIdents; + RAST._IExpr _out539; + DCOMP._IOwnership _out540; + Dafny.ISet> _out541; + (this).GenExpr(_1841_on, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out539, out _out540, out _out541); + _1844_exprGen = _out539; + _1845___v152 = _out540; + _1846_recIdents = _out541; + RAST._IType _1847_dTypePath; + RAST._IType _out542; + _out542 = DCOMP.COMP.GenPath(_1842_dType); + _1847_dTypePath = _out542; + r = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("matches!"))).Apply(Dafny.Sequence.FromElements(((_1844_exprGen).Sel(Dafny.Sequence.UnicodeFromString("as_ref"))).Apply(Dafny.Sequence.FromElements()), RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(((_1847_dTypePath).MSel(DCOMP.__default.escapeName(_1843_variant)))._ToString(DCOMP.__default.IND), Dafny.Sequence.UnicodeFromString("{ .. }"))))); + RAST._IExpr _out543; + DCOMP._IOwnership _out544; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out543, out _out544); + r = _out543; + resultingOwnership = _out544; + readIdents = _1846_recIdents; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_BoolBoundedPool) { - { - r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("[false, true]")); - RAST._IExpr _out545; - DCOMP._IOwnership _out546; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out545, out _out546); - r = _out545; - resultingOwnership = _out546; - readIdents = Dafny.Set>.FromElements(); - return ; + { + if (_source74.is_BoolBoundedPool) { + { + r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("[false, true]")); + RAST._IExpr _out545; + DCOMP._IOwnership _out546; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out545, out _out546); + r = _out545; + resultingOwnership = _out546; + readIdents = Dafny.Set>.FromElements(); + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_SetBoundedPool) { - DAST._IExpression _1848_of = _source74.dtor_of; - { - RAST._IExpr _1849_exprGen; - DCOMP._IOwnership _1850___v153; - Dafny.ISet> _1851_recIdents; - RAST._IExpr _out547; - DCOMP._IOwnership _out548; - Dafny.ISet> _out549; - (this).GenExpr(_1848_of, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out547, out _out548, out _out549); - _1849_exprGen = _out547; - _1850___v153 = _out548; - _1851_recIdents = _out549; - r = ((((_1849_exprGen).Sel(Dafny.Sequence.UnicodeFromString("iter"))).Apply(Dafny.Sequence.FromElements())).Sel(Dafny.Sequence.UnicodeFromString("cloned"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out550; - DCOMP._IOwnership _out551; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out550, out _out551); - r = _out550; - resultingOwnership = _out551; - readIdents = _1851_recIdents; - return ; + { + if (_source74.is_SetBoundedPool) { + DAST._IExpression _1848_of = _source74.dtor_of; + { + RAST._IExpr _1849_exprGen; + DCOMP._IOwnership _1850___v153; + Dafny.ISet> _1851_recIdents; + RAST._IExpr _out547; + DCOMP._IOwnership _out548; + Dafny.ISet> _out549; + (this).GenExpr(_1848_of, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out547, out _out548, out _out549); + _1849_exprGen = _out547; + _1850___v153 = _out548; + _1851_recIdents = _out549; + r = ((((_1849_exprGen).Sel(Dafny.Sequence.UnicodeFromString("iter"))).Apply(Dafny.Sequence.FromElements())).Sel(Dafny.Sequence.UnicodeFromString("cloned"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out550; + DCOMP._IOwnership _out551; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out550, out _out551); + r = _out550; + resultingOwnership = _out551; + readIdents = _1851_recIdents; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_SeqBoundedPool) { - DAST._IExpression _1852_of = _source74.dtor_of; - bool _1853_includeDuplicates = _source74.dtor_includeDuplicates; - { - RAST._IExpr _1854_exprGen; - DCOMP._IOwnership _1855___v154; - Dafny.ISet> _1856_recIdents; - RAST._IExpr _out552; - DCOMP._IOwnership _out553; - Dafny.ISet> _out554; - (this).GenExpr(_1852_of, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out552, out _out553, out _out554); - _1854_exprGen = _out552; - _1855___v154 = _out553; - _1856_recIdents = _out554; - r = ((_1854_exprGen).Sel(Dafny.Sequence.UnicodeFromString("iter"))).Apply(Dafny.Sequence.FromElements()); - if (!(_1853_includeDuplicates)) { - r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("itertools"))).MSel(Dafny.Sequence.UnicodeFromString("Itertools"))).MSel(Dafny.Sequence.UnicodeFromString("unique"))).Apply1(r); - } - RAST._IExpr _out555; - DCOMP._IOwnership _out556; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out555, out _out556); - r = _out555; - resultingOwnership = _out556; - readIdents = _1856_recIdents; - return ; + { + if (_source74.is_SeqBoundedPool) { + DAST._IExpression _1852_of = _source74.dtor_of; + bool _1853_includeDuplicates = _source74.dtor_includeDuplicates; + { + RAST._IExpr _1854_exprGen; + DCOMP._IOwnership _1855___v154; + Dafny.ISet> _1856_recIdents; + RAST._IExpr _out552; + DCOMP._IOwnership _out553; + Dafny.ISet> _out554; + (this).GenExpr(_1852_of, selfIdent, env, DCOMP.Ownership.create_OwnershipBorrowed(), out _out552, out _out553, out _out554); + _1854_exprGen = _out552; + _1855___v154 = _out553; + _1856_recIdents = _out554; + r = ((_1854_exprGen).Sel(Dafny.Sequence.UnicodeFromString("iter"))).Apply(Dafny.Sequence.FromElements()); + if (!(_1853_includeDuplicates)) { + r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("itertools"))).MSel(Dafny.Sequence.UnicodeFromString("Itertools"))).MSel(Dafny.Sequence.UnicodeFromString("unique"))).Apply1(r); + } + RAST._IExpr _out555; + DCOMP._IOwnership _out556; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out555, out _out556); + r = _out555; + resultingOwnership = _out556; + readIdents = _1856_recIdents; + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_IntRange) { - DAST._IExpression _1857_lo = _source74.dtor_lo; - DAST._IExpression _1858_hi = _source74.dtor_hi; - { - RAST._IExpr _1859_lo; - DCOMP._IOwnership _1860___v155; - Dafny.ISet> _1861_recIdentsLo; - RAST._IExpr _out557; - DCOMP._IOwnership _out558; - Dafny.ISet> _out559; - (this).GenExpr(_1857_lo, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out557, out _out558, out _out559); - _1859_lo = _out557; - _1860___v155 = _out558; - _1861_recIdentsLo = _out559; - RAST._IExpr _1862_hi; - DCOMP._IOwnership _1863___v156; - Dafny.ISet> _1864_recIdentsHi; - RAST._IExpr _out560; - DCOMP._IOwnership _out561; - Dafny.ISet> _out562; - (this).GenExpr(_1858_hi, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out560, out _out561, out _out562); - _1862_hi = _out560; - _1863___v156 = _out561; - _1864_recIdentsHi = _out562; - r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("integer_range"))).Apply(Dafny.Sequence.FromElements(_1859_lo, _1862_hi)); - RAST._IExpr _out563; - DCOMP._IOwnership _out564; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out563, out _out564); - r = _out563; - resultingOwnership = _out564; - readIdents = Dafny.Set>.Union(_1861_recIdentsLo, _1864_recIdentsHi); - return ; + { + if (_source74.is_IntRange) { + DAST._IExpression _1857_lo = _source74.dtor_lo; + DAST._IExpression _1858_hi = _source74.dtor_hi; + { + RAST._IExpr _1859_lo; + DCOMP._IOwnership _1860___v155; + Dafny.ISet> _1861_recIdentsLo; + RAST._IExpr _out557; + DCOMP._IOwnership _out558; + Dafny.ISet> _out559; + (this).GenExpr(_1857_lo, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out557, out _out558, out _out559); + _1859_lo = _out557; + _1860___v155 = _out558; + _1861_recIdentsLo = _out559; + RAST._IExpr _1862_hi; + DCOMP._IOwnership _1863___v156; + Dafny.ISet> _1864_recIdentsHi; + RAST._IExpr _out560; + DCOMP._IOwnership _out561; + Dafny.ISet> _out562; + (this).GenExpr(_1858_hi, selfIdent, env, DCOMP.Ownership.create_OwnershipOwned(), out _out560, out _out561, out _out562); + _1862_hi = _out560; + _1863___v156 = _out561; + _1864_recIdentsHi = _out562; + r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("integer_range"))).Apply(Dafny.Sequence.FromElements(_1859_lo, _1862_hi)); + RAST._IExpr _out563; + DCOMP._IOwnership _out564; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out563, out _out564); + r = _out563; + resultingOwnership = _out564; + readIdents = Dafny.Set>.Union(_1861_recIdentsLo, _1864_recIdentsHi); + return ; + } + goto after_match30; } - goto after_match30; } - if (_source74.is_MapBuilder) { - DAST._IType _1865_keyType = _source74.dtor_keyType; - DAST._IType _1866_valueType = _source74.dtor_valueType; + { + if (_source74.is_MapBuilder) { + DAST._IType _1865_keyType = _source74.dtor_keyType; + DAST._IType _1866_valueType = _source74.dtor_valueType; + { + RAST._IType _1867_kType; + RAST._IType _out565; + _out565 = (this).GenType(_1865_keyType, false, false); + _1867_kType = _out565; + RAST._IType _1868_vType; + RAST._IType _out566; + _out566 = (this).GenType(_1866_valueType, false, false); + _1868_vType = _out566; + r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder"))).ApplyType(Dafny.Sequence.FromElements(_1867_kType, _1868_vType))).MSel(Dafny.Sequence.UnicodeFromString("new"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out567; + DCOMP._IOwnership _out568; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out567, out _out568); + r = _out567; + resultingOwnership = _out568; + readIdents = Dafny.Set>.FromElements(); + return ; + } + goto after_match30; + } + } + { + DAST._IType _1869_elemType = _source74.dtor_elemType; { - RAST._IType _1867_kType; - RAST._IType _out565; - _out565 = (this).GenType(_1865_keyType, false, false); - _1867_kType = _out565; - RAST._IType _1868_vType; - RAST._IType _out566; - _out566 = (this).GenType(_1866_valueType, false, false); - _1868_vType = _out566; - r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder"))).ApplyType(Dafny.Sequence.FromElements(_1867_kType, _1868_vType))).MSel(Dafny.Sequence.UnicodeFromString("new"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out567; - DCOMP._IOwnership _out568; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out567, out _out568); - r = _out567; - resultingOwnership = _out568; + RAST._IType _1870_eType; + RAST._IType _out569; + _out569 = (this).GenType(_1869_elemType, false, false); + _1870_eType = _out569; readIdents = Dafny.Set>.FromElements(); + r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder"))).ApplyType(Dafny.Sequence.FromElements(_1870_eType))).MSel(Dafny.Sequence.UnicodeFromString("new"))).Apply(Dafny.Sequence.FromElements()); + RAST._IExpr _out570; + DCOMP._IOwnership _out571; + DCOMP.COMP.FromOwned(r, expectedOwnership, out _out570, out _out571); + r = _out570; + resultingOwnership = _out571; return ; } - goto after_match30; - } - DAST._IType _1869_elemType = _source74.dtor_elemType; - { - RAST._IType _1870_eType; - RAST._IType _out569; - _out569 = (this).GenType(_1869_elemType, false, false); - _1870_eType = _out569; - readIdents = Dafny.Set>.FromElements(); - r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder"))).ApplyType(Dafny.Sequence.FromElements(_1870_eType))).MSel(Dafny.Sequence.UnicodeFromString("new"))).Apply(Dafny.Sequence.FromElements()); - RAST._IExpr _out570; - DCOMP._IOwnership _out571; - DCOMP.COMP.FromOwned(r, expectedOwnership, out _out570, out _out571); - r = _out570; - resultingOwnership = _out571; - return ; } after_match30: ; } diff --git a/Source/DafnyCore/GeneratedFromDafny/RAST.cs b/Source/DafnyCore/GeneratedFromDafny/RAST.cs index fe12d66eaa9..646fccaae13 100644 --- a/Source/DafnyCore/GeneratedFromDafny/RAST.cs +++ b/Source/DafnyCore/GeneratedFromDafny/RAST.cs @@ -53,35 +53,37 @@ public static RAST._IExpr BoxNew(RAST._IExpr content) { public static bool IsImmutableConversion(RAST._IType fromTpe, RAST._IType toTpe) { _System._ITuple2 _source25 = _System.Tuple2.create(fromTpe, toTpe); - RAST._IType _00 = _source25.dtor__0; - if (_00.is_TypeApp) { - RAST._IType baseName0 = _00.dtor_baseName; - if (baseName0.is_TMemberSelect) { - RAST._IType base0 = baseName0.dtor_base; - if (base0.is_TMemberSelect) { - RAST._IType base1 = base0.dtor_base; - if (base1.is_TIdentifier) { - Dafny.ISequence name0 = base1.dtor_name; - if (object.Equals(name0, Dafny.Sequence.UnicodeFromString(""))) { - Dafny.ISequence name1 = base0.dtor_name; - if (object.Equals(name1, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { - Dafny.ISequence _761_tpe1 = baseName0.dtor_name; - Dafny.ISequence _762_elems1 = _00.dtor_arguments; - RAST._IType _10 = _source25.dtor__1; - if (_10.is_TypeApp) { - RAST._IType baseName1 = _10.dtor_baseName; - if (baseName1.is_TMemberSelect) { - RAST._IType base2 = baseName1.dtor_base; - if (base2.is_TMemberSelect) { - RAST._IType base3 = base2.dtor_base; - if (base3.is_TIdentifier) { - Dafny.ISequence name2 = base3.dtor_name; - if (object.Equals(name2, Dafny.Sequence.UnicodeFromString(""))) { - Dafny.ISequence name3 = base2.dtor_name; - if (object.Equals(name3, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { - Dafny.ISequence _763_tpe2 = baseName1.dtor_name; - Dafny.ISequence _764_elems2 = _10.dtor_arguments; - return ((_761_tpe1).Equals(_763_tpe2)) && (((((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Set"))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Sequence")))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Multiset")))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Map")))); + { + RAST._IType _00 = _source25.dtor__0; + if (_00.is_TypeApp) { + RAST._IType baseName0 = _00.dtor_baseName; + if (baseName0.is_TMemberSelect) { + RAST._IType base0 = baseName0.dtor_base; + if (base0.is_TMemberSelect) { + RAST._IType base1 = base0.dtor_base; + if (base1.is_TIdentifier) { + Dafny.ISequence name0 = base1.dtor_name; + if (object.Equals(name0, Dafny.Sequence.UnicodeFromString(""))) { + Dafny.ISequence name1 = base0.dtor_name; + if (object.Equals(name1, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { + Dafny.ISequence _761_tpe1 = baseName0.dtor_name; + Dafny.ISequence _762_elems1 = _00.dtor_arguments; + RAST._IType _10 = _source25.dtor__1; + if (_10.is_TypeApp) { + RAST._IType baseName1 = _10.dtor_baseName; + if (baseName1.is_TMemberSelect) { + RAST._IType base2 = baseName1.dtor_base; + if (base2.is_TMemberSelect) { + RAST._IType base3 = base2.dtor_base; + if (base3.is_TIdentifier) { + Dafny.ISequence name2 = base3.dtor_name; + if (object.Equals(name2, Dafny.Sequence.UnicodeFromString(""))) { + Dafny.ISequence name3 = base2.dtor_name; + if (object.Equals(name3, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { + Dafny.ISequence _763_tpe2 = baseName1.dtor_name; + Dafny.ISequence _764_elems2 = _10.dtor_arguments; + return ((_761_tpe1).Equals(_763_tpe2)) && (((((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Set"))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Sequence")))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Multiset")))) || ((_761_tpe1).Equals(Dafny.Sequence.UnicodeFromString("Map")))); + } } } } @@ -94,7 +96,9 @@ public static bool IsImmutableConversion(RAST._IType fromTpe, RAST._IType toTpe) } } } - return false; + { + return false; + } } public static RAST._IType SystemTupleType(Dafny.ISequence elements) { return (((RAST.__default.super__type).MSel(Dafny.Sequence.UnicodeFromString("_System"))).MSel(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("Tuple"), Std.Strings.__default.OfNat(new BigInteger((elements).Count))))).Apply(elements); @@ -318,20 +322,20 @@ public Dafny.ISequence dtor_body { } public abstract _IMod DowncastClone(); public Dafny.ISequence _ToString(Dafny.ISequence ind) { - var _pat_let_tv23 = ind; - var _pat_let_tv24 = ind; - var _pat_let_tv25 = ind; - var _pat_let_tv26 = ind; RAST._IMod _source26 = this; - if (_source26.is_ExternMod) { - Dafny.ISequence _768_name = _source26.dtor_name; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _768_name), Dafny.Sequence.UnicodeFromString(";")); + { + if (_source26.is_ExternMod) { + Dafny.ISequence _768_name = _source26.dtor_name; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _768_name), Dafny.Sequence.UnicodeFromString(";")); + } + } + { + Dafny.ISequence _769_name = _source26.dtor_name; + Dafny.ISequence _770_body = _source26.dtor_body; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _769_name), Dafny.Sequence.UnicodeFromString(" {")), Dafny.Sequence.UnicodeFromString("\n")), ind), RAST.__default.IND), RAST.__default.SeqToString(_770_body, Dafny.Helpers.Id, Func>>>((_771_ind) => ((System.Func>)((_772_modDecl) => { + return (_772_modDecl)._ToString(Dafny.Sequence.Concat(_771_ind, RAST.__default.IND)); + })))(ind), Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n\n"), ind), RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); } - Dafny.ISequence _769_name = _source26.dtor_name; - Dafny.ISequence _770_body = _source26.dtor_body; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _769_name), Dafny.Sequence.UnicodeFromString(" {")), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv23), RAST.__default.IND), RAST.__default.SeqToString(_770_body, Dafny.Helpers.Id, Func>>>((_771_ind) => ((System.Func>)((_772_modDecl) => { - return (_772_modDecl)._ToString(Dafny.Sequence.Concat(_771_ind, RAST.__default.IND)); - })))(_pat_let_tv24), Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n\n"), _pat_let_tv25), RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv26), Dafny.Sequence.UnicodeFromString("}")); } } public class Mod_Mod : Mod { @@ -1532,107 +1536,139 @@ public bool CanReadWithoutClone() { return (((((((((((this).is_U8) || ((this).is_U16)) || ((this).is_U32)) || ((this).is_U64)) || ((this).is_U128)) || ((this).is_I8)) || ((this).is_I16)) || ((this).is_I32)) || ((this).is_I64)) || ((this).is_I128)) || ((this).is_Bool); } public Dafny.ISequence _ToString(Dafny.ISequence ind) { - var _pat_let_tv27 = ind; - var _pat_let_tv28 = ind; - var _pat_let_tv29 = ind; - var _pat_let_tv30 = ind; - var _pat_let_tv31 = ind; - var _pat_let_tv32 = ind; - var _pat_let_tv33 = ind; - var _pat_let_tv34 = ind; - var _pat_let_tv35 = ind; - var _pat_let_tv36 = ind; - var _pat_let_tv37 = ind; - var _pat_let_tv38 = ind; RAST._IType _source27 = this; - if (_source27.is_Bool) { - return Dafny.Sequence.UnicodeFromString("bool"); - } - if (_source27.is_TIdentifier) { - Dafny.ISequence _793_underlying = _source27.dtor_name; - return _793_underlying; - } - if (_source27.is_TMemberSelect) { - RAST._IType _794_underlying = _source27.dtor_base; - Dafny.ISequence _795_name = _source27.dtor_name; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_794_underlying)._ToString(_pat_let_tv27), Dafny.Sequence.UnicodeFromString("::")), _795_name); - } - if (_source27.is_Borrowed) { - RAST._IType _796_underlying = _source27.dtor_underlying; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&"), (_796_underlying)._ToString(_pat_let_tv28)); - } - if (_source27.is_BorrowedMut) { - RAST._IType _797_underlying = _source27.dtor_underlying; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&mut "), (_797_underlying)._ToString(_pat_let_tv29)); - } - if (_source27.is_ImplType) { - RAST._IType _798_underlying = _source27.dtor_underlying; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("impl "), (_798_underlying)._ToString(_pat_let_tv30)); - } - if (_source27.is_DynType) { - RAST._IType _799_underlying = _source27.dtor_underlying; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("dyn "), (_799_underlying)._ToString(_pat_let_tv31)); - } - if (_source27.is_FnType) { - Dafny.ISequence _800_arguments = _source27.dtor_arguments; - RAST._IType _801_returnType = _source27.dtor_returnType; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Fn("), RAST.__default.SeqToString(_800_arguments, Dafny.Helpers.Id, Func>>>((_802_ind) => ((System.Func>)((_803_arg) => { - return (_803_arg)._ToString(Dafny.Sequence.Concat(_802_ind, RAST.__default.IND)); - })))(_pat_let_tv32), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(") -> ")), (_801_returnType)._ToString(Dafny.Sequence.Concat(_pat_let_tv33, RAST.__default.IND))); - } - if (_source27.is_IntersectionType) { - RAST._IType _804_left = _source27.dtor_left; - RAST._IType _805_right = _source27.dtor_right; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_804_left)._ToString(_pat_let_tv34), Dafny.Sequence.UnicodeFromString(" + ")), (_805_right)._ToString(_pat_let_tv35)); - } - if (_source27.is_TupleType) { - Dafny.ISequence _806_args = _source27.dtor_arguments; - if ((_806_args).Equals(Dafny.Sequence.FromElements())) { - return Dafny.Sequence.UnicodeFromString("()"); - } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_806_args, Dafny.Helpers.Id, Func>>>((_807_ind) => ((System.Func>)((_808_arg) => { - return (_808_arg)._ToString(Dafny.Sequence.Concat(_807_ind, RAST.__default.IND)); - })))(_pat_let_tv36), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")); + { + if (_source27.is_Bool) { + return Dafny.Sequence.UnicodeFromString("bool"); } } - if (_source27.is_TypeApp) { - RAST._IType _809_base = _source27.dtor_baseName; - Dafny.ISequence _810_args = _source27.dtor_arguments; - return Dafny.Sequence.Concat((_809_base)._ToString(_pat_let_tv37), (((_810_args).Equals(Dafny.Sequence.FromElements())) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), RAST.__default.SeqToString(_810_args, Dafny.Helpers.Id, Func>>>((_811_ind) => ((System.Func>)((_812_arg) => { - return (_812_arg)._ToString(Dafny.Sequence.Concat(_811_ind, RAST.__default.IND)); - })))(_pat_let_tv38), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">"))))); + { + if (_source27.is_TIdentifier) { + Dafny.ISequence _793_underlying = _source27.dtor_name; + return _793_underlying; + } } - if (_source27.is_SelfOwned) { - return Dafny.Sequence.UnicodeFromString("Self"); + { + if (_source27.is_TMemberSelect) { + RAST._IType _794_underlying = _source27.dtor_base; + Dafny.ISequence _795_name = _source27.dtor_name; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_794_underlying)._ToString(ind), Dafny.Sequence.UnicodeFromString("::")), _795_name); + } } - if (_source27.is_U8) { - return Dafny.Sequence.UnicodeFromString("u8"); + { + if (_source27.is_Borrowed) { + RAST._IType _796_underlying = _source27.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&"), (_796_underlying)._ToString(ind)); + } } - if (_source27.is_U16) { - return Dafny.Sequence.UnicodeFromString("u16"); + { + if (_source27.is_BorrowedMut) { + RAST._IType _797_underlying = _source27.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&mut "), (_797_underlying)._ToString(ind)); + } } - if (_source27.is_U32) { - return Dafny.Sequence.UnicodeFromString("u32"); + { + if (_source27.is_ImplType) { + RAST._IType _798_underlying = _source27.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("impl "), (_798_underlying)._ToString(ind)); + } + } + { + if (_source27.is_DynType) { + RAST._IType _799_underlying = _source27.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("dyn "), (_799_underlying)._ToString(ind)); + } + } + { + if (_source27.is_FnType) { + Dafny.ISequence _800_arguments = _source27.dtor_arguments; + RAST._IType _801_returnType = _source27.dtor_returnType; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Fn("), RAST.__default.SeqToString(_800_arguments, Dafny.Helpers.Id, Func>>>((_802_ind) => ((System.Func>)((_803_arg) => { + return (_803_arg)._ToString(Dafny.Sequence.Concat(_802_ind, RAST.__default.IND)); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(") -> ")), (_801_returnType)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))); + } } - if (_source27.is_U64) { - return Dafny.Sequence.UnicodeFromString("u64"); + { + if (_source27.is_IntersectionType) { + RAST._IType _804_left = _source27.dtor_left; + RAST._IType _805_right = _source27.dtor_right; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_804_left)._ToString(ind), Dafny.Sequence.UnicodeFromString(" + ")), (_805_right)._ToString(ind)); + } } - if (_source27.is_U128) { - return Dafny.Sequence.UnicodeFromString("u128"); + { + if (_source27.is_TupleType) { + Dafny.ISequence _806_args = _source27.dtor_arguments; + if ((_806_args).Equals(Dafny.Sequence.FromElements())) { + return Dafny.Sequence.UnicodeFromString("()"); + } else { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_806_args, Dafny.Helpers.Id, Func>>>((_807_ind) => ((System.Func>)((_808_arg) => { + return (_808_arg)._ToString(Dafny.Sequence.Concat(_807_ind, RAST.__default.IND)); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")); + } + } + } + { + if (_source27.is_TypeApp) { + RAST._IType _809_base = _source27.dtor_baseName; + Dafny.ISequence _810_args = _source27.dtor_arguments; + return Dafny.Sequence.Concat((_809_base)._ToString(ind), (((_810_args).Equals(Dafny.Sequence.FromElements())) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), RAST.__default.SeqToString(_810_args, Dafny.Helpers.Id, Func>>>((_811_ind) => ((System.Func>)((_812_arg) => { + return (_812_arg)._ToString(Dafny.Sequence.Concat(_811_ind, RAST.__default.IND)); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">"))))); + } + } + { + if (_source27.is_SelfOwned) { + return Dafny.Sequence.UnicodeFromString("Self"); + } + } + { + if (_source27.is_U8) { + return Dafny.Sequence.UnicodeFromString("u8"); + } + } + { + if (_source27.is_U16) { + return Dafny.Sequence.UnicodeFromString("u16"); + } + } + { + if (_source27.is_U32) { + return Dafny.Sequence.UnicodeFromString("u32"); + } + } + { + if (_source27.is_U64) { + return Dafny.Sequence.UnicodeFromString("u64"); + } + } + { + if (_source27.is_U128) { + return Dafny.Sequence.UnicodeFromString("u128"); + } + } + { + if (_source27.is_I8) { + return Dafny.Sequence.UnicodeFromString("i8"); + } } - if (_source27.is_I8) { - return Dafny.Sequence.UnicodeFromString("i8"); + { + if (_source27.is_I16) { + return Dafny.Sequence.UnicodeFromString("i16"); + } } - if (_source27.is_I16) { - return Dafny.Sequence.UnicodeFromString("i16"); + { + if (_source27.is_I32) { + return Dafny.Sequence.UnicodeFromString("i32"); + } } - if (_source27.is_I32) { - return Dafny.Sequence.UnicodeFromString("i32"); + { + if (_source27.is_I64) { + return Dafny.Sequence.UnicodeFromString("i64"); + } } - if (_source27.is_I64) { - return Dafny.Sequence.UnicodeFromString("i64"); + { + return Dafny.Sequence.UnicodeFromString("i128"); } - return Dafny.Sequence.UnicodeFromString("i128"); } public RAST._IType MSel(Dafny.ISequence name) { return RAST.Type.create_TMemberSelect(this, name); @@ -1645,16 +1681,22 @@ public RAST._IType Apply(Dafny.ISequence args) { } public RAST._IType ToOwned() { RAST._IType _source28 = this; - if (_source28.is_Borrowed) { - RAST._IType _813_x = _source28.dtor_underlying; - return _813_x; + { + if (_source28.is_Borrowed) { + RAST._IType _813_x = _source28.dtor_underlying; + return _813_x; + } } - if (_source28.is_BorrowedMut) { - RAST._IType _814_x = _source28.dtor_underlying; - return _814_x; + { + if (_source28.is_BorrowedMut) { + RAST._IType _814_x = _source28.dtor_underlying; + return _814_x; + } + } + { + RAST._IType _815_x = _source28; + return _815_x; } - RAST._IType _815_x = _source28; - return _815_x; } } public class Type_SelfOwned : Type { @@ -3953,159 +3995,181 @@ public bool NoExtraSemicolonAfter() { } public RAST._IExpr Optimize() { RAST._IExpr _source29 = this; - if (_source29.is_UnaryOp) { - Dafny.ISequence op10 = _source29.dtor_op1; - if (object.Equals(op10, Dafny.Sequence.UnicodeFromString("&"))) { - RAST._IExpr underlying0 = _source29.dtor_underlying; - if (underlying0.is_Call) { - RAST._IExpr obj0 = underlying0.dtor_obj; - if (obj0.is_Select) { - RAST._IExpr _822_underlying = obj0.dtor_obj; - Dafny.ISequence name4 = obj0.dtor_name; - if (object.Equals(name4, Dafny.Sequence.UnicodeFromString("clone"))) { - Dafny.ISequence _823_args = underlying0.dtor_arguments; - DAST.Format._IUnaryOpFormat _824_format = _source29.dtor_format; - if ((_823_args).Equals(Dafny.Sequence.FromElements())) { - return RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("&"), _822_underlying, _824_format); - } else { - return this; + { + if (_source29.is_UnaryOp) { + Dafny.ISequence op10 = _source29.dtor_op1; + if (object.Equals(op10, Dafny.Sequence.UnicodeFromString("&"))) { + RAST._IExpr underlying0 = _source29.dtor_underlying; + if (underlying0.is_Call) { + RAST._IExpr obj0 = underlying0.dtor_obj; + if (obj0.is_Select) { + RAST._IExpr _822_underlying = obj0.dtor_obj; + Dafny.ISequence name4 = obj0.dtor_name; + if (object.Equals(name4, Dafny.Sequence.UnicodeFromString("clone"))) { + Dafny.ISequence _823_args = underlying0.dtor_arguments; + DAST.Format._IUnaryOpFormat _824_format = _source29.dtor_format; + if ((_823_args).Equals(Dafny.Sequence.FromElements())) { + return RAST.Expr.create_UnaryOp(Dafny.Sequence.UnicodeFromString("&"), _822_underlying, _824_format); + } else { + return this; + } } } } } } } - if (_source29.is_UnaryOp) { - Dafny.ISequence op11 = _source29.dtor_op1; - if (object.Equals(op11, Dafny.Sequence.UnicodeFromString("!"))) { - RAST._IExpr underlying1 = _source29.dtor_underlying; - if (underlying1.is_BinaryOp) { - Dafny.ISequence op20 = underlying1.dtor_op2; - if (object.Equals(op20, Dafny.Sequence.UnicodeFromString("=="))) { - RAST._IExpr _825_left = underlying1.dtor_left; - RAST._IExpr _826_right = underlying1.dtor_right; - DAST.Format._IBinaryOpFormat _827_format = underlying1.dtor_format2; - DAST.Format._IUnaryOpFormat format0 = _source29.dtor_format; - if (format0.is_CombineFormat) { - return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("!="), _825_left, _826_right, DAST.Format.BinaryOpFormat.create_NoFormat()); + { + if (_source29.is_UnaryOp) { + Dafny.ISequence op11 = _source29.dtor_op1; + if (object.Equals(op11, Dafny.Sequence.UnicodeFromString("!"))) { + RAST._IExpr underlying1 = _source29.dtor_underlying; + if (underlying1.is_BinaryOp) { + Dafny.ISequence op20 = underlying1.dtor_op2; + if (object.Equals(op20, Dafny.Sequence.UnicodeFromString("=="))) { + RAST._IExpr _825_left = underlying1.dtor_left; + RAST._IExpr _826_right = underlying1.dtor_right; + DAST.Format._IBinaryOpFormat _827_format = underlying1.dtor_format2; + DAST.Format._IUnaryOpFormat format0 = _source29.dtor_format; + if (format0.is_CombineFormat) { + return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("!="), _825_left, _826_right, DAST.Format.BinaryOpFormat.create_NoFormat()); + } } } } } } - if (_source29.is_UnaryOp) { - Dafny.ISequence op12 = _source29.dtor_op1; - if (object.Equals(op12, Dafny.Sequence.UnicodeFromString("!"))) { - RAST._IExpr underlying2 = _source29.dtor_underlying; - if (underlying2.is_BinaryOp) { - Dafny.ISequence op21 = underlying2.dtor_op2; - if (object.Equals(op21, Dafny.Sequence.UnicodeFromString("<"))) { - RAST._IExpr _828_left = underlying2.dtor_left; - RAST._IExpr _829_right = underlying2.dtor_right; - DAST.Format._IBinaryOpFormat format20 = underlying2.dtor_format2; - if (format20.is_NoFormat) { - DAST.Format._IUnaryOpFormat format1 = _source29.dtor_format; - if (format1.is_CombineFormat) { - return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString(">="), _828_left, _829_right, DAST.Format.BinaryOpFormat.create_NoFormat()); + { + if (_source29.is_UnaryOp) { + Dafny.ISequence op12 = _source29.dtor_op1; + if (object.Equals(op12, Dafny.Sequence.UnicodeFromString("!"))) { + RAST._IExpr underlying2 = _source29.dtor_underlying; + if (underlying2.is_BinaryOp) { + Dafny.ISequence op21 = underlying2.dtor_op2; + if (object.Equals(op21, Dafny.Sequence.UnicodeFromString("<"))) { + RAST._IExpr _828_left = underlying2.dtor_left; + RAST._IExpr _829_right = underlying2.dtor_right; + DAST.Format._IBinaryOpFormat format20 = underlying2.dtor_format2; + if (format20.is_NoFormat) { + DAST.Format._IUnaryOpFormat format1 = _source29.dtor_format; + if (format1.is_CombineFormat) { + return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString(">="), _828_left, _829_right, DAST.Format.BinaryOpFormat.create_NoFormat()); + } } } } } } } - if (_source29.is_UnaryOp) { - Dafny.ISequence op13 = _source29.dtor_op1; - if (object.Equals(op13, Dafny.Sequence.UnicodeFromString("!"))) { - RAST._IExpr underlying3 = _source29.dtor_underlying; - if (underlying3.is_BinaryOp) { - Dafny.ISequence op22 = underlying3.dtor_op2; - if (object.Equals(op22, Dafny.Sequence.UnicodeFromString("<"))) { - RAST._IExpr _830_left = underlying3.dtor_left; - RAST._IExpr _831_right = underlying3.dtor_right; - DAST.Format._IBinaryOpFormat format21 = underlying3.dtor_format2; - if (format21.is_ReverseFormat) { - DAST.Format._IUnaryOpFormat format2 = _source29.dtor_format; - if (format2.is_CombineFormat) { - return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _831_right, _830_left, DAST.Format.BinaryOpFormat.create_NoFormat()); + { + if (_source29.is_UnaryOp) { + Dafny.ISequence op13 = _source29.dtor_op1; + if (object.Equals(op13, Dafny.Sequence.UnicodeFromString("!"))) { + RAST._IExpr underlying3 = _source29.dtor_underlying; + if (underlying3.is_BinaryOp) { + Dafny.ISequence op22 = underlying3.dtor_op2; + if (object.Equals(op22, Dafny.Sequence.UnicodeFromString("<"))) { + RAST._IExpr _830_left = underlying3.dtor_left; + RAST._IExpr _831_right = underlying3.dtor_right; + DAST.Format._IBinaryOpFormat format21 = underlying3.dtor_format2; + if (format21.is_ReverseFormat) { + DAST.Format._IUnaryOpFormat format2 = _source29.dtor_format; + if (format2.is_CombineFormat) { + return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _831_right, _830_left, DAST.Format.BinaryOpFormat.create_NoFormat()); + } } } } } } } - if (_source29.is_Call) { - RAST._IExpr obj1 = _source29.dtor_obj; - if (obj1.is_MemberSelect) { - RAST._IExpr _832_r = obj1.dtor_obj; - Dafny.ISequence name5 = obj1.dtor_name; - if (object.Equals(name5, Dafny.Sequence.UnicodeFromString("truncate!"))) { - Dafny.ISequence _833_args = _source29.dtor_arguments; - if (((!object.Equals(_832_r, RAST.__default.dafny__runtime)) && (!object.Equals(_832_r, RAST.__default.@global))) || ((new BigInteger((_833_args).Count)) != (new BigInteger(2)))) { - return this; - } else { - RAST._IExpr _834_expr = (_833_args).Select(BigInteger.Zero); - RAST._IExpr _835_tpeExpr = (_833_args).Select(BigInteger.One); - if (!((_835_tpeExpr).is_ExprFromType)) { + { + if (_source29.is_Call) { + RAST._IExpr obj1 = _source29.dtor_obj; + if (obj1.is_MemberSelect) { + RAST._IExpr _832_r = obj1.dtor_obj; + Dafny.ISequence name5 = obj1.dtor_name; + if (object.Equals(name5, Dafny.Sequence.UnicodeFromString("truncate!"))) { + Dafny.ISequence _833_args = _source29.dtor_arguments; + if (((!object.Equals(_832_r, RAST.__default.dafny__runtime)) && (!object.Equals(_832_r, RAST.__default.@global))) || ((new BigInteger((_833_args).Count)) != (new BigInteger(2)))) { return this; } else { - RAST._IType _836_tpe = (_835_tpeExpr).dtor_tpe; - if (((((((((((_836_tpe).is_U8) || ((_836_tpe).is_U16)) || ((_836_tpe).is_U32)) || ((_836_tpe).is_U64)) || ((_836_tpe).is_U128)) || ((_836_tpe).is_I8)) || ((_836_tpe).is_I16)) || ((_836_tpe).is_I32)) || ((_836_tpe).is_I64)) || ((_836_tpe).is_I128)) { - RAST._IExpr _source30 = _834_expr; - if (_source30.is_Call) { - RAST._IExpr obj2 = _source30.dtor_obj; - if (obj2.is_MemberSelect) { - RAST._IExpr _837_base = obj2.dtor_obj; - Dafny.ISequence name6 = obj2.dtor_name; - if (object.Equals(name6, Dafny.Sequence.UnicodeFromString("int!"))) { - Dafny.ISequence _838_args = _source30.dtor_arguments; - if (((new BigInteger((_838_args).Count)) == (BigInteger.One)) && ((object.Equals(_837_base, RAST.__default.dafny__runtime)) || (object.Equals(_837_base, RAST.__default.@global)))) { - RAST._IExpr _source31 = (_838_args).Select(BigInteger.Zero); - if (_source31.is_LiteralInt) { - Dafny.ISequence _839_number = _source31.dtor_value; - return RAST.Expr.create_LiteralInt(_839_number); - } - if (_source31.is_LiteralString) { - Dafny.ISequence _840_number = _source31.dtor_value; - return RAST.Expr.create_LiteralInt(_840_number); + RAST._IExpr _834_expr = (_833_args).Select(BigInteger.Zero); + RAST._IExpr _835_tpeExpr = (_833_args).Select(BigInteger.One); + if (!((_835_tpeExpr).is_ExprFromType)) { + return this; + } else { + RAST._IType _836_tpe = (_835_tpeExpr).dtor_tpe; + if (((((((((((_836_tpe).is_U8) || ((_836_tpe).is_U16)) || ((_836_tpe).is_U32)) || ((_836_tpe).is_U64)) || ((_836_tpe).is_U128)) || ((_836_tpe).is_I8)) || ((_836_tpe).is_I16)) || ((_836_tpe).is_I32)) || ((_836_tpe).is_I64)) || ((_836_tpe).is_I128)) { + RAST._IExpr _source30 = _834_expr; + { + if (_source30.is_Call) { + RAST._IExpr obj2 = _source30.dtor_obj; + if (obj2.is_MemberSelect) { + RAST._IExpr _837_base = obj2.dtor_obj; + Dafny.ISequence name6 = obj2.dtor_name; + if (object.Equals(name6, Dafny.Sequence.UnicodeFromString("int!"))) { + Dafny.ISequence _838_args = _source30.dtor_arguments; + if (((new BigInteger((_838_args).Count)) == (BigInteger.One)) && ((object.Equals(_837_base, RAST.__default.dafny__runtime)) || (object.Equals(_837_base, RAST.__default.@global)))) { + RAST._IExpr _source31 = (_838_args).Select(BigInteger.Zero); + { + if (_source31.is_LiteralInt) { + Dafny.ISequence _839_number = _source31.dtor_value; + return RAST.Expr.create_LiteralInt(_839_number); + } + } + { + if (_source31.is_LiteralString) { + Dafny.ISequence _840_number = _source31.dtor_value; + return RAST.Expr.create_LiteralInt(_840_number); + } + } + { + return this; + } + } else { + return this; + } } - return this; - } else { - return this; } } } + { + return this; + } + } else { + return this; } - return this; - } else { - return this; } } } } } } - if (_source29.is_StmtExpr) { - RAST._IExpr stmt0 = _source29.dtor_stmt; - if (stmt0.is_DeclareVar) { - RAST._IDeclareType _841_mod = stmt0.dtor_declareType; - Dafny.ISequence _842_name = stmt0.dtor_name; - Std.Wrappers._IOption optType0 = stmt0.dtor_optType; - if (optType0.is_Some) { - RAST._IType _843_tpe = optType0.dtor_value; - Std.Wrappers._IOption optRhs0 = stmt0.dtor_optRhs; - if (optRhs0.is_None) { - RAST._IExpr rhs0 = _source29.dtor_rhs; - if (rhs0.is_StmtExpr) { - RAST._IExpr stmt1 = rhs0.dtor_stmt; - if (stmt1.is_Assign) { - Std.Wrappers._IOption _844_name2 = stmt1.dtor_names; - RAST._IExpr _845_rhs = stmt1.dtor_rhs; - RAST._IExpr _846_last = rhs0.dtor_rhs; - if (object.Equals(_844_name2, Std.Wrappers.Option.create_Some(RAST.AssignLhs.create_LocalVar(_842_name)))) { - RAST._IExpr _847_rewriting = RAST.Expr.create_StmtExpr(RAST.Expr.create_DeclareVar(_841_mod, _842_name, Std.Wrappers.Option.create_Some(_843_tpe), Std.Wrappers.Option.create_Some(_845_rhs)), _846_last); - return _847_rewriting; - } else { - return this; + { + if (_source29.is_StmtExpr) { + RAST._IExpr stmt0 = _source29.dtor_stmt; + if (stmt0.is_DeclareVar) { + RAST._IDeclareType _841_mod = stmt0.dtor_declareType; + Dafny.ISequence _842_name = stmt0.dtor_name; + Std.Wrappers._IOption optType0 = stmt0.dtor_optType; + if (optType0.is_Some) { + RAST._IType _843_tpe = optType0.dtor_value; + Std.Wrappers._IOption optRhs0 = stmt0.dtor_optRhs; + if (optRhs0.is_None) { + RAST._IExpr rhs0 = _source29.dtor_rhs; + if (rhs0.is_StmtExpr) { + RAST._IExpr stmt1 = rhs0.dtor_stmt; + if (stmt1.is_Assign) { + Std.Wrappers._IOption _844_name2 = stmt1.dtor_names; + RAST._IExpr _845_rhs = stmt1.dtor_rhs; + RAST._IExpr _846_last = rhs0.dtor_rhs; + if (object.Equals(_844_name2, Std.Wrappers.Option.create_Some(RAST.AssignLhs.create_LocalVar(_842_name)))) { + RAST._IExpr _847_rewriting = RAST.Expr.create_StmtExpr(RAST.Expr.create_DeclareVar(_841_mod, _842_name, Std.Wrappers.Option.create_Some(_843_tpe), Std.Wrappers.Option.create_Some(_845_rhs)), _846_last); + return _847_rewriting; + } else { + return this; + } } } } @@ -4113,32 +4177,34 @@ public RAST._IExpr Optimize() { } } } - if (_source29.is_StmtExpr) { - RAST._IExpr stmt2 = _source29.dtor_stmt; - if (stmt2.is_IfExpr) { - RAST._IExpr cond0 = stmt2.dtor_cond; - if (cond0.is_UnaryOp) { - Dafny.ISequence op14 = cond0.dtor_op1; - if (object.Equals(op14, Dafny.Sequence.UnicodeFromString("!"))) { - RAST._IExpr underlying4 = cond0.dtor_underlying; - if (underlying4.is_BinaryOp) { - Dafny.ISequence op23 = underlying4.dtor_op2; - if (object.Equals(op23, Dafny.Sequence.UnicodeFromString("=="))) { - RAST._IExpr _848_a = underlying4.dtor_left; - RAST._IExpr _849_b = underlying4.dtor_right; - DAST.Format._IBinaryOpFormat _850_f = underlying4.dtor_format2; - DAST.Format._IUnaryOpFormat _851_of = cond0.dtor_format; - RAST._IExpr thn0 = stmt2.dtor_thn; - if (thn0.is_RawExpr) { - Dafny.ISequence content0 = thn0.dtor_content; - if (object.Equals(content0, Dafny.Sequence.UnicodeFromString("panic!(\"Halt\");"))) { - RAST._IExpr els0 = stmt2.dtor_els; - if (els0.is_RawExpr) { - Dafny.ISequence content1 = els0.dtor_content; - if (object.Equals(content1, Dafny.Sequence.UnicodeFromString(""))) { - RAST._IExpr _852_last = _source29.dtor_rhs; - RAST._IExpr _853_rewriting = RAST.Expr.create_StmtExpr((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("assert_eq!"))).Apply(Dafny.Sequence.FromElements(_848_a, _849_b)), _852_last); - return _853_rewriting; + { + if (_source29.is_StmtExpr) { + RAST._IExpr stmt2 = _source29.dtor_stmt; + if (stmt2.is_IfExpr) { + RAST._IExpr cond0 = stmt2.dtor_cond; + if (cond0.is_UnaryOp) { + Dafny.ISequence op14 = cond0.dtor_op1; + if (object.Equals(op14, Dafny.Sequence.UnicodeFromString("!"))) { + RAST._IExpr underlying4 = cond0.dtor_underlying; + if (underlying4.is_BinaryOp) { + Dafny.ISequence op23 = underlying4.dtor_op2; + if (object.Equals(op23, Dafny.Sequence.UnicodeFromString("=="))) { + RAST._IExpr _848_a = underlying4.dtor_left; + RAST._IExpr _849_b = underlying4.dtor_right; + DAST.Format._IBinaryOpFormat _850_f = underlying4.dtor_format2; + DAST.Format._IUnaryOpFormat _851_of = cond0.dtor_format; + RAST._IExpr thn0 = stmt2.dtor_thn; + if (thn0.is_RawExpr) { + Dafny.ISequence content0 = thn0.dtor_content; + if (object.Equals(content0, Dafny.Sequence.UnicodeFromString("panic!(\"Halt\");"))) { + RAST._IExpr els0 = stmt2.dtor_els; + if (els0.is_RawExpr) { + Dafny.ISequence content1 = els0.dtor_content; + if (object.Equals(content1, Dafny.Sequence.UnicodeFromString(""))) { + RAST._IExpr _852_last = _source29.dtor_rhs; + RAST._IExpr _853_rewriting = RAST.Expr.create_StmtExpr((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("assert_eq!"))).Apply(Dafny.Sequence.FromElements(_848_a, _849_b)), _852_last); + return _853_rewriting; + } } } } @@ -4149,7 +4215,9 @@ public RAST._IExpr Optimize() { } } } - return this; + { + return this; + } } public bool LeftRequiresParentheses(RAST._IExpr left) { return ((this).printingInfo).NeedParenthesesForLeft((left).printingInfo); @@ -4173,11 +4241,15 @@ public bool RightRequiresParentheses(RAST._IExpr right) { } public Std.Wrappers._IOption> RightMostIdentifier() { RAST._IExpr _source32 = this; - if (_source32.is_MemberSelect) { - Dafny.ISequence _854_id = _source32.dtor_name; - return Std.Wrappers.Option>.create_Some(_854_id); + { + if (_source32.is_MemberSelect) { + Dafny.ISequence _854_id = _source32.dtor_name; + return Std.Wrappers.Option>.create_Some(_854_id); + } + } + { + return Std.Wrappers.Option>.create_None(); } - return Std.Wrappers.Option>.create_None(); } public static Dafny.ISequence MaxHashes(Dafny.ISequence s, Dafny.ISequence currentHashes, Dafny.ISequence mostHashes) { @@ -4224,361 +4296,387 @@ public bool RightRequiresParentheses(RAST._IExpr right) { } } public Dafny.ISequence _ToString(Dafny.ISequence ind) { - var _pat_let_tv39 = ind; - var _pat_let_tv40 = ind; - var _pat_let_tv41 = ind; - var _pat_let_tv42 = ind; - var _pat_let_tv43 = ind; - var _pat_let_tv44 = ind; - var _pat_let_tv45 = ind; - var _pat_let_tv46 = ind; - var _pat_let_tv47 = ind; - var _pat_let_tv48 = ind; - var _pat_let_tv49 = ind; - var _pat_let_tv50 = ind; - var _pat_let_tv51 = ind; - var _pat_let_tv52 = ind; - var _pat_let_tv53 = ind; - var _pat_let_tv54 = ind; - var _pat_let_tv55 = ind; - var _pat_let_tv56 = ind; - var _pat_let_tv57 = ind; - var _pat_let_tv58 = ind; - var _pat_let_tv59 = ind; - var _pat_let_tv60 = ind; - var _pat_let_tv61 = ind; - var _pat_let_tv62 = ind; - var _pat_let_tv63 = ind; - var _pat_let_tv64 = ind; - var _pat_let_tv65 = ind; - var _pat_let_tv66 = ind; - var _pat_let_tv67 = ind; - var _pat_let_tv68 = ind; - var _pat_let_tv69 = ind; - var _pat_let_tv70 = ind; - var _pat_let_tv71 = ind; - var _pat_let_tv72 = ind; - var _pat_let_tv73 = ind; - var _pat_let_tv74 = ind; - var _pat_let_tv75 = ind; - var _pat_let_tv76 = ind; - var _pat_let_tv77 = ind; - var _pat_let_tv78 = ind; - var _pat_let_tv79 = ind; - var _pat_let_tv80 = ind; - var _pat_let_tv81 = ind; - var _pat_let_tv82 = ind; - var _pat_let_tv83 = ind; - var _pat_let_tv84 = ind; - var _pat_let_tv85 = ind; - var _pat_let_tv86 = ind; - var _pat_let_tv87 = ind; - var _pat_let_tv88 = ind; - var _pat_let_tv89 = ind; - var _pat_let_tv90 = ind; - var _pat_let_tv91 = ind; - var _pat_let_tv92 = ind; - var _pat_let_tv93 = ind; - var _pat_let_tv94 = ind; - var _pat_let_tv95 = ind; - var _pat_let_tv96 = ind; RAST._IExpr _source33 = (this).Optimize(); - if (_source33.is_Identifier) { - Dafny.ISequence _856_name = _source33.dtor_name; - return _856_name; - } - if (_source33.is_ExprFromType) { - RAST._IType _857_t = _source33.dtor_tpe; - return (_857_t)._ToString(_pat_let_tv39); - } - if (_source33.is_LiteralInt) { - Dafny.ISequence _858_number = _source33.dtor_value; - return _858_number; - } - if (_source33.is_LiteralBool) { - bool _859_b = _source33.dtor_bvalue; - if (_859_b) { - return Dafny.Sequence.UnicodeFromString("true"); - } else { - return Dafny.Sequence.UnicodeFromString("false"); + { + if (_source33.is_Identifier) { + Dafny.ISequence _856_name = _source33.dtor_name; + return _856_name; } } - if (_source33.is_LiteralString) { - Dafny.ISequence _860_characters = _source33.dtor_value; - bool _861_binary = _source33.dtor_binary; - bool _862_verbatim = _source33.dtor_verbatim; - Dafny.ISequence _863_hashes = ((_862_verbatim) ? (Dafny.Sequence.Concat(RAST.Expr.MaxHashes(_860_characters, Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")), Dafny.Sequence.UnicodeFromString("#"))) : (Dafny.Sequence.UnicodeFromString(""))); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((_861_binary) ? (Dafny.Sequence.UnicodeFromString("b")) : (Dafny.Sequence.UnicodeFromString(""))), ((_862_verbatim) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("r"), _863_hashes)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("\"")), ((_862_verbatim) ? (RAST.Expr.RemoveDoubleQuotes(_860_characters)) : (_860_characters))), Dafny.Sequence.UnicodeFromString("\"")), _863_hashes); - } - if (_source33.is_Match) { - RAST._IExpr _864_matchee = _source33.dtor_matchee; - Dafny.ISequence _865_cases = _source33.dtor_cases; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("match "), (_864_matchee)._ToString(Dafny.Sequence.Concat(_pat_let_tv40, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_865_cases, Dafny.Helpers.Id, Func>>>((_866_ind) => ((System.Func>)((_867_c) => { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _866_ind), RAST.__default.IND), (_867_c)._ToString(Dafny.Sequence.Concat(_866_ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(",")); - })))(_pat_let_tv41), Dafny.Sequence.UnicodeFromString(""))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv42), Dafny.Sequence.UnicodeFromString("}")); - } - if (_source33.is_StmtExpr) { - RAST._IExpr _868_stmt = _source33.dtor_stmt; - RAST._IExpr _869_rhs = _source33.dtor_rhs; - if (((_868_stmt).is_RawExpr) && (((_868_stmt).dtor_content).Equals(Dafny.Sequence.UnicodeFromString("")))) { - return (_869_rhs)._ToString(_pat_let_tv43); - } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_868_stmt)._ToString(_pat_let_tv44), (((_868_stmt).NoExtraSemicolonAfter()) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.UnicodeFromString(";")))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv45), (_869_rhs)._ToString(_pat_let_tv46)); + { + if (_source33.is_ExprFromType) { + RAST._IType _857_t = _source33.dtor_tpe; + return (_857_t)._ToString(ind); } } - if (_source33.is_Block) { - RAST._IExpr _870_underlying = _source33.dtor_underlying; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\n"), _pat_let_tv47), RAST.__default.IND), (_870_underlying)._ToString(Dafny.Sequence.Concat(_pat_let_tv48, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv49), Dafny.Sequence.UnicodeFromString("}")); - } - if (_source33.is_IfExpr) { - RAST._IExpr _871_cond = _source33.dtor_cond; - RAST._IExpr _872_thn = _source33.dtor_thn; - RAST._IExpr _873_els = _source33.dtor_els; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("if "), (_871_cond)._ToString(Dafny.Sequence.Concat(_pat_let_tv50, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv51), RAST.__default.IND), (_872_thn)._ToString(Dafny.Sequence.Concat(_pat_let_tv52, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv53), Dafny.Sequence.UnicodeFromString("}")), ((object.Equals(_873_els, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" else {\n"), _pat_let_tv54), RAST.__default.IND), (_873_els)._ToString(Dafny.Sequence.Concat(_pat_let_tv55, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv56), Dafny.Sequence.UnicodeFromString("}"))))); - } - if (_source33.is_StructBuild) { - RAST._IExpr _874_name = _source33.dtor_underlying; - Dafny.ISequence _875_assignments = _source33.dtor_assignments; - if (((new BigInteger((_875_assignments).Count)).Sign == 1) && ((((_875_assignments).Select(BigInteger.Zero)).dtor_identifier).Equals(Dafny.Sequence.UnicodeFromString("0")))) { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_874_name)._ToString(_pat_let_tv57), Dafny.Sequence.UnicodeFromString(" (")), RAST.__default.SeqToString(_875_assignments, Dafny.Helpers.Id, Func>>>((_876_ind) => ((System.Func>)((_877_assignment) => { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _876_ind), RAST.__default.IND), ((_877_assignment).dtor_rhs)._ToString(Dafny.Sequence.Concat(_876_ind, RAST.__default.IND))); - })))(_pat_let_tv58), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_875_assignments).Count)) > (BigInteger.One)) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv59)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); - } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_874_name)._ToString(_pat_let_tv60), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_875_assignments, Dafny.Helpers.Id, Func>>>((_878_ind) => ((System.Func>)((_879_assignment) => { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _878_ind), RAST.__default.IND), (_879_assignment)._ToString(Dafny.Sequence.Concat(_878_ind, RAST.__default.IND))); - })))(_pat_let_tv61), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_875_assignments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv62)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("}")); + { + if (_source33.is_LiteralInt) { + Dafny.ISequence _858_number = _source33.dtor_value; + return _858_number; } } - if (_source33.is_Tuple) { - Dafny.ISequence _880_arguments = _source33.dtor_arguments; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_880_arguments, Dafny.Helpers.Id, Func>>>((_881_ind) => ((System.Func>)((_882_arg) => { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _881_ind), RAST.__default.IND), (_882_arg)._ToString(Dafny.Sequence.Concat(_881_ind, RAST.__default.IND))); - })))(_pat_let_tv63), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_880_arguments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv64)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); - } - if (_source33.is_UnaryOp) { - Dafny.ISequence _883_op = _source33.dtor_op1; - RAST._IExpr _884_underlying = _source33.dtor_underlying; - DAST.Format._IUnaryOpFormat _885_format = _source33.dtor_format; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs41 = ((((this).printingInfo).NeedParenthesesFor((_884_underlying).printingInfo)) ? (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")"))) : (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")))); - Dafny.ISequence _886_leftP = _let_tmp_rhs41.dtor__0; - Dafny.ISequence _887_rightP = _let_tmp_rhs41.dtor__1; - Dafny.ISequence _888_leftOp = ((((_883_op).Equals(Dafny.Sequence.UnicodeFromString("&mut"))) && (!(_886_leftP).Equals(Dafny.Sequence.UnicodeFromString("(")))) ? (Dafny.Sequence.Concat(_883_op, Dafny.Sequence.UnicodeFromString(" "))) : ((((_883_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (Dafny.Sequence.UnicodeFromString("")) : (_883_op)))); - Dafny.ISequence _889_rightOp = (((_883_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (_883_op) : (Dafny.Sequence.UnicodeFromString(""))); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_888_leftOp, _886_leftP), (_884_underlying)._ToString(_pat_let_tv65)), _887_rightP), _889_rightOp); - } - if (_source33.is_TypeAscription) { - RAST._IExpr _890_left = _source33.dtor_left; - RAST._IType _891_tpe = _source33.dtor_tpe; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs42 = (this).LeftParentheses(_890_left); - Dafny.ISequence _892_leftLeftP = _let_tmp_rhs42.dtor__0; - Dafny.ISequence _893_leftRightP = _let_tmp_rhs42.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_892_leftLeftP, (_890_left)._ToString(RAST.__default.IND)), _893_leftRightP), Dafny.Sequence.UnicodeFromString(" as ")), (_891_tpe)._ToString(RAST.__default.IND)); - } - if (_source33.is_BinaryOp) { - Dafny.ISequence _894_op2 = _source33.dtor_op2; - RAST._IExpr _895_left = _source33.dtor_left; - RAST._IExpr _896_right = _source33.dtor_right; - DAST.Format._IBinaryOpFormat _897_format = _source33.dtor_format2; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs43 = (this).LeftParentheses(_895_left); - Dafny.ISequence _898_leftLeftP = _let_tmp_rhs43.dtor__0; - Dafny.ISequence _899_leftRighP = _let_tmp_rhs43.dtor__1; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs44 = (this).RightParentheses(_896_right); - Dafny.ISequence _900_rightLeftP = _let_tmp_rhs44.dtor__0; - Dafny.ISequence _901_rightRightP = _let_tmp_rhs44.dtor__1; - Dafny.ISequence _902_opRendered = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), _894_op2), Dafny.Sequence.UnicodeFromString(" ")); - Dafny.ISequence _903_indLeft = (((_898_leftLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(_pat_let_tv66, RAST.__default.IND)) : (_pat_let_tv67)); - Dafny.ISequence _904_indRight = (((_900_rightLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(_pat_let_tv68, RAST.__default.IND)) : (_pat_let_tv69)); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_898_leftLeftP, (_895_left)._ToString(_903_indLeft)), _899_leftRighP), _902_opRendered), _900_rightLeftP), (_896_right)._ToString(_904_indRight)), _901_rightRightP); - } - if (_source33.is_DeclareVar) { - RAST._IDeclareType _905_declareType = _source33.dtor_declareType; - Dafny.ISequence _906_name = _source33.dtor_name; - Std.Wrappers._IOption _907_optType = _source33.dtor_optType; - Std.Wrappers._IOption _908_optExpr = _source33.dtor_optRhs; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("let "), ((object.Equals(_905_declareType, RAST.DeclareType.create_MUT())) ? (Dafny.Sequence.UnicodeFromString("mut ")) : (Dafny.Sequence.UnicodeFromString("")))), _906_name), (((_907_optType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(": "), ((_907_optType).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv70, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), (((_908_optExpr).is_Some) ? (Dafny.Helpers.Let, Dafny.ISequence>(((_908_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv71, RAST.__default.IND)), _pat_let5_0 => Dafny.Helpers.Let, Dafny.ISequence>(_pat_let5_0, _909_optExprString => (((_909_optExprString).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("= /*issue with empty RHS*/"), ((((_908_optExpr).dtor_value).is_RawExpr) ? (Dafny.Sequence.UnicodeFromString("Empty Raw expr")) : (((((_908_optExpr).dtor_value).is_LiteralString) ? (Dafny.Sequence.UnicodeFromString("Empty string literal")) : (((((_908_optExpr).dtor_value).is_LiteralInt) ? (Dafny.Sequence.UnicodeFromString("Empty int literal")) : (Dafny.Sequence.UnicodeFromString("Another case"))))))))) : (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" = "), _909_optExprString)))))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); - } - if (_source33.is_Assign) { - Std.Wrappers._IOption _910_names = _source33.dtor_names; - RAST._IExpr _911_expr = _source33.dtor_rhs; - Dafny.ISequence _912_lhs = ((System.Func>)(() => { - Std.Wrappers._IOption _source34 = _910_names; - if (_source34.is_Some) { - RAST._IAssignLhs value0 = _source34.dtor_value; - if (value0.is_LocalVar) { - Dafny.ISequence _913_name = value0.dtor_name; - return Dafny.Sequence.Concat(_913_name, Dafny.Sequence.UnicodeFromString(" = ")); - } + { + if (_source33.is_LiteralBool) { + bool _859_b = _source33.dtor_bvalue; + if (_859_b) { + return Dafny.Sequence.UnicodeFromString("true"); + } else { + return Dafny.Sequence.UnicodeFromString("false"); } - if (_source34.is_Some) { - RAST._IAssignLhs value1 = _source34.dtor_value; - if (value1.is_SelectMember) { - RAST._IExpr _914_member = value1.dtor_on; - Dafny.ISequence _915_field = value1.dtor_field; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs45 = (RAST.Expr.create_Select(_914_member, _915_field)).LeftParentheses(_914_member); - Dafny.ISequence _916_leftP = _let_tmp_rhs45.dtor__0; - Dafny.ISequence _917_rightP = _let_tmp_rhs45.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_916_leftP, (_914_member)._ToString(_pat_let_tv72)), _917_rightP), Dafny.Sequence.UnicodeFromString(".")), _915_field), Dafny.Sequence.UnicodeFromString(" = ")); - } - } - if (_source34.is_Some) { - RAST._IAssignLhs value2 = _source34.dtor_value; - if (value2.is_ExtractTuple) { - Dafny.ISequence> _918_names = value2.dtor_names; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString>(_918_names, ((System.Func, Dafny.ISequence>)((_919_name) => { - return _919_name; - })), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString(") = ")); - } - } - if (_source34.is_Some) { - RAST._IAssignLhs value3 = _source34.dtor_value; - if (value3.is_Index) { - RAST._IExpr _920_e = value3.dtor_expr; - Dafny.ISequence _921_indices = value3.dtor_indices; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs46 = (RAST.Expr.create_Call(_920_e, _921_indices)).LeftParentheses(_920_e); - Dafny.ISequence _922_leftP = _let_tmp_rhs46.dtor__0; - Dafny.ISequence _923_rightP = _let_tmp_rhs46.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_922_leftP, (_920_e)._ToString(_pat_let_tv73)), _923_rightP), Dafny.Sequence.UnicodeFromString("[")), RAST.__default.SeqToString(_921_indices, Dafny.Helpers.Id, Func>>>((_924_ind) => ((System.Func>)((_925_index) => { - return (_925_index)._ToString(Dafny.Sequence.Concat(_924_ind, RAST.__default.IND)); - })))(_pat_let_tv74), Dafny.Sequence.UnicodeFromString("]["))), Dafny.Sequence.UnicodeFromString("] = ")); - } + } + } + { + if (_source33.is_LiteralString) { + Dafny.ISequence _860_characters = _source33.dtor_value; + bool _861_binary = _source33.dtor_binary; + bool _862_verbatim = _source33.dtor_verbatim; + Dafny.ISequence _863_hashes = ((_862_verbatim) ? (Dafny.Sequence.Concat(RAST.Expr.MaxHashes(_860_characters, Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")), Dafny.Sequence.UnicodeFromString("#"))) : (Dafny.Sequence.UnicodeFromString(""))); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((_861_binary) ? (Dafny.Sequence.UnicodeFromString("b")) : (Dafny.Sequence.UnicodeFromString(""))), ((_862_verbatim) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("r"), _863_hashes)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("\"")), ((_862_verbatim) ? (RAST.Expr.RemoveDoubleQuotes(_860_characters)) : (_860_characters))), Dafny.Sequence.UnicodeFromString("\"")), _863_hashes); + } + } + { + if (_source33.is_Match) { + RAST._IExpr _864_matchee = _source33.dtor_matchee; + Dafny.ISequence _865_cases = _source33.dtor_cases; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("match "), (_864_matchee)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_865_cases, Dafny.Helpers.Id, Func>>>((_866_ind) => ((System.Func>)((_867_c) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _866_ind), RAST.__default.IND), (_867_c)._ToString(Dafny.Sequence.Concat(_866_ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(",")); + })))(ind), Dafny.Sequence.UnicodeFromString(""))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); + } + } + { + if (_source33.is_StmtExpr) { + RAST._IExpr _868_stmt = _source33.dtor_stmt; + RAST._IExpr _869_rhs = _source33.dtor_rhs; + if (((_868_stmt).is_RawExpr) && (((_868_stmt).dtor_content).Equals(Dafny.Sequence.UnicodeFromString("")))) { + return (_869_rhs)._ToString(ind); + } else { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_868_stmt)._ToString(ind), (((_868_stmt).NoExtraSemicolonAfter()) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.UnicodeFromString(";")))), Dafny.Sequence.UnicodeFromString("\n")), ind), (_869_rhs)._ToString(ind)); } - return Dafny.Sequence.UnicodeFromString("_ = "); - }))(); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(_912_lhs, (_911_expr)._ToString(Dafny.Sequence.Concat(_pat_let_tv75, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(";")); - } - if (_source33.is_Labelled) { - Dafny.ISequence _926_name = _source33.dtor_lbl; - RAST._IExpr _927_underlying = _source33.dtor_underlying; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("'"), _926_name), Dafny.Sequence.UnicodeFromString(": ")), (_927_underlying)._ToString(_pat_let_tv76)); - } - if (_source33.is_Break) { - Std.Wrappers._IOption> _928_optLbl = _source33.dtor_optLbl; - Std.Wrappers._IOption> _source35 = _928_optLbl; - if (_source35.is_Some) { - Dafny.ISequence _929_lbl = _source35.dtor_value; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("break '"), _929_lbl), Dafny.Sequence.UnicodeFromString(";")); } - return Dafny.Sequence.UnicodeFromString("break;"); - } - if (_source33.is_Continue) { - Std.Wrappers._IOption> _930_optLbl = _source33.dtor_optLbl; - Std.Wrappers._IOption> _source36 = _930_optLbl; - if (_source36.is_Some) { - Dafny.ISequence _931_lbl = _source36.dtor_value; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("continue '"), _931_lbl), Dafny.Sequence.UnicodeFromString(";")); + } + { + if (_source33.is_Block) { + RAST._IExpr _870_underlying = _source33.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\n"), ind), RAST.__default.IND), (_870_underlying)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); + } + } + { + if (_source33.is_IfExpr) { + RAST._IExpr _871_cond = _source33.dtor_cond; + RAST._IExpr _872_thn = _source33.dtor_thn; + RAST._IExpr _873_els = _source33.dtor_els; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("if "), (_871_cond)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), ind), RAST.__default.IND), (_872_thn)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")), ((object.Equals(_873_els, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" else {\n"), ind), RAST.__default.IND), (_873_els)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}"))))); } - return Dafny.Sequence.UnicodeFromString("continue;"); - } - if (_source33.is_Loop) { - Std.Wrappers._IOption _932_optCond = _source33.dtor_optCond; - RAST._IExpr _933_underlying = _source33.dtor_underlying; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((System.Func>)(() => { - Std.Wrappers._IOption _source37 = _932_optCond; - if (_source37.is_None) { - return Dafny.Sequence.UnicodeFromString("loop"); + } + { + if (_source33.is_StructBuild) { + RAST._IExpr _874_name = _source33.dtor_underlying; + Dafny.ISequence _875_assignments = _source33.dtor_assignments; + if (((new BigInteger((_875_assignments).Count)).Sign == 1) && ((((_875_assignments).Select(BigInteger.Zero)).dtor_identifier).Equals(Dafny.Sequence.UnicodeFromString("0")))) { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_874_name)._ToString(ind), Dafny.Sequence.UnicodeFromString(" (")), RAST.__default.SeqToString(_875_assignments, Dafny.Helpers.Id, Func>>>((_876_ind) => ((System.Func>)((_877_assignment) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _876_ind), RAST.__default.IND), ((_877_assignment).dtor_rhs)._ToString(Dafny.Sequence.Concat(_876_ind, RAST.__default.IND))); + })))(ind), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_875_assignments).Count)) > (BigInteger.One)) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); + } else { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_874_name)._ToString(ind), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_875_assignments, Dafny.Helpers.Id, Func>>>((_878_ind) => ((System.Func>)((_879_assignment) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _878_ind), RAST.__default.IND), (_879_assignment)._ToString(Dafny.Sequence.Concat(_878_ind, RAST.__default.IND))); + })))(ind), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_875_assignments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("}")); } - RAST._IExpr _934_c = _source37.dtor_value; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("while "), (_934_c)._ToString(Dafny.Sequence.Concat(_pat_let_tv77, RAST.__default.IND))); - }))(), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv78), RAST.__default.IND), (_933_underlying)._ToString(Dafny.Sequence.Concat(_pat_let_tv79, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv80), Dafny.Sequence.UnicodeFromString("}")); - } - if (_source33.is_For) { - Dafny.ISequence _935_name = _source33.dtor_name; - RAST._IExpr _936_range = _source33.dtor_range; - RAST._IExpr _937_body = _source33.dtor_body; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("for "), _935_name), Dafny.Sequence.UnicodeFromString(" in ")), (_936_range)._ToString(Dafny.Sequence.Concat(_pat_let_tv81, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv82), RAST.__default.IND), (_937_body)._ToString(Dafny.Sequence.Concat(_pat_let_tv83, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv84), Dafny.Sequence.UnicodeFromString("}")); - } - if (_source33.is_Return) { - Std.Wrappers._IOption _938_optExpr = _source33.dtor_optExpr; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("return"), (((_938_optExpr).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), ((_938_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv85, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); - } - if (_source33.is_CallType) { - RAST._IExpr _939_expr = _source33.dtor_obj; - Dafny.ISequence _940_tpes = _source33.dtor_typeParameters; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs47 = (this).LeftParentheses(_939_expr); - Dafny.ISequence _941_leftP = _let_tmp_rhs47.dtor__0; - Dafny.ISequence _942_rightP = _let_tmp_rhs47.dtor__1; - if ((_940_tpes).Equals(Dafny.Sequence.FromElements())) { - return (_939_expr)._ToString(_pat_let_tv86); - } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_941_leftP, (_939_expr)._ToString(_pat_let_tv87)), _942_rightP), Dafny.Sequence.UnicodeFromString("::<")), RAST.__default.SeqToString(_940_tpes, Dafny.Helpers.Id, Func>>>((_943_ind) => ((System.Func>)((_944_tpe) => { - return (_944_tpe)._ToString(Dafny.Sequence.Concat(_943_ind, RAST.__default.IND)); - })))(_pat_let_tv88), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">")); } } - if (_source33.is_Call) { - RAST._IExpr _945_expr = _source33.dtor_obj; - Dafny.ISequence _946_args = _source33.dtor_arguments; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs48 = (this).LeftParentheses(_945_expr); - Dafny.ISequence _947_leftP = _let_tmp_rhs48.dtor__0; - Dafny.ISequence _948_rightP = _let_tmp_rhs48.dtor__1; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs49 = ((System.Func<_System._ITuple2, Dafny.ISequence>>)(() => { - Std.Wrappers._IOption> _source38 = (_945_expr).RightMostIdentifier(); - bool disjunctiveMatch0 = false; - if (_source38.is_Some) { - Dafny.ISequence value4 = _source38.dtor_value; - if (object.Equals(value4, Dafny.Sequence.UnicodeFromString("seq!"))) { - disjunctiveMatch0 = true; + { + if (_source33.is_Tuple) { + Dafny.ISequence _880_arguments = _source33.dtor_arguments; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_880_arguments, Dafny.Helpers.Id, Func>>>((_881_ind) => ((System.Func>)((_882_arg) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _881_ind), RAST.__default.IND), (_882_arg)._ToString(Dafny.Sequence.Concat(_881_ind, RAST.__default.IND))); + })))(ind), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_880_arguments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); + } + } + { + if (_source33.is_UnaryOp) { + Dafny.ISequence _883_op = _source33.dtor_op1; + RAST._IExpr _884_underlying = _source33.dtor_underlying; + DAST.Format._IUnaryOpFormat _885_format = _source33.dtor_format; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs41 = ((((this).printingInfo).NeedParenthesesFor((_884_underlying).printingInfo)) ? (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")"))) : (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")))); + Dafny.ISequence _886_leftP = _let_tmp_rhs41.dtor__0; + Dafny.ISequence _887_rightP = _let_tmp_rhs41.dtor__1; + Dafny.ISequence _888_leftOp = ((((_883_op).Equals(Dafny.Sequence.UnicodeFromString("&mut"))) && (!(_886_leftP).Equals(Dafny.Sequence.UnicodeFromString("(")))) ? (Dafny.Sequence.Concat(_883_op, Dafny.Sequence.UnicodeFromString(" "))) : ((((_883_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (Dafny.Sequence.UnicodeFromString("")) : (_883_op)))); + Dafny.ISequence _889_rightOp = (((_883_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (_883_op) : (Dafny.Sequence.UnicodeFromString(""))); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_888_leftOp, _886_leftP), (_884_underlying)._ToString(ind)), _887_rightP), _889_rightOp); + } + } + { + if (_source33.is_TypeAscription) { + RAST._IExpr _890_left = _source33.dtor_left; + RAST._IType _891_tpe = _source33.dtor_tpe; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs42 = (this).LeftParentheses(_890_left); + Dafny.ISequence _892_leftLeftP = _let_tmp_rhs42.dtor__0; + Dafny.ISequence _893_leftRightP = _let_tmp_rhs42.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_892_leftLeftP, (_890_left)._ToString(RAST.__default.IND)), _893_leftRightP), Dafny.Sequence.UnicodeFromString(" as ")), (_891_tpe)._ToString(RAST.__default.IND)); + } + } + { + if (_source33.is_BinaryOp) { + Dafny.ISequence _894_op2 = _source33.dtor_op2; + RAST._IExpr _895_left = _source33.dtor_left; + RAST._IExpr _896_right = _source33.dtor_right; + DAST.Format._IBinaryOpFormat _897_format = _source33.dtor_format2; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs43 = (this).LeftParentheses(_895_left); + Dafny.ISequence _898_leftLeftP = _let_tmp_rhs43.dtor__0; + Dafny.ISequence _899_leftRighP = _let_tmp_rhs43.dtor__1; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs44 = (this).RightParentheses(_896_right); + Dafny.ISequence _900_rightLeftP = _let_tmp_rhs44.dtor__0; + Dafny.ISequence _901_rightRightP = _let_tmp_rhs44.dtor__1; + Dafny.ISequence _902_opRendered = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), _894_op2), Dafny.Sequence.UnicodeFromString(" ")); + Dafny.ISequence _903_indLeft = (((_898_leftLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(ind, RAST.__default.IND)) : (ind)); + Dafny.ISequence _904_indRight = (((_900_rightLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(ind, RAST.__default.IND)) : (ind)); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_898_leftLeftP, (_895_left)._ToString(_903_indLeft)), _899_leftRighP), _902_opRendered), _900_rightLeftP), (_896_right)._ToString(_904_indRight)), _901_rightRightP); + } + } + { + if (_source33.is_DeclareVar) { + RAST._IDeclareType _905_declareType = _source33.dtor_declareType; + Dafny.ISequence _906_name = _source33.dtor_name; + Std.Wrappers._IOption _907_optType = _source33.dtor_optType; + Std.Wrappers._IOption _908_optExpr = _source33.dtor_optRhs; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("let "), ((object.Equals(_905_declareType, RAST.DeclareType.create_MUT())) ? (Dafny.Sequence.UnicodeFromString("mut ")) : (Dafny.Sequence.UnicodeFromString("")))), _906_name), (((_907_optType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(": "), ((_907_optType).dtor_value)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), (((_908_optExpr).is_Some) ? (Dafny.Helpers.Let, Dafny.ISequence>(((_908_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND)), _pat_let5_0 => Dafny.Helpers.Let, Dafny.ISequence>(_pat_let5_0, _909_optExprString => (((_909_optExprString).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("= /*issue with empty RHS*/"), ((((_908_optExpr).dtor_value).is_RawExpr) ? (Dafny.Sequence.UnicodeFromString("Empty Raw expr")) : (((((_908_optExpr).dtor_value).is_LiteralString) ? (Dafny.Sequence.UnicodeFromString("Empty string literal")) : (((((_908_optExpr).dtor_value).is_LiteralInt) ? (Dafny.Sequence.UnicodeFromString("Empty int literal")) : (Dafny.Sequence.UnicodeFromString("Another case"))))))))) : (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" = "), _909_optExprString)))))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); + } + } + { + if (_source33.is_Assign) { + Std.Wrappers._IOption _910_names = _source33.dtor_names; + RAST._IExpr _911_expr = _source33.dtor_rhs; + Dafny.ISequence _912_lhs = ((System.Func>)(() => { + Std.Wrappers._IOption _source34 = _910_names; + { + if (_source34.is_Some) { + RAST._IAssignLhs value0 = _source34.dtor_value; + if (value0.is_LocalVar) { + Dafny.ISequence _913_name = value0.dtor_name; + return Dafny.Sequence.Concat(_913_name, Dafny.Sequence.UnicodeFromString(" = ")); + } + } } - } - if (_source38.is_Some) { - Dafny.ISequence value5 = _source38.dtor_value; - if (object.Equals(value5, Dafny.Sequence.UnicodeFromString("map!"))) { - disjunctiveMatch0 = true; + { + if (_source34.is_Some) { + RAST._IAssignLhs value1 = _source34.dtor_value; + if (value1.is_SelectMember) { + RAST._IExpr _914_member = value1.dtor_on; + Dafny.ISequence _915_field = value1.dtor_field; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs45 = (RAST.Expr.create_Select(_914_member, _915_field)).LeftParentheses(_914_member); + Dafny.ISequence _916_leftP = _let_tmp_rhs45.dtor__0; + Dafny.ISequence _917_rightP = _let_tmp_rhs45.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_916_leftP, (_914_member)._ToString(ind)), _917_rightP), Dafny.Sequence.UnicodeFromString(".")), _915_field), Dafny.Sequence.UnicodeFromString(" = ")); + } + } + } + { + if (_source34.is_Some) { + RAST._IAssignLhs value2 = _source34.dtor_value; + if (value2.is_ExtractTuple) { + Dafny.ISequence> _918_names = value2.dtor_names; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString>(_918_names, ((System.Func, Dafny.ISequence>)((_919_name) => { + return _919_name; + })), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString(") = ")); + } + } + } + { + if (_source34.is_Some) { + RAST._IAssignLhs value3 = _source34.dtor_value; + if (value3.is_Index) { + RAST._IExpr _920_e = value3.dtor_expr; + Dafny.ISequence _921_indices = value3.dtor_indices; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs46 = (RAST.Expr.create_Call(_920_e, _921_indices)).LeftParentheses(_920_e); + Dafny.ISequence _922_leftP = _let_tmp_rhs46.dtor__0; + Dafny.ISequence _923_rightP = _let_tmp_rhs46.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_922_leftP, (_920_e)._ToString(ind)), _923_rightP), Dafny.Sequence.UnicodeFromString("[")), RAST.__default.SeqToString(_921_indices, Dafny.Helpers.Id, Func>>>((_924_ind) => ((System.Func>)((_925_index) => { + return (_925_index)._ToString(Dafny.Sequence.Concat(_924_ind, RAST.__default.IND)); + })))(ind), Dafny.Sequence.UnicodeFromString("]["))), Dafny.Sequence.UnicodeFromString("] = ")); + } + } + } + { + return Dafny.Sequence.UnicodeFromString("_ = "); + } + }))(); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(_912_lhs, (_911_expr)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(";")); + } + } + { + if (_source33.is_Labelled) { + Dafny.ISequence _926_name = _source33.dtor_lbl; + RAST._IExpr _927_underlying = _source33.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("'"), _926_name), Dafny.Sequence.UnicodeFromString(": ")), (_927_underlying)._ToString(ind)); + } + } + { + if (_source33.is_Break) { + Std.Wrappers._IOption> _928_optLbl = _source33.dtor_optLbl; + Std.Wrappers._IOption> _source35 = _928_optLbl; + { + if (_source35.is_Some) { + Dafny.ISequence _929_lbl = _source35.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("break '"), _929_lbl), Dafny.Sequence.UnicodeFromString(";")); } } - if (disjunctiveMatch0) { - return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("["), Dafny.Sequence.UnicodeFromString("]")); + { + return Dafny.Sequence.UnicodeFromString("break;"); } - bool disjunctiveMatch1 = false; - if (_source38.is_Some) { - Dafny.ISequence value6 = _source38.dtor_value; - if (object.Equals(value6, Dafny.Sequence.UnicodeFromString("set!"))) { - disjunctiveMatch1 = true; + } + } + { + if (_source33.is_Continue) { + Std.Wrappers._IOption> _930_optLbl = _source33.dtor_optLbl; + Std.Wrappers._IOption> _source36 = _930_optLbl; + { + if (_source36.is_Some) { + Dafny.ISequence _931_lbl = _source36.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("continue '"), _931_lbl), Dafny.Sequence.UnicodeFromString(";")); } } - if (_source38.is_Some) { - Dafny.ISequence value7 = _source38.dtor_value; - if (object.Equals(value7, Dafny.Sequence.UnicodeFromString("multiset!"))) { - disjunctiveMatch1 = true; - } + { + return Dafny.Sequence.UnicodeFromString("continue;"); } - if (disjunctiveMatch1) { - return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("{"), Dafny.Sequence.UnicodeFromString("}")); + } + } + { + if (_source33.is_Loop) { + Std.Wrappers._IOption _932_optCond = _source33.dtor_optCond; + RAST._IExpr _933_underlying = _source33.dtor_underlying; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((System.Func>)(() => { + Std.Wrappers._IOption _source37 = _932_optCond; + { + if (_source37.is_None) { + return Dafny.Sequence.UnicodeFromString("loop"); + } + } + { + RAST._IExpr _934_c = _source37.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("while "), (_934_c)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))); + } + }))(), Dafny.Sequence.UnicodeFromString(" {\n")), ind), RAST.__default.IND), (_933_underlying)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); + } + } + { + if (_source33.is_For) { + Dafny.ISequence _935_name = _source33.dtor_name; + RAST._IExpr _936_range = _source33.dtor_range; + RAST._IExpr _937_body = _source33.dtor_body; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("for "), _935_name), Dafny.Sequence.UnicodeFromString(" in ")), (_936_range)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), ind), RAST.__default.IND), (_937_body)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); + } + } + { + if (_source33.is_Return) { + Std.Wrappers._IOption _938_optExpr = _source33.dtor_optExpr; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("return"), (((_938_optExpr).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), ((_938_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); + } + } + { + if (_source33.is_CallType) { + RAST._IExpr _939_expr = _source33.dtor_obj; + Dafny.ISequence _940_tpes = _source33.dtor_typeParameters; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs47 = (this).LeftParentheses(_939_expr); + Dafny.ISequence _941_leftP = _let_tmp_rhs47.dtor__0; + Dafny.ISequence _942_rightP = _let_tmp_rhs47.dtor__1; + if ((_940_tpes).Equals(Dafny.Sequence.FromElements())) { + return (_939_expr)._ToString(ind); + } else { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_941_leftP, (_939_expr)._ToString(ind)), _942_rightP), Dafny.Sequence.UnicodeFromString("::<")), RAST.__default.SeqToString(_940_tpes, Dafny.Helpers.Id, Func>>>((_943_ind) => ((System.Func>)((_944_tpe) => { + return (_944_tpe)._ToString(Dafny.Sequence.Concat(_943_ind, RAST.__default.IND)); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">")); } - return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")")); - }))(); - Dafny.ISequence _949_leftCallP = _let_tmp_rhs49.dtor__0; - Dafny.ISequence _950_rightCallP = _let_tmp_rhs49.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_947_leftP, (_945_expr)._ToString(_pat_let_tv89)), _948_rightP), _949_leftCallP), RAST.__default.SeqToString(_946_args, Dafny.Helpers.Id, Func>>>((_951_ind) => ((System.Func>)((_952_arg) => { - return (_952_arg)._ToString(Dafny.Sequence.Concat(_951_ind, RAST.__default.IND)); - })))(_pat_let_tv90), Dafny.Sequence.UnicodeFromString(", "))), _950_rightCallP); - } - if (_source33.is_Select) { - RAST._IExpr _953_expression = _source33.dtor_obj; - Dafny.ISequence _954_name = _source33.dtor_name; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs50 = (this).LeftParentheses(_953_expression); - Dafny.ISequence _955_leftP = _let_tmp_rhs50.dtor__0; - Dafny.ISequence _956_rightP = _let_tmp_rhs50.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_955_leftP, (_953_expression)._ToString(_pat_let_tv91)), _956_rightP), Dafny.Sequence.UnicodeFromString(".")), _954_name); - } - if (_source33.is_MemberSelect) { - RAST._IExpr _957_expression = _source33.dtor_obj; - Dafny.ISequence _958_name = _source33.dtor_name; - _System._ITuple2, Dafny.ISequence> _let_tmp_rhs51 = (this).LeftParentheses(_957_expression); - Dafny.ISequence _959_leftP = _let_tmp_rhs51.dtor__0; - Dafny.ISequence _960_rightP = _let_tmp_rhs51.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_959_leftP, (_957_expression)._ToString(_pat_let_tv92)), _960_rightP), Dafny.Sequence.UnicodeFromString("::")), _958_name); - } - if (_source33.is_Lambda) { - Dafny.ISequence _961_params = _source33.dtor_params; - Std.Wrappers._IOption _962_retType = _source33.dtor_retType; - RAST._IExpr _963_body = _source33.dtor_body; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("move |"), RAST.__default.SeqToString(_961_params, Dafny.Helpers.Id, Func>>>((_964_ind) => ((System.Func>)((_965_arg) => { - return (_965_arg)._ToString(_964_ind); - })))(_pat_let_tv93), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString("| ")), (((_962_retType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("-> "), ((_962_retType).dtor_value)._ToString(_pat_let_tv94)), Dafny.Sequence.UnicodeFromString(" "))) : (Dafny.Sequence.UnicodeFromString("")))), (_963_body)._ToString(_pat_let_tv95)); - } - RAST._IExpr _966_r = _source33; - return RAST.__default.AddIndent((_966_r).dtor_content, _pat_let_tv96); + } + } + { + if (_source33.is_Call) { + RAST._IExpr _945_expr = _source33.dtor_obj; + Dafny.ISequence _946_args = _source33.dtor_arguments; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs48 = (this).LeftParentheses(_945_expr); + Dafny.ISequence _947_leftP = _let_tmp_rhs48.dtor__0; + Dafny.ISequence _948_rightP = _let_tmp_rhs48.dtor__1; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs49 = ((System.Func<_System._ITuple2, Dafny.ISequence>>)(() => { + Std.Wrappers._IOption> _source38 = (_945_expr).RightMostIdentifier(); + { + bool disjunctiveMatch0 = false; + if (_source38.is_Some) { + Dafny.ISequence value4 = _source38.dtor_value; + if (object.Equals(value4, Dafny.Sequence.UnicodeFromString("seq!"))) { + disjunctiveMatch0 = true; + } + } + if (_source38.is_Some) { + Dafny.ISequence value5 = _source38.dtor_value; + if (object.Equals(value5, Dafny.Sequence.UnicodeFromString("map!"))) { + disjunctiveMatch0 = true; + } + } + if (disjunctiveMatch0) { + return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("["), Dafny.Sequence.UnicodeFromString("]")); + } + } + { + bool disjunctiveMatch1 = false; + if (_source38.is_Some) { + Dafny.ISequence value6 = _source38.dtor_value; + if (object.Equals(value6, Dafny.Sequence.UnicodeFromString("set!"))) { + disjunctiveMatch1 = true; + } + } + if (_source38.is_Some) { + Dafny.ISequence value7 = _source38.dtor_value; + if (object.Equals(value7, Dafny.Sequence.UnicodeFromString("multiset!"))) { + disjunctiveMatch1 = true; + } + } + if (disjunctiveMatch1) { + return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("{"), Dafny.Sequence.UnicodeFromString("}")); + } + } + { + return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")")); + } + }))(); + Dafny.ISequence _949_leftCallP = _let_tmp_rhs49.dtor__0; + Dafny.ISequence _950_rightCallP = _let_tmp_rhs49.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_947_leftP, (_945_expr)._ToString(ind)), _948_rightP), _949_leftCallP), RAST.__default.SeqToString(_946_args, Dafny.Helpers.Id, Func>>>((_951_ind) => ((System.Func>)((_952_arg) => { + return (_952_arg)._ToString(Dafny.Sequence.Concat(_951_ind, RAST.__default.IND)); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), _950_rightCallP); + } + } + { + if (_source33.is_Select) { + RAST._IExpr _953_expression = _source33.dtor_obj; + Dafny.ISequence _954_name = _source33.dtor_name; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs50 = (this).LeftParentheses(_953_expression); + Dafny.ISequence _955_leftP = _let_tmp_rhs50.dtor__0; + Dafny.ISequence _956_rightP = _let_tmp_rhs50.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_955_leftP, (_953_expression)._ToString(ind)), _956_rightP), Dafny.Sequence.UnicodeFromString(".")), _954_name); + } + } + { + if (_source33.is_MemberSelect) { + RAST._IExpr _957_expression = _source33.dtor_obj; + Dafny.ISequence _958_name = _source33.dtor_name; + _System._ITuple2, Dafny.ISequence> _let_tmp_rhs51 = (this).LeftParentheses(_957_expression); + Dafny.ISequence _959_leftP = _let_tmp_rhs51.dtor__0; + Dafny.ISequence _960_rightP = _let_tmp_rhs51.dtor__1; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_959_leftP, (_957_expression)._ToString(ind)), _960_rightP), Dafny.Sequence.UnicodeFromString("::")), _958_name); + } + } + { + if (_source33.is_Lambda) { + Dafny.ISequence _961_params = _source33.dtor_params; + Std.Wrappers._IOption _962_retType = _source33.dtor_retType; + RAST._IExpr _963_body = _source33.dtor_body; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("move |"), RAST.__default.SeqToString(_961_params, Dafny.Helpers.Id, Func>>>((_964_ind) => ((System.Func>)((_965_arg) => { + return (_965_arg)._ToString(_964_ind); + })))(ind), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString("| ")), (((_962_retType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("-> "), ((_962_retType).dtor_value)._ToString(ind)), Dafny.Sequence.UnicodeFromString(" "))) : (Dafny.Sequence.UnicodeFromString("")))), (_963_body)._ToString(ind)); + } + } + { + RAST._IExpr _966_r = _source33; + return RAST.__default.AddIndent((_966_r).dtor_content, ind); + } } public RAST._IExpr Then(RAST._IExpr rhs2) { if ((this).is_StmtExpr) { @@ -4619,203 +4717,263 @@ public bool IsLhsIdentifier() { } public RAST._IPrintingInfo printingInfo { get { RAST._IExpr _source39 = this; - if (_source39.is_RawExpr) { - return RAST.PrintingInfo.create_UnknownPrecedence(); - } - if (_source39.is_ExprFromType) { - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } - if (_source39.is_Identifier) { - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } - if (_source39.is_LiteralInt) { - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } - if (_source39.is_LiteralBool) { - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } - if (_source39.is_LiteralString) { - return RAST.PrintingInfo.create_Precedence(BigInteger.One); - } - if (_source39.is_UnaryOp) { - Dafny.ISequence _967_op = _source39.dtor_op1; - RAST._IExpr _968_underlying = _source39.dtor_underlying; - DAST.Format._IUnaryOpFormat _969_format = _source39.dtor_format; - Dafny.ISequence _source40 = _967_op; - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("?"))) { - return RAST.PrintingInfo.create_SuffixPrecedence(new BigInteger(5)); - } - bool disjunctiveMatch2 = false; - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("-"))) { - disjunctiveMatch2 = true; + { + if (_source39.is_RawExpr) { + return RAST.PrintingInfo.create_UnknownPrecedence(); } - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("*"))) { - disjunctiveMatch2 = true; - } - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("!"))) { - disjunctiveMatch2 = true; - } - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("&"))) { - disjunctiveMatch2 = true; - } - if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("&mut"))) { - disjunctiveMatch2 = true; - } - if (disjunctiveMatch2) { - return RAST.PrintingInfo.create_Precedence(new BigInteger(6)); - } - return RAST.PrintingInfo.create_UnknownPrecedence(); } - if (_source39.is_Select) { - RAST._IExpr _970_underlying = _source39.dtor_obj; - Dafny.ISequence _971_name = _source39.dtor_name; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); - } - if (_source39.is_MemberSelect) { - RAST._IExpr _972_underlying = _source39.dtor_obj; - Dafny.ISequence _973_name = _source39.dtor_name; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); - } - if (_source39.is_CallType) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); - } - if (_source39.is_Call) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); - } - if (_source39.is_TypeAscription) { - RAST._IExpr _974_left = _source39.dtor_left; - RAST._IType _975_tpe = _source39.dtor_tpe; - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(10), RAST.Associativity.create_LeftToRight()); - } - if (_source39.is_BinaryOp) { - Dafny.ISequence _976_op2 = _source39.dtor_op2; - RAST._IExpr _977_left = _source39.dtor_left; - RAST._IExpr _978_right = _source39.dtor_right; - DAST.Format._IBinaryOpFormat _979_format = _source39.dtor_format2; - Dafny.ISequence _source41 = _976_op2; - bool disjunctiveMatch3 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("*"))) { - disjunctiveMatch3 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("/"))) { - disjunctiveMatch3 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("%"))) { - disjunctiveMatch3 = true; + { + if (_source39.is_ExprFromType) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (disjunctiveMatch3) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(20), RAST.Associativity.create_LeftToRight()); - } - bool disjunctiveMatch4 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("+"))) { - disjunctiveMatch4 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("-"))) { - disjunctiveMatch4 = true; - } - if (disjunctiveMatch4) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(30), RAST.Associativity.create_LeftToRight()); - } - bool disjunctiveMatch5 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<<"))) { - disjunctiveMatch5 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">>"))) { - disjunctiveMatch5 = true; - } - if (disjunctiveMatch5) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(40), RAST.Associativity.create_LeftToRight()); - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&"))) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(50), RAST.Associativity.create_LeftToRight()); - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("^"))) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(60), RAST.Associativity.create_LeftToRight()); - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("|"))) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(70), RAST.Associativity.create_LeftToRight()); - } - bool disjunctiveMatch6 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("=="))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("!="))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<"))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">"))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<="))) { - disjunctiveMatch6 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">="))) { - disjunctiveMatch6 = true; - } - if (disjunctiveMatch6) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(80), RAST.Associativity.create_RequiresParentheses()); - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&&"))) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(90), RAST.Associativity.create_LeftToRight()); - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("||"))) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(100), RAST.Associativity.create_LeftToRight()); - } - bool disjunctiveMatch7 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(".."))) { - disjunctiveMatch7 = true; - } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("..="))) { - disjunctiveMatch7 = true; - } - if (disjunctiveMatch7) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RequiresParentheses()); - } - bool disjunctiveMatch8 = false; - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_Identifier) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("+="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_LiteralInt) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("-="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_LiteralBool) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("*="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_LiteralString) { + return RAST.PrintingInfo.create_Precedence(BigInteger.One); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("/="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_UnaryOp) { + Dafny.ISequence _967_op = _source39.dtor_op1; + RAST._IExpr _968_underlying = _source39.dtor_underlying; + DAST.Format._IUnaryOpFormat _969_format = _source39.dtor_format; + Dafny.ISequence _source40 = _967_op; + { + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("?"))) { + return RAST.PrintingInfo.create_SuffixPrecedence(new BigInteger(5)); + } + } + { + bool disjunctiveMatch2 = false; + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("-"))) { + disjunctiveMatch2 = true; + } + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("*"))) { + disjunctiveMatch2 = true; + } + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("!"))) { + disjunctiveMatch2 = true; + } + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("&"))) { + disjunctiveMatch2 = true; + } + if (object.Equals(_source40, Dafny.Sequence.UnicodeFromString("&mut"))) { + disjunctiveMatch2 = true; + } + if (disjunctiveMatch2) { + return RAST.PrintingInfo.create_Precedence(new BigInteger(6)); + } + } + { + return RAST.PrintingInfo.create_UnknownPrecedence(); + } } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("%="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_Select) { + RAST._IExpr _970_underlying = _source39.dtor_obj; + Dafny.ISequence _971_name = _source39.dtor_name; + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_MemberSelect) { + RAST._IExpr _972_underlying = _source39.dtor_obj; + Dafny.ISequence _973_name = _source39.dtor_name; + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("|="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_CallType) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("^="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_Call) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<<="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_TypeAscription) { + RAST._IExpr _974_left = _source39.dtor_left; + RAST._IType _975_tpe = _source39.dtor_tpe; + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(10), RAST.Associativity.create_LeftToRight()); } - if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">>="))) { - disjunctiveMatch8 = true; + } + { + if (_source39.is_BinaryOp) { + Dafny.ISequence _976_op2 = _source39.dtor_op2; + RAST._IExpr _977_left = _source39.dtor_left; + RAST._IExpr _978_right = _source39.dtor_right; + DAST.Format._IBinaryOpFormat _979_format = _source39.dtor_format2; + Dafny.ISequence _source41 = _976_op2; + { + bool disjunctiveMatch3 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("*"))) { + disjunctiveMatch3 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("/"))) { + disjunctiveMatch3 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("%"))) { + disjunctiveMatch3 = true; + } + if (disjunctiveMatch3) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(20), RAST.Associativity.create_LeftToRight()); + } + } + { + bool disjunctiveMatch4 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("+"))) { + disjunctiveMatch4 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("-"))) { + disjunctiveMatch4 = true; + } + if (disjunctiveMatch4) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(30), RAST.Associativity.create_LeftToRight()); + } + } + { + bool disjunctiveMatch5 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<<"))) { + disjunctiveMatch5 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">>"))) { + disjunctiveMatch5 = true; + } + if (disjunctiveMatch5) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(40), RAST.Associativity.create_LeftToRight()); + } + } + { + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(50), RAST.Associativity.create_LeftToRight()); + } + } + { + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("^"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(60), RAST.Associativity.create_LeftToRight()); + } + } + { + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("|"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(70), RAST.Associativity.create_LeftToRight()); + } + } + { + bool disjunctiveMatch6 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("=="))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("!="))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<"))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">"))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<="))) { + disjunctiveMatch6 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">="))) { + disjunctiveMatch6 = true; + } + if (disjunctiveMatch6) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(80), RAST.Associativity.create_RequiresParentheses()); + } + } + { + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&&"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(90), RAST.Associativity.create_LeftToRight()); + } + } + { + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("||"))) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(100), RAST.Associativity.create_LeftToRight()); + } + } + { + bool disjunctiveMatch7 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(".."))) { + disjunctiveMatch7 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("..="))) { + disjunctiveMatch7 = true; + } + if (disjunctiveMatch7) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RequiresParentheses()); + } + } + { + bool disjunctiveMatch8 = false; + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("+="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("-="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("*="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("/="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("%="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("&="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("|="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("^="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString("<<="))) { + disjunctiveMatch8 = true; + } + if (object.Equals(_source41, Dafny.Sequence.UnicodeFromString(">>="))) { + disjunctiveMatch8 = true; + } + if (disjunctiveMatch8) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RightToLeft()); + } + } + { + return RAST.PrintingInfo.create_PrecedenceAssociativity(BigInteger.Zero, RAST.Associativity.create_RequiresParentheses()); + } } - if (disjunctiveMatch8) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RightToLeft()); + } + { + if (_source39.is_Lambda) { + return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(300), RAST.Associativity.create_LeftToRight()); } - return RAST.PrintingInfo.create_PrecedenceAssociativity(BigInteger.Zero, RAST.Associativity.create_RequiresParentheses()); } - if (_source39.is_Lambda) { - return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(300), RAST.Associativity.create_LeftToRight()); + { + return RAST.PrintingInfo.create_UnknownPrecedence(); } - return RAST.PrintingInfo.create_UnknownPrecedence(); } } } public class Expr_RawExpr : Expr { @@ -5818,26 +5976,30 @@ public Std.Wrappers._IOption dtor_body { } } public Dafny.ISequence _ToString(Dafny.ISequence ind) { - var _pat_let_tv97 = ind; - var _pat_let_tv98 = ind; - var _pat_let_tv99 = ind; - var _pat_let_tv100 = ind; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("fn "), (this).dtor_name), RAST.TypeParamDecl.ToStringMultiple((this).dtor_typeParams, ind)), Dafny.Sequence.UnicodeFromString("(")), RAST.__default.SeqToString((this).dtor_formals, Dafny.Helpers.Id, Func>>>((_980_ind) => ((System.Func>)((_981_formal) => { return (_981_formal)._ToString(_980_ind); })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")), ((System.Func>)(() => { Std.Wrappers._IOption _source42 = (this).dtor_returnType; - if (_source42.is_Some) { - RAST._IType _982_t = _source42.dtor_value; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" -> "), (_982_t)._ToString(_pat_let_tv97)); + { + if (_source42.is_Some) { + RAST._IType _982_t = _source42.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" -> "), (_982_t)._ToString(ind)); + } + } + { + return Dafny.Sequence.UnicodeFromString(""); } - return Dafny.Sequence.UnicodeFromString(""); }))()), ((((this).dtor_where).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind), RAST.__default.IND), (this).dtor_where)))), ((System.Func>)(() => { Std.Wrappers._IOption _source43 = (this).dtor_body; - if (_source43.is_None) { - return Dafny.Sequence.UnicodeFromString(";"); + { + if (_source43.is_None) { + return Dafny.Sequence.UnicodeFromString(";"); + } + } + { + RAST._IExpr _983_body = _source43.dtor_value; + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" {\n"), ind), RAST.__default.IND), (_983_body)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); } - RAST._IExpr _983_body = _source43.dtor_value; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" {\n"), _pat_let_tv98), RAST.__default.IND), (_983_body)._ToString(Dafny.Sequence.Concat(_pat_let_tv99, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv100), Dafny.Sequence.UnicodeFromString("}")); }))()); } } diff --git a/Source/DafnyCore/GeneratedFromDafny/Std_Wrappers.cs b/Source/DafnyCore/GeneratedFromDafny/Std_Wrappers.cs index ff89fe15313..fbcdc9cf5cf 100644 --- a/Source/DafnyCore/GeneratedFromDafny/Std_Wrappers.cs +++ b/Source/DafnyCore/GeneratedFromDafny/Std_Wrappers.cs @@ -67,31 +67,40 @@ public T Extract() { return (this).dtor_value; } public static T GetOr(Std.Wrappers._IOption _this, T @default) { - var _pat_let_tv0 = @default; Std.Wrappers._IOption _source0 = _this; - if (_source0.is_Some) { - T v = _source0.dtor_value; - return v; + { + if (_source0.is_Some) { + T v = _source0.dtor_value; + return v; + } + } + { + return @default; } - return _pat_let_tv0; } public Std.Wrappers._IResult ToResult<__E>(__E error) { - var _pat_let_tv1 = error; Std.Wrappers._IOption _source1 = this; - if (_source1.is_Some) { - T v = _source1.dtor_value; - return Std.Wrappers.Result.create_Success(v); + { + if (_source1.is_Some) { + T v = _source1.dtor_value; + return Std.Wrappers.Result.create_Success(v); + } + } + { + return Std.Wrappers.Result.create_Failure(error); } - return Std.Wrappers.Result.create_Failure(_pat_let_tv1); } public Std.Wrappers._IOutcome<__E> ToOutcome<__E>(__E error) { - var _pat_let_tv2 = error; Std.Wrappers._IOption _source2 = this; - if (_source2.is_Some) { - T v = _source2.dtor_value; - return Std.Wrappers.Outcome<__E>.create_Pass(); + { + if (_source2.is_Some) { + T v = _source2.dtor_value; + return Std.Wrappers.Outcome<__E>.create_Pass(); + } + } + { + return Std.Wrappers.Outcome<__E>.create_Fail(error); } - return Std.Wrappers.Outcome<__E>.create_Fail(_pat_let_tv2); } public static __FC Map<__FC>(Std.Wrappers._IOption _this, Func, __FC> rewrap) { return Dafny.Helpers.Id, __FC>>(rewrap)(_this); @@ -198,45 +207,59 @@ public R Extract() { return (this).dtor_value; } public static R GetOr(Std.Wrappers._IResult _this, R @default) { - var _pat_let_tv3 = @default; Std.Wrappers._IResult _source3 = _this; - if (_source3.is_Success) { - R s = _source3.dtor_value; - return s; + { + if (_source3.is_Success) { + R s = _source3.dtor_value; + return s; + } + } + { + E e = _source3.dtor_error; + return @default; } - E e = _source3.dtor_error; - return _pat_let_tv3; } public Std.Wrappers._IOption ToOption() { Std.Wrappers._IResult _source4 = this; - if (_source4.is_Success) { - R s = _source4.dtor_value; - return Std.Wrappers.Option.create_Some(s); + { + if (_source4.is_Success) { + R s = _source4.dtor_value; + return Std.Wrappers.Option.create_Some(s); + } + } + { + E _10_e = _source4.dtor_error; + return Std.Wrappers.Option.create_None(); } - E _10_e = _source4.dtor_error; - return Std.Wrappers.Option.create_None(); } public Std.Wrappers._IOutcome ToOutcome() { Std.Wrappers._IResult _source5 = this; - if (_source5.is_Success) { - R _11_s = _source5.dtor_value; - return Std.Wrappers.Outcome.create_Pass(); + { + if (_source5.is_Success) { + R _11_s = _source5.dtor_value; + return Std.Wrappers.Outcome.create_Pass(); + } + } + { + E _12_e = _source5.dtor_error; + return Std.Wrappers.Outcome.create_Fail(_12_e); } - E _12_e = _source5.dtor_error; - return Std.Wrappers.Outcome.create_Fail(_12_e); } public static __FC Map<__FC>(Std.Wrappers._IResult _this, Func, __FC> rewrap) { return Dafny.Helpers.Id, __FC>>(rewrap)(_this); } public static Std.Wrappers._IResult MapFailure<__NewE>(Std.Wrappers._IResult _this, Func reWrap) { - var _pat_let_tv4 = reWrap; Std.Wrappers._IResult _source6 = _this; - if (_source6.is_Success) { - R _13_s = _source6.dtor_value; - return Std.Wrappers.Result.create_Success(_13_s); + { + if (_source6.is_Success) { + R _13_s = _source6.dtor_value; + return Std.Wrappers.Result.create_Success(_13_s); + } + } + { + E _14_e = _source6.dtor_error; + return Std.Wrappers.Result.create_Failure(Dafny.Helpers.Id>(reWrap)(_14_e)); } - E _14_e = _source6.dtor_error; - return Std.Wrappers.Result.create_Failure(Dafny.Helpers.Id>(_pat_let_tv4)(_14_e)); } } public class Result_Success : Result { @@ -335,36 +358,44 @@ public Std.Wrappers._IOutcome PropagateFailure() { return this; } public Std.Wrappers._IOption<__R> ToOption<__R>(__R r) { - var _pat_let_tv5 = r; Std.Wrappers._IOutcome _source7 = this; - if (_source7.is_Pass) { - return Std.Wrappers.Option<__R>.create_Some(_pat_let_tv5); + { + if (_source7.is_Pass) { + return Std.Wrappers.Option<__R>.create_Some(r); + } + } + { + E _15_e = _source7.dtor_error; + return Std.Wrappers.Option<__R>.create_None(); } - E _15_e = _source7.dtor_error; - return Std.Wrappers.Option<__R>.create_None(); } public Std.Wrappers._IResult<__R, E> ToResult<__R>(__R r) { - var _pat_let_tv6 = r; Std.Wrappers._IOutcome _source8 = this; - if (_source8.is_Pass) { - return Std.Wrappers.Result<__R, E>.create_Success(_pat_let_tv6); + { + if (_source8.is_Pass) { + return Std.Wrappers.Result<__R, E>.create_Success(r); + } + } + { + E _16_e = _source8.dtor_error; + return Std.Wrappers.Result<__R, E>.create_Failure(_16_e); } - E _16_e = _source8.dtor_error; - return Std.Wrappers.Result<__R, E>.create_Failure(_16_e); } public static __FC Map<__FC>(Std.Wrappers._IOutcome _this, Func, __FC> rewrap) { return Dafny.Helpers.Id, __FC>>(rewrap)(_this); } public static Std.Wrappers._IResult<__T, __NewE> MapFailure<__T, __NewE>(Std.Wrappers._IOutcome _this, Func rewrap, __T @default) { - var _pat_let_tv7 = @default; - var _pat_let_tv8 = rewrap; Std.Wrappers._IOutcome _source9 = _this; - if (_source9.is_Pass) { - return Std.Wrappers.Result<__T, __NewE>.create_Success(_pat_let_tv7); + { + if (_source9.is_Pass) { + return Std.Wrappers.Result<__T, __NewE>.create_Success(@default); + } + } + { + E _17_e = _source9.dtor_error; + return Std.Wrappers.Result<__T, __NewE>.create_Failure(Dafny.Helpers.Id>(rewrap)(_17_e)); } - E _17_e = _source9.dtor_error; - return Std.Wrappers.Result<__T, __NewE>.create_Failure(Dafny.Helpers.Id>(_pat_let_tv8)(_17_e)); } public static Std.Wrappers._IOutcome Need(bool condition, E error) { From df1adf52e4a81e67bb456242a1ecc45b3713f073 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Tue, 9 Jul 2024 17:12:28 -0700 Subject: [PATCH 28/30] Update ignore file --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b1185b6697c..34f20c8c80f 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,7 @@ Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/**/*.html Source/IntegrationTests/TestFiles/LitTests/LitTest/**/*.dtr /Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/libs/usesLibrary-lib /Source/IntegrationTests/TestFiles/LitTests/LitTest/cli/projectFile/libs/usesLibrary.doo +Source/IntegrationTests/TestFiles/LitTests/LitTest/**/*.deps.json +Source/IntegrationTests/TestFiles/LitTests/LitTest/**/*.csproj +/Source/IntegrationTests/TestFiles/LitTests/LitTest/pythonmodule/multimodule/PythonModule2 +/Source/IntegrationTests/TestFiles/LitTests/LitTest/pythonmodule/singlemodule/dafnysource/PythonModule1 From 6e15f068259fdb412659d5d9432ec83b0293a170 Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Tue, 9 Jul 2024 17:18:31 -0700 Subject: [PATCH 29/30] Regenerate Dafny --- Source/DafnyCore/GeneratedFromDafny/DAST.cs | 88 +- Source/DafnyCore/GeneratedFromDafny/DCOMP.cs | 1528 +++++++++--------- Source/DafnyCore/GeneratedFromDafny/RAST.cs | 878 ++++------ 3 files changed, 1061 insertions(+), 1433 deletions(-) diff --git a/Source/DafnyCore/GeneratedFromDafny/DAST.cs b/Source/DafnyCore/GeneratedFromDafny/DAST.cs index e51db54e874..3e5da1aea22 100644 --- a/Source/DafnyCore/GeneratedFromDafny/DAST.cs +++ b/Source/DafnyCore/GeneratedFromDafny/DAST.cs @@ -559,114 +559,81 @@ public Dafny.ISequence dtor_TypeArg_a0 { } public abstract _IType DowncastClone(); public DAST._IType Replace(Dafny.IMap mapping) { - var _pat_let_tv23 = mapping; - var _pat_let_tv24 = mapping; - var _pat_let_tv25 = mapping; - var _pat_let_tv26 = mapping; - var _pat_let_tv27 = mapping; - var _pat_let_tv28 = mapping; - var _pat_let_tv29 = mapping; - var _pat_let_tv30 = mapping; - var _pat_let_tv31 = mapping; - var _pat_let_tv32 = mapping; - var _pat_let_tv33 = mapping; - var _pat_let_tv34 = mapping; - var _pat_let_tv35 = mapping; if ((mapping).Contains(this)) { return Dafny.Map.Select(mapping,this); } else { DAST._IType _source25 = this; - bool unmatched25 = true; - if (unmatched25) { + { if (_source25.is_UserDefined) { DAST._IResolvedType _761_resolved = _source25.dtor_resolved; - unmatched25 = false; - return DAST.Type.create_UserDefined((_761_resolved).Replace(_pat_let_tv23)); + return DAST.Type.create_UserDefined((_761_resolved).Replace(mapping)); } } - if (unmatched25) { + { if (_source25.is_Tuple) { Dafny.ISequence _762_arguments = _source25.dtor_Tuple_a0; - unmatched25 = false; return DAST.Type.create_Tuple(Std.Collections.Seq.__default.Map(Dafny.Helpers.Id, Dafny.ISequence, Func>>((_763_mapping, _764_arguments) => ((System.Func)((_765_t) => { return (_765_t).Replace(_763_mapping); -})))(_pat_let_tv24, _762_arguments), _762_arguments)); +})))(mapping, _762_arguments), _762_arguments)); } } - if (unmatched25) { + { if (_source25.is_Array) { DAST._IType _766_element = _source25.dtor_element; BigInteger _767_dims = _source25.dtor_dims; - unmatched25 = false; - return DAST.Type.create_Array((_766_element).Replace(_pat_let_tv25), _767_dims); + return DAST.Type.create_Array((_766_element).Replace(mapping), _767_dims); } } - if (unmatched25) { + { if (_source25.is_Seq) { DAST._IType _768_element = _source25.dtor_element; - unmatched25 = false; - return DAST.Type.create_Seq((_768_element).Replace(_pat_let_tv26)); + return DAST.Type.create_Seq((_768_element).Replace(mapping)); } } - if (unmatched25) { + { if (_source25.is_Set) { DAST._IType _769_element = _source25.dtor_element; - unmatched25 = false; - return DAST.Type.create_Set((_769_element).Replace(_pat_let_tv27)); + return DAST.Type.create_Set((_769_element).Replace(mapping)); } } - if (unmatched25) { + { if (_source25.is_Multiset) { DAST._IType _770_element = _source25.dtor_element; - unmatched25 = false; - return DAST.Type.create_Multiset((_770_element).Replace(_pat_let_tv28)); + return DAST.Type.create_Multiset((_770_element).Replace(mapping)); } } - if (unmatched25) { + { if (_source25.is_Map) { DAST._IType _771_key = _source25.dtor_key; DAST._IType _772_value = _source25.dtor_value; - unmatched25 = false; - return DAST.Type.create_Map((_771_key).Replace(_pat_let_tv29), (_772_value).Replace(_pat_let_tv30)); + return DAST.Type.create_Map((_771_key).Replace(mapping), (_772_value).Replace(mapping)); } } - if (unmatched25) { + { if (_source25.is_SetBuilder) { DAST._IType _773_element = _source25.dtor_element; - unmatched25 = false; - return DAST.Type.create_SetBuilder((_773_element).Replace(_pat_let_tv31)); + return DAST.Type.create_SetBuilder((_773_element).Replace(mapping)); } } - if (unmatched25) { + { if (_source25.is_MapBuilder) { DAST._IType _774_key = _source25.dtor_key; DAST._IType _775_value = _source25.dtor_value; - unmatched25 = false; - return DAST.Type.create_MapBuilder((_774_key).Replace(_pat_let_tv32), (_775_value).Replace(_pat_let_tv33)); + return DAST.Type.create_MapBuilder((_774_key).Replace(mapping), (_775_value).Replace(mapping)); } } - if (unmatched25) { + { if (_source25.is_Arrow) { Dafny.ISequence _776_args = _source25.dtor_args; DAST._IType _777_result = _source25.dtor_result; - unmatched25 = false; return DAST.Type.create_Arrow(Std.Collections.Seq.__default.Map(Dafny.Helpers.Id, Dafny.ISequence, Func>>((_778_mapping, _779_args) => ((System.Func)((_780_t) => { return (_780_t).Replace(_778_mapping); -})))(_pat_let_tv34, _776_args), _776_args), (_777_result).Replace(_pat_let_tv35)); +})))(mapping, _776_args), _776_args), (_777_result).Replace(mapping)); } } - if (unmatched25) { - bool disjunctiveMatch0 = false; - disjunctiveMatch0 = true; - disjunctiveMatch0 = true; - disjunctiveMatch0 = true; - disjunctiveMatch0 = true; - if (disjunctiveMatch0) { - unmatched25 = false; - return this; - } + { + return this; } - throw new System.Exception("unexpected control point"); } } } @@ -2326,26 +2293,21 @@ public Dafny.ISequence dtor_extendedTypes { } } public DAST._IResolvedType Replace(Dafny.IMap mapping) { - var _pat_let_tv36 = mapping; return DAST.ResolvedType.create((this).dtor_path, Std.Collections.Seq.__default.Map(Dafny.Helpers.Id, Func>>((_781_mapping) => ((System.Func)((_782_t) => { return (_782_t).Replace(_781_mapping); })))(mapping), (this).dtor_typeArgs), ((System.Func)(() => { DAST._IResolvedTypeBase _source26 = (this).dtor_kind; - bool unmatched26 = true; - if (unmatched26) { + { if (_source26.is_Newtype) { DAST._IType _783_baseType = _source26.dtor_baseType; DAST._INewtypeRange _784_range = _source26.dtor_range; bool _785_erase = _source26.dtor_erase; - unmatched26 = false; - return DAST.ResolvedTypeBase.create_Newtype((_783_baseType).Replace(_pat_let_tv36), _784_range, _785_erase); + return DAST.ResolvedTypeBase.create_Newtype((_783_baseType).Replace(mapping), _784_range, _785_erase); } } - if (unmatched26) { - unmatched26 = false; + { return (this).dtor_kind; } - throw new System.Exception("unexpected control point"); }))(), (this).dtor_attributes, (this).dtor_properMethods, Std.Collections.Seq.__default.Map(Dafny.Helpers.Id, Func>>((_786_mapping) => ((System.Func)((_787_t) => { return (_787_t).Replace(_786_mapping); })))(mapping), (this).dtor_extendedTypes)); diff --git a/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs b/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs index 66c86a7bedd..c43b40450cc 100644 --- a/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs +++ b/Source/DafnyCore/GeneratedFromDafny/DCOMP.cs @@ -133,41 +133,30 @@ public static bool is__idiomatic__rust__id(Dafny.ISequence i) { } public static Std.Wrappers._IOption TraitTypeContainingMethodAux(Dafny.ISequence rs, Dafny.ISequence dafnyName) { - var _pat_let_tv136 = dafnyName; - var _pat_let_tv137 = rs; - var _pat_let_tv138 = dafnyName; if ((new BigInteger((rs).Count)).Sign == 0) { return Std.Wrappers.Option.create_None(); } else { Std.Wrappers._IOption _1121_res = ((System.Func>)(() => { DAST._IType _source51 = (rs).Select(BigInteger.Zero); - bool unmatched51 = true; - if (unmatched51) { + { if (_source51.is_UserDefined) { DAST._IResolvedType _1122_resolvedType = _source51.dtor_resolved; - unmatched51 = false; - return DCOMP.__default.TraitTypeContainingMethod(_1122_resolvedType, _pat_let_tv136); + return DCOMP.__default.TraitTypeContainingMethod(_1122_resolvedType, dafnyName); } } - if (unmatched51) { - unmatched51 = false; + { return Std.Wrappers.Option.create_None(); } - throw new System.Exception("unexpected control point"); }))(); Std.Wrappers._IOption _source52 = _1121_res; - bool unmatched52 = true; - if (unmatched52) { + { if (_source52.is_Some) { - unmatched52 = false; return _1121_res; } } - if (unmatched52) { - unmatched52 = false; - return DCOMP.__default.TraitTypeContainingMethodAux((_pat_let_tv137).Drop(BigInteger.One), _pat_let_tv138); + { + return DCOMP.__default.TraitTypeContainingMethodAux((rs).Drop(BigInteger.One), dafnyName); } - throw new System.Exception("unexpected control point"); } } public static Std.Wrappers._IOption TraitTypeContainingMethod(DAST._IResolvedType r, Dafny.ISequence dafnyName) @@ -797,61 +786,60 @@ public RAST._IMod GenModule(DAST._IModule mod, Dafny.ISequence _1136_generated = Dafny.Sequence.Empty; DAST._IModuleItem _source53 = (body).Select(_1135_i); - bool unmatched53 = true; - if (unmatched53) { + { if (_source53.is_Module) { DAST._IModule _1137_m = _source53.dtor_Module_a0; - unmatched53 = false; RAST._IMod _1138_mm; RAST._IMod _out16; _out16 = (this).GenModule(_1137_m, containingPath); _1138_mm = _out16; _1136_generated = Dafny.Sequence.FromElements(RAST.ModDecl.create_ModDecl(_1138_mm)); + goto after_match1; } } - if (unmatched53) { + { if (_source53.is_Class) { DAST._IClass _1139_c = _source53.dtor_Class_a0; - unmatched53 = false; Dafny.ISequence _out17; _out17 = (this).GenClass(_1139_c, Dafny.Sequence>.Concat(containingPath, Dafny.Sequence>.FromElements((_1139_c).dtor_name))); _1136_generated = _out17; + goto after_match1; } } - if (unmatched53) { + { if (_source53.is_Trait) { DAST._ITrait _1140_t = _source53.dtor_Trait_a0; - unmatched53 = false; Dafny.ISequence _out18; _out18 = (this).GenTrait(_1140_t, containingPath); _1136_generated = _out18; + goto after_match1; } } - if (unmatched53) { + { if (_source53.is_Newtype) { DAST._INewtype _1141_n = _source53.dtor_Newtype_a0; - unmatched53 = false; Dafny.ISequence _out19; _out19 = (this).GenNewtype(_1141_n); _1136_generated = _out19; + goto after_match1; } } - if (unmatched53) { + { if (_source53.is_SynonymType) { DAST._ISynonymType _1142_s = _source53.dtor_SynonymType_a0; - unmatched53 = false; Dafny.ISequence _out20; _out20 = (this).GenSynonymType(_1142_s); _1136_generated = _out20; + goto after_match1; } } - if (unmatched53) { + { DAST._IDatatype _1143_d = _source53.dtor_Datatype_a0; - unmatched53 = false; Dafny.ISequence _out21; _out21 = (this).GenDatatype(_1143_d); _1136_generated = _out21; } + after_match1: ; s = Dafny.Sequence.Concat(s, _1136_generated); } return s; @@ -862,7 +850,11 @@ public void GenTypeParam(DAST._ITypeArgDecl tp, out DAST._IType typeArg, out RAS typeParam = RAST.TypeParamDecl.Default(); typeArg = DAST.Type.create_TypeArg((tp).dtor_name); Dafny.ISequence _1144_genTpConstraint; - _1144_genTpConstraint = ((((tp).dtor_bounds).Contains(DAST.TypeArgBound.create_SupportsEquality())) ? (Dafny.Sequence.FromElements(RAST.__default.DafnyTypeEq)) : (Dafny.Sequence.FromElements(RAST.__default.DafnyType))); + if (((tp).dtor_bounds).Contains(DAST.TypeArgBound.create_SupportsEquality())) { + _1144_genTpConstraint = Dafny.Sequence.FromElements(RAST.__default.DafnyTypeEq); + } else { + _1144_genTpConstraint = Dafny.Sequence.FromElements(RAST.__default.DafnyType); + } if (((tp).dtor_bounds).Contains(DAST.TypeArgBound.create_SupportsDefault())) { _1144_genTpConstraint = Dafny.Sequence.Concat(_1144_genTpConstraint, Dafny.Sequence.FromElements(((RAST.__default.std__type).MSel(Dafny.Sequence.UnicodeFromString("default"))).MSel(Dafny.Sequence.UnicodeFromString("Default")))); } @@ -942,11 +934,9 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) _1160_fieldRustName = DCOMP.__default.escapeName(((_1158_field).dtor_formal).dtor_name); _1155_fields = Dafny.Sequence.Concat(_1155_fields, Dafny.Sequence.FromElements(RAST.Field.create(RAST.Visibility.create_PUB(), RAST.Formal.create(_1160_fieldRustName, _1159_fieldType)))); Std.Wrappers._IOption _source54 = (_1158_field).dtor_defaultValue; - bool unmatched54 = true; - if (unmatched54) { + { if (_source54.is_Some) { DAST._IExpression _1161_e = _source54.dtor_value; - unmatched54 = false; { RAST._IExpr _1162_expr; DCOMP._IOwnership _1163___v48; @@ -960,10 +950,10 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) _1164___v49 = _out32; _1156_fieldInits = Dafny.Sequence.Concat(_1156_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1160_fieldRustName, _1162_expr))); } + goto after_match2; } } - if (unmatched54) { - unmatched54 = false; + { { RAST._IExpr _1165_default; _1165_default = RAST.__default.std__Default__default; @@ -973,6 +963,7 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) _1156_fieldInits = Dafny.Sequence.Concat(_1156_fieldInits, Dafny.Sequence.FromElements(RAST.AssignIdentifier.create(_1160_fieldRustName, _1165_default))); } } + after_match2: ; } BigInteger _hi8 = new BigInteger(((c).dtor_typeParams).Count); for (BigInteger _1166_typeParamI = BigInteger.Zero; _1166_typeParamI < _hi8; _1166_typeParamI++) { @@ -1017,15 +1008,13 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) DAST._IType _1178_superClass; _1178_superClass = ((c).dtor_superClasses).Select(_1177_i); DAST._IType _source55 = _1178_superClass; - bool unmatched55 = true; - if (unmatched55) { + { if (_source55.is_UserDefined) { DAST._IResolvedType resolved0 = _source55.dtor_resolved; Dafny.ISequence> _1179_traitPath = resolved0.dtor_path; Dafny.ISequence _1180_typeArgs = resolved0.dtor_typeArgs; DAST._IResolvedTypeBase kind0 = resolved0.dtor_kind; if (kind0.is_Trait) { - unmatched55 = false; { RAST._IType _1181_pathStr; RAST._IType _out39; @@ -1047,12 +1036,13 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1185_x)); s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1152_rTypeParamsDecls, ((RAST.__default.dafny__runtime__type).MSel((this).Upcast)).Apply(Dafny.Sequence.FromElements(RAST.Type.create_DynType(_1184_traitType))), RAST.Type.create_TypeApp(_1176_genSelfPath, _1151_rTypeParams), _1153_whereConstraints, Dafny.Sequence.FromElements(RAST.ImplMember.create_ImplMemberMacro(((RAST.__default.dafny__runtime).MSel((this).UpcastFnMacro)).Apply1(RAST.Expr.create_ExprFromType(RAST.Type.create_DynType(_1184_traitType))))))))); } + goto after_match3; } } } - if (unmatched55) { - unmatched55 = false; + { } + after_match3: ; } return s; } @@ -1128,20 +1118,19 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) _1204_constrainedTypeParams = RAST.TypeParamDecl.ToStringMultiple(_1202_rTypeParamsDecls, Dafny.Sequence.Concat(RAST.__default.IND, RAST.__default.IND)); RAST._IType _1205_underlyingType = RAST.Type.Default(); Std.Wrappers._IOption _source56 = DCOMP.COMP.NewtypeToRustType((c).dtor_base, (c).dtor_range); - bool unmatched56 = true; - if (unmatched56) { + { if (_source56.is_Some) { RAST._IType _1206_v = _source56.dtor_value; - unmatched56 = false; _1205_underlyingType = _1206_v; + goto after_match4; } } - if (unmatched56) { - unmatched56 = false; + { RAST._IType _out51; _out51 = (this).GenType((c).dtor_base, DCOMP.GenTypeContext.@default()); _1205_underlyingType = _out51; } + after_match4: ; DAST._IType _1207_resultingType; _1207_resultingType = DAST.Type.create_UserDefined(DAST.ResolvedType.create(Dafny.Sequence>.FromElements(), Dafny.Sequence.FromElements(), DAST.ResolvedTypeBase.create_Newtype((c).dtor_base, (c).dtor_range, false), (c).dtor_attributes, Dafny.Sequence>.FromElements(), Dafny.Sequence.FromElements())); Dafny.ISequence _1208_newtypeName; @@ -1150,14 +1139,16 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) RAST._IExpr _1209_fnBody; _1209_fnBody = RAST.Expr.create_Identifier(_1208_newtypeName); Std.Wrappers._IOption _source57 = (c).dtor_witnessExpr; - bool unmatched57 = true; - if (unmatched57) { + { if (_source57.is_Some) { DAST._IExpression _1210_e = _source57.dtor_value; - unmatched57 = false; { DAST._IExpression _1211_e; - _1211_e = ((object.Equals((c).dtor_base, _1207_resultingType)) ? (_1210_e) : (DAST.Expression.create_Convert(_1210_e, (c).dtor_base, _1207_resultingType))); + if (object.Equals((c).dtor_base, _1207_resultingType)) { + _1211_e = _1210_e; + } else { + _1211_e = DAST.Expression.create_Convert(_1210_e, (c).dtor_base, _1207_resultingType); + } RAST._IExpr _1212_eStr; DCOMP._IOwnership _1213___v55; Dafny.ISet> _1214___v56; @@ -1170,28 +1161,27 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) _1214___v56 = _out54; _1209_fnBody = (_1209_fnBody).Apply1(_1212_eStr); } + goto after_match5; } } - if (unmatched57) { - unmatched57 = false; + { { _1209_fnBody = (_1209_fnBody).Apply1(RAST.__default.std__Default__default); } } + after_match5: ; RAST._IImplMember _1215_body; _1215_body = RAST.ImplMember.create_FnDecl(RAST.Visibility.create_PRIV(), RAST.Fn.create(Dafny.Sequence.UnicodeFromString("default"), Dafny.Sequence.FromElements(), Dafny.Sequence.FromElements(), Std.Wrappers.Option.create_Some(RAST.Type.create_SelfOwned()), Dafny.Sequence.UnicodeFromString(""), Std.Wrappers.Option.create_Some(_1209_fnBody))); Std.Wrappers._IOption _source58 = (c).dtor_constraint; - bool unmatched58 = true; - if (unmatched58) { + { if (_source58.is_None) { - unmatched58 = false; + goto after_match6; } } - if (unmatched58) { + { DAST._INewtypeConstraint value8 = _source58.dtor_value; DAST._IFormal _1216_formal = value8.dtor_variable; Dafny.ISequence _1217_constraintStmts = value8.dtor_constraintStmts; - unmatched58 = false; RAST._IExpr _1218_rStmts; Dafny.ISet> _1219___v57; DCOMP._IEnvironment _1220_newEnv; @@ -1208,6 +1198,7 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) _1221_rFormals = _out58; s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(RAST.ModDecl.create_ImplDecl(RAST.Impl.create_Impl(_1202_rTypeParamsDecls, RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(_1208_newtypeName), _1201_rTypeParams), _1203_whereConstraints, Dafny.Sequence.FromElements(RAST.ImplMember.create_FnDecl(RAST.Visibility.create_PUB(), RAST.Fn.create(Dafny.Sequence.UnicodeFromString("is"), Dafny.Sequence.FromElements(), _1221_rFormals, Std.Wrappers.Option.create_Some(RAST.Type.create_Bool()), Dafny.Sequence.UnicodeFromString(""), Std.Wrappers.Option.create_Some(_1218_rStmts)))))))); } + after_match6: ; s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1202_rTypeParamsDecls, RAST.__default.DefaultTrait, RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(_1208_newtypeName), _1201_rTypeParams), _1203_whereConstraints, Dafny.Sequence.FromElements(_1215_body))))); s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1202_rTypeParamsDecls, RAST.__default.DafnyPrint, RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(_1208_newtypeName), _1201_rTypeParams), Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.FromElements(RAST.ImplMember.create_FnDecl(RAST.Visibility.create_PRIV(), RAST.Fn.create(Dafny.Sequence.UnicodeFromString("fmt_print"), Dafny.Sequence.FromElements(), Dafny.Sequence.FromElements(RAST.Formal.selfBorrowed, RAST.Formal.create(Dafny.Sequence.UnicodeFromString("_formatter"), RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("&mut ::std::fmt::Formatter"))), RAST.Formal.create(Dafny.Sequence.UnicodeFromString("in_seq"), RAST.Type.create_Bool())), Std.Wrappers.Option.create_Some(RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("::std::fmt::Result"))), Dafny.Sequence.UnicodeFromString(""), Std.Wrappers.Option.create_Some(RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::DafnyPrint::fmt_print(&self.0, _formatter, in_seq)")))))))))); s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(RAST.ModDecl.create_ImplDecl(RAST.Impl.create_ImplFor(_1202_rTypeParamsDecls, RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("::std::ops::Deref")), RAST.Type.create_TypeApp(RAST.Type.create_TIdentifier(_1208_newtypeName), _1201_rTypeParams), Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.FromElements(RAST.ImplMember.create_RawImplMember(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("type Target = "), (_1205_underlyingType)._ToString(DCOMP.__default.IND)), Dafny.Sequence.UnicodeFromString(";"))), RAST.ImplMember.create_FnDecl(RAST.Visibility.create_PRIV(), RAST.Fn.create(Dafny.Sequence.UnicodeFromString("deref"), Dafny.Sequence.FromElements(), Dafny.Sequence.FromElements(RAST.Formal.selfBorrowed), Std.Wrappers.Option.create_Some((RAST.__default.SelfBorrowed).MSel(Dafny.Sequence.UnicodeFromString("Target"))), Dafny.Sequence.UnicodeFromString(""), Std.Wrappers.Option.create_Some(RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("&self.0")))))))))); @@ -1239,11 +1230,9 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) _1228_resultingType = _out63; s = Dafny.Sequence.FromElements(RAST.ModDecl.create_TypeDecl(RAST.TypeSynonym.create(Dafny.Sequence>.FromElements(), _1227_synonymTypeName, _1224_rTypeParamsDecls, _1228_resultingType))); Std.Wrappers._IOption _source59 = (c).dtor_witnessExpr; - bool unmatched59 = true; - if (unmatched59) { + { if (_source59.is_Some) { DAST._IExpression _1229_e = _source59.dtor_value; - unmatched59 = false; { RAST._IExpr _1230_rStmts; Dafny.ISet> _1231___v58; @@ -1269,113 +1258,98 @@ public bool IsSameResolvedType(DAST._IResolvedType r1, DAST._IResolvedType r2) _1236_constantName = DCOMP.__default.escapeName(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_init_"), ((c).dtor_name))); s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(RAST.ModDecl.create_TopFnDecl(RAST.TopFnDecl.create(Dafny.Sequence>.FromElements(), RAST.Visibility.create_PUB(), RAST.Fn.create(_1236_constantName, Dafny.Sequence.FromElements(), Dafny.Sequence.FromElements(), Std.Wrappers.Option.create_Some(_1228_resultingType), Dafny.Sequence.UnicodeFromString(""), Std.Wrappers.Option.create_Some((_1230_rStmts).Then(_1233_rExpr))))))); } + goto after_match7; } } - if (unmatched59) { - unmatched59 = false; + { } + after_match7: ; return s; } public bool TypeIsEq(DAST._IType t) { DAST._IType _source60 = t; - bool unmatched60 = true; - if (unmatched60) { + { if (_source60.is_UserDefined) { - unmatched60 = false; return true; } } - if (unmatched60) { + { if (_source60.is_Tuple) { Dafny.ISequence _1237_ts = _source60.dtor_Tuple_a0; - unmatched60 = false; return Dafny.Helpers.Id, bool>>((_1238_ts) => Dafny.Helpers.Quantifier((_1238_ts).UniqueElements, true, (((_forall_var_5) => { DAST._IType _1239_t = (DAST._IType)_forall_var_5; return !((_1238_ts).Contains(_1239_t)) || ((this).TypeIsEq(_1239_t)); }))))(_1237_ts); } } - if (unmatched60) { + { if (_source60.is_Array) { DAST._IType _1240_t = _source60.dtor_element; - unmatched60 = false; return (this).TypeIsEq(_1240_t); } } - if (unmatched60) { + { if (_source60.is_Seq) { DAST._IType _1241_t = _source60.dtor_element; - unmatched60 = false; return (this).TypeIsEq(_1241_t); } } - if (unmatched60) { + { if (_source60.is_Set) { DAST._IType _1242_t = _source60.dtor_element; - unmatched60 = false; return (this).TypeIsEq(_1242_t); } } - if (unmatched60) { + { if (_source60.is_Multiset) { DAST._IType _1243_t = _source60.dtor_element; - unmatched60 = false; return (this).TypeIsEq(_1243_t); } } - if (unmatched60) { + { if (_source60.is_Map) { DAST._IType _1244_k = _source60.dtor_key; DAST._IType _1245_v = _source60.dtor_value; - unmatched60 = false; return ((this).TypeIsEq(_1244_k)) && ((this).TypeIsEq(_1245_v)); } } - if (unmatched60) { + { if (_source60.is_SetBuilder) { DAST._IType _1246_t = _source60.dtor_element; - unmatched60 = false; return (this).TypeIsEq(_1246_t); } } - if (unmatched60) { + { if (_source60.is_MapBuilder) { DAST._IType _1247_k = _source60.dtor_key; DAST._IType _1248_v = _source60.dtor_value; - unmatched60 = false; return ((this).TypeIsEq(_1247_k)) && ((this).TypeIsEq(_1248_v)); } } - if (unmatched60) { + { if (_source60.is_Arrow) { - unmatched60 = false; return false; } } - if (unmatched60) { + { if (_source60.is_Primitive) { - unmatched60 = false; return true; } } - if (unmatched60) { + { if (_source60.is_Passthrough) { - unmatched60 = false; return true; } } - if (unmatched60) { + { if (_source60.is_TypeArg) { Dafny.ISequence _1249_i = _source60.dtor_TypeArg_a0; - unmatched60 = false; return true; } } - if (unmatched60) { - unmatched60 = false; + { return true; } - throw new System.Exception("unexpected control point"); } public bool DatatypeIsEq(DAST._IDatatype c) { return (!((c).dtor_isCo)) && (Dafny.Helpers.Id>((_1250_c) => Dafny.Helpers.Quantifier(((_1250_c).dtor_ctors).UniqueElements, true, (((_forall_var_6) => { @@ -1575,7 +1549,9 @@ public bool DatatypeIsEq(DAST._IDatatype c) { goto continue0; } DAST._ITypeArgDecl _1307_coerceTypeParam; - _1307_coerceTypeParam = Dafny.Helpers.Let(_1303_typeParam, _pat_let9_0 => Dafny.Helpers.Let(_pat_let9_0, _1308_dt__update__tmp_h0 => Dafny.Helpers.Let, DAST._ITypeArgDecl>(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_T"), Std.Strings.__default.OfNat(_1302_typeI)), _pat_let10_0 => Dafny.Helpers.Let, DAST._ITypeArgDecl>(_pat_let10_0, _1309_dt__update_hname_h0 => DAST.TypeArgDecl.create(_1309_dt__update_hname_h0, (_1308_dt__update__tmp_h0).dtor_bounds, (_1308_dt__update__tmp_h0).dtor_variance))))); + DAST._ITypeArgDecl _1308_dt__update__tmp_h0 = _1303_typeParam; + Dafny.ISequence _1309_dt__update_hname_h0 = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_T"), Std.Strings.__default.OfNat(_1302_typeI)); + _1307_coerceTypeParam = DAST.TypeArgDecl.create(_1309_dt__update_hname_h0, (_1308_dt__update__tmp_h0).dtor_bounds, (_1308_dt__update__tmp_h0).dtor_variance); DAST._IType _1310_coerceTypeArg; RAST._ITypeParamDecl _1311_rCoerceTypeParamDecl; DAST._IType _out81; @@ -1618,7 +1594,11 @@ public bool DatatypeIsEq(DAST._IDatatype c) { Dafny.ISequence _1321_ctorMatch; _1321_ctorMatch = DCOMP.__default.escapeName((_1320_ctor).dtor_name); Dafny.ISequence _1322_modulePrefix; - _1322_modulePrefix = ((((((c).dtor_enclosingModule))).Equals(Dafny.Sequence.UnicodeFromString("_module"))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat((((c).dtor_enclosingModule)), Dafny.Sequence.UnicodeFromString(".")))); + if (((((c).dtor_enclosingModule))).Equals(Dafny.Sequence.UnicodeFromString("_module"))) { + _1322_modulePrefix = Dafny.Sequence.UnicodeFromString(""); + } else { + _1322_modulePrefix = Dafny.Sequence.Concat((((c).dtor_enclosingModule)), Dafny.Sequence.UnicodeFromString(".")); + } Dafny.ISequence _1323_ctorName; _1323_ctorName = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1322_modulePrefix, ((c).dtor_name)), Dafny.Sequence.UnicodeFromString(".")), ((_1320_ctor).dtor_name)); if (((new BigInteger((_1323_ctorName).Count)) >= (new BigInteger(13))) && (((_1323_ctorName).Subsequence(BigInteger.Zero, new BigInteger(13))).Equals(Dafny.Sequence.UnicodeFromString("_System.Tuple")))) { @@ -1650,7 +1630,11 @@ public bool DatatypeIsEq(DAST._IDatatype c) { if (_1327_isNumeric) { _1332_fieldName = Std.Wrappers.Option>.GetOr((_1330_dtor).dtor_callName, Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("v"), Std.Strings.__default.OfNat(_1329_j))); } - _1325_hashRhs = (((_1333_formalType).is_Arrow) ? ((_1325_hashRhs).Then(((RAST.Expr.create_LiteralInt(Dafny.Sequence.UnicodeFromString("0"))).Sel(Dafny.Sequence.UnicodeFromString("hash"))).Apply1(RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("_state"))))) : ((_1325_hashRhs).Then(((RAST.Expr.create_Identifier(_1332_fieldName)).Sel(Dafny.Sequence.UnicodeFromString("hash"))).Apply1(RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("_state")))))); + if ((_1333_formalType).is_Arrow) { + _1325_hashRhs = (_1325_hashRhs).Then(((RAST.Expr.create_LiteralInt(Dafny.Sequence.UnicodeFromString("0"))).Sel(Dafny.Sequence.UnicodeFromString("hash"))).Apply1(RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("_state")))); + } else { + _1325_hashRhs = (_1325_hashRhs).Then(((RAST.Expr.create_Identifier(_1332_fieldName)).Sel(Dafny.Sequence.UnicodeFromString("hash"))).Apply1(RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("_state")))); + } _1328_ctorMatchInner = Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1328_ctorMatchInner, ((_1327_isNumeric) ? (_1332_fieldName) : (_1331_patternName))), Dafny.Sequence.UnicodeFromString(", ")); if ((_1329_j).Sign == 1) { _1324_printRhs = (_1324_printRhs).Then(RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("write!(_formatter, \", \")?"))); @@ -1748,7 +1732,13 @@ public static RAST._IType GenPath(Dafny.ISequence> p r = RAST.Type.create_SelfOwned(); return r; } else { - r = ((((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("std"))) ? (RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString(""))) : (((((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("_System"))) ? (RAST.__default.dafny__runtime__type) : (RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("super")))))); + if (((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("std"))) { + r = RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("")); + } else if (((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("_System"))) { + r = RAST.__default.dafny__runtime__type; + } else { + r = RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("super")); + } BigInteger _hi22 = new BigInteger((p).Count); for (BigInteger _1354_i = BigInteger.Zero; _1354_i < _hi22; _1354_i++) { r = (r).MSel(DCOMP.__default.escapeName(((p).Select(_1354_i)))); @@ -1763,7 +1753,13 @@ public static RAST._IExpr GenPathExpr(Dafny.ISequence.UnicodeFromString("std"))) ? (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString(""))) : (((((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("_System"))) ? (RAST.__default.dafny__runtime) : (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("super")))))); + if (((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("std"))) { + r = RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("")); + } else if (((((p).Select(BigInteger.Zero)))).Equals(Dafny.Sequence.UnicodeFromString("_System"))) { + r = RAST.__default.dafny__runtime; + } else { + r = RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("super")); + } BigInteger _hi23 = new BigInteger((p).Count); for (BigInteger _1355_i = BigInteger.Zero; _1355_i < _hi23; _1355_i++) { r = (r).MSel(DCOMP.__default.escapeName(((p).Select(_1355_i)))); @@ -1792,11 +1788,9 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) { RAST._IType s = RAST.Type.Default(); DAST._IType _source61 = c; - bool unmatched61 = true; - if (unmatched61) { + { if (_source61.is_UserDefined) { DAST._IResolvedType _1358_resolved = _source61.dtor_resolved; - unmatched61 = false; { RAST._IType _1359_t; RAST._IType _out86; @@ -1804,32 +1798,30 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) _1359_t = _out86; Dafny.ISequence _1360_typeArgs; Dafny.ISequence _out87; - _out87 = (this).GenTypeArgs((_1358_resolved).dtor_typeArgs, Dafny.Helpers.Let(genTypeContext, _pat_let11_0 => Dafny.Helpers.Let(_pat_let11_0, _1361_dt__update__tmp_h0 => Dafny.Helpers.Let(false, _pat_let12_0 => Dafny.Helpers.Let(_pat_let12_0, _1362_dt__update_hforTraitParents_h0 => DCOMP.GenTypeContext.create((_1361_dt__update__tmp_h0).dtor_inBinding, (_1361_dt__update__tmp_h0).dtor_inFn, _1362_dt__update_hforTraitParents_h0)))))); + _out87 = (this).GenTypeArgs((_1358_resolved).dtor_typeArgs, Dafny.Helpers.Let(genTypeContext, _pat_let9_0 => Dafny.Helpers.Let(_pat_let9_0, _1361_dt__update__tmp_h0 => Dafny.Helpers.Let(false, _pat_let10_0 => Dafny.Helpers.Let(_pat_let10_0, _1362_dt__update_hforTraitParents_h0 => DCOMP.GenTypeContext.create((_1361_dt__update__tmp_h0).dtor_inBinding, (_1361_dt__update__tmp_h0).dtor_inFn, _1362_dt__update_hforTraitParents_h0)))))); _1360_typeArgs = _out87; s = RAST.Type.create_TypeApp(_1359_t, _1360_typeArgs); DAST._IResolvedTypeBase _source62 = (_1358_resolved).dtor_kind; - bool unmatched62 = true; - if (unmatched62) { + { if (_source62.is_Class) { - unmatched62 = false; { s = (this).Object(s); } + goto after_match9; } } - if (unmatched62) { + { if (_source62.is_Datatype) { - unmatched62 = false; { if ((this).IsRcWrapped((_1358_resolved).dtor_attributes)) { s = RAST.__default.Rc(s); } } + goto after_match9; } } - if (unmatched62) { + { if (_source62.is_Trait) { - unmatched62 = false; { if (((_1358_resolved).dtor_path).Equals(Dafny.Sequence>.FromElements(Dafny.Sequence.UnicodeFromString("_System"), Dafny.Sequence.UnicodeFromString("object")))) { s = ((RAST.__default.std__type).MSel(Dafny.Sequence.UnicodeFromString("any"))).MSel(Dafny.Sequence.UnicodeFromString("Any")); @@ -1838,48 +1830,48 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) s = (this).Object(RAST.Type.create_DynType(s)); } } + goto after_match9; } } - if (unmatched62) { + { DAST._IType _1363_t = _source62.dtor_baseType; DAST._INewtypeRange _1364_range = _source62.dtor_range; bool _1365_erased = _source62.dtor_erase; - unmatched62 = false; { if (_1365_erased) { Std.Wrappers._IOption _source63 = DCOMP.COMP.NewtypeToRustType(_1363_t, _1364_range); - bool unmatched63 = true; - if (unmatched63) { + { if (_source63.is_Some) { RAST._IType _1366_v = _source63.dtor_value; - unmatched63 = false; s = _1366_v; + goto after_match10; } } - if (unmatched63) { - unmatched63 = false; + { } + after_match10: ; } } } + after_match9: ; } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Object) { - unmatched61 = false; { s = ((RAST.__default.std__type).MSel(Dafny.Sequence.UnicodeFromString("any"))).MSel(Dafny.Sequence.UnicodeFromString("Any")); if (!((genTypeContext).dtor_forTraitParents)) { s = (this).Object(RAST.Type.create_DynType(s)); } } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Tuple) { Dafny.ISequence _1367_types = _source61.dtor_Tuple_a0; - unmatched61 = false; { Dafny.ISequence _1368_args; _1368_args = Dafny.Sequence.FromElements(); @@ -1888,27 +1880,31 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) while ((_1369_i) < (new BigInteger((_1367_types).Count))) { RAST._IType _1370_generated; RAST._IType _out88; - _out88 = (this).GenType((_1367_types).Select(_1369_i), Dafny.Helpers.Let(genTypeContext, _pat_let13_0 => Dafny.Helpers.Let(_pat_let13_0, _1371_dt__update__tmp_h1 => Dafny.Helpers.Let(false, _pat_let14_0 => Dafny.Helpers.Let(_pat_let14_0, _1372_dt__update_hforTraitParents_h1 => DCOMP.GenTypeContext.create((_1371_dt__update__tmp_h1).dtor_inBinding, (_1371_dt__update__tmp_h1).dtor_inFn, _1372_dt__update_hforTraitParents_h1)))))); + _out88 = (this).GenType((_1367_types).Select(_1369_i), Dafny.Helpers.Let(genTypeContext, _pat_let11_0 => Dafny.Helpers.Let(_pat_let11_0, _1371_dt__update__tmp_h1 => Dafny.Helpers.Let(false, _pat_let12_0 => Dafny.Helpers.Let(_pat_let12_0, _1372_dt__update_hforTraitParents_h1 => DCOMP.GenTypeContext.create((_1371_dt__update__tmp_h1).dtor_inBinding, (_1371_dt__update__tmp_h1).dtor_inFn, _1372_dt__update_hforTraitParents_h1)))))); _1370_generated = _out88; _1368_args = Dafny.Sequence.Concat(_1368_args, Dafny.Sequence.FromElements(_1370_generated)); _1369_i = (_1369_i) + (BigInteger.One); } - s = (((new BigInteger((_1367_types).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) ? (RAST.Type.create_TupleType(_1368_args)) : (RAST.__default.SystemTupleType(_1368_args))); + if ((new BigInteger((_1367_types).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) { + s = RAST.Type.create_TupleType(_1368_args); + } else { + s = RAST.__default.SystemTupleType(_1368_args); + } } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Array) { DAST._IType _1373_element = _source61.dtor_element; BigInteger _1374_dims = _source61.dtor_dims; - unmatched61 = false; { if ((_1374_dims) > (new BigInteger(16))) { s = RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("Array of dimensions greater than 16")); } else { RAST._IType _1375_elem; RAST._IType _out89; - _out89 = (this).GenType(_1373_element, Dafny.Helpers.Let(genTypeContext, _pat_let15_0 => Dafny.Helpers.Let(_pat_let15_0, _1376_dt__update__tmp_h2 => Dafny.Helpers.Let(false, _pat_let16_0 => Dafny.Helpers.Let(_pat_let16_0, _1377_dt__update_hforTraitParents_h2 => DCOMP.GenTypeContext.create((_1376_dt__update__tmp_h2).dtor_inBinding, (_1376_dt__update__tmp_h2).dtor_inFn, _1377_dt__update_hforTraitParents_h2)))))); + _out89 = (this).GenType(_1373_element, Dafny.Helpers.Let(genTypeContext, _pat_let13_0 => Dafny.Helpers.Let(_pat_let13_0, _1376_dt__update__tmp_h2 => Dafny.Helpers.Let(false, _pat_let14_0 => Dafny.Helpers.Let(_pat_let14_0, _1377_dt__update_hforTraitParents_h2 => DCOMP.GenTypeContext.create((_1376_dt__update__tmp_h2).dtor_inBinding, (_1376_dt__update__tmp_h2).dtor_inFn, _1377_dt__update_hforTraitParents_h2)))))); _1375_elem = _out89; if ((_1374_dims) == (BigInteger.One)) { s = RAST.Type.create_Array(_1375_elem, Std.Wrappers.Option>.create_None()); @@ -1921,56 +1917,56 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) } } } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Seq) { DAST._IType _1379_element = _source61.dtor_element; - unmatched61 = false; { RAST._IType _1380_elem; RAST._IType _out90; - _out90 = (this).GenType(_1379_element, Dafny.Helpers.Let(genTypeContext, _pat_let17_0 => Dafny.Helpers.Let(_pat_let17_0, _1381_dt__update__tmp_h3 => Dafny.Helpers.Let(false, _pat_let18_0 => Dafny.Helpers.Let(_pat_let18_0, _1382_dt__update_hforTraitParents_h3 => DCOMP.GenTypeContext.create((_1381_dt__update__tmp_h3).dtor_inBinding, (_1381_dt__update__tmp_h3).dtor_inFn, _1382_dt__update_hforTraitParents_h3)))))); + _out90 = (this).GenType(_1379_element, Dafny.Helpers.Let(genTypeContext, _pat_let15_0 => Dafny.Helpers.Let(_pat_let15_0, _1381_dt__update__tmp_h3 => Dafny.Helpers.Let(false, _pat_let16_0 => Dafny.Helpers.Let(_pat_let16_0, _1382_dt__update_hforTraitParents_h3 => DCOMP.GenTypeContext.create((_1381_dt__update__tmp_h3).dtor_inBinding, (_1381_dt__update__tmp_h3).dtor_inFn, _1382_dt__update_hforTraitParents_h3)))))); _1380_elem = _out90; s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements(_1380_elem)); } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Set) { DAST._IType _1383_element = _source61.dtor_element; - unmatched61 = false; { RAST._IType _1384_elem; RAST._IType _out91; - _out91 = (this).GenType(_1383_element, Dafny.Helpers.Let(genTypeContext, _pat_let19_0 => Dafny.Helpers.Let(_pat_let19_0, _1385_dt__update__tmp_h4 => Dafny.Helpers.Let(false, _pat_let20_0 => Dafny.Helpers.Let(_pat_let20_0, _1386_dt__update_hforTraitParents_h4 => DCOMP.GenTypeContext.create((_1385_dt__update__tmp_h4).dtor_inBinding, (_1385_dt__update__tmp_h4).dtor_inFn, _1386_dt__update_hforTraitParents_h4)))))); + _out91 = (this).GenType(_1383_element, Dafny.Helpers.Let(genTypeContext, _pat_let17_0 => Dafny.Helpers.Let(_pat_let17_0, _1385_dt__update__tmp_h4 => Dafny.Helpers.Let(false, _pat_let18_0 => Dafny.Helpers.Let(_pat_let18_0, _1386_dt__update_hforTraitParents_h4 => DCOMP.GenTypeContext.create((_1385_dt__update__tmp_h4).dtor_inBinding, (_1385_dt__update__tmp_h4).dtor_inFn, _1386_dt__update_hforTraitParents_h4)))))); _1384_elem = _out91; s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Set")), Dafny.Sequence.FromElements(_1384_elem)); } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Multiset) { DAST._IType _1387_element = _source61.dtor_element; - unmatched61 = false; { RAST._IType _1388_elem; RAST._IType _out92; - _out92 = (this).GenType(_1387_element, Dafny.Helpers.Let(genTypeContext, _pat_let21_0 => Dafny.Helpers.Let(_pat_let21_0, _1389_dt__update__tmp_h5 => Dafny.Helpers.Let(false, _pat_let22_0 => Dafny.Helpers.Let(_pat_let22_0, _1390_dt__update_hforTraitParents_h5 => DCOMP.GenTypeContext.create((_1389_dt__update__tmp_h5).dtor_inBinding, (_1389_dt__update__tmp_h5).dtor_inFn, _1390_dt__update_hforTraitParents_h5)))))); + _out92 = (this).GenType(_1387_element, Dafny.Helpers.Let(genTypeContext, _pat_let19_0 => Dafny.Helpers.Let(_pat_let19_0, _1389_dt__update__tmp_h5 => Dafny.Helpers.Let(false, _pat_let20_0 => Dafny.Helpers.Let(_pat_let20_0, _1390_dt__update_hforTraitParents_h5 => DCOMP.GenTypeContext.create((_1389_dt__update__tmp_h5).dtor_inBinding, (_1389_dt__update__tmp_h5).dtor_inFn, _1390_dt__update_hforTraitParents_h5)))))); _1388_elem = _out92; s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Multiset")), Dafny.Sequence.FromElements(_1388_elem)); } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Map) { DAST._IType _1391_key = _source61.dtor_key; DAST._IType _1392_value = _source61.dtor_value; - unmatched61 = false; { RAST._IType _1393_keyType; RAST._IType _out93; - _out93 = (this).GenType(_1391_key, Dafny.Helpers.Let(genTypeContext, _pat_let23_0 => Dafny.Helpers.Let(_pat_let23_0, _1394_dt__update__tmp_h6 => Dafny.Helpers.Let(false, _pat_let24_0 => Dafny.Helpers.Let(_pat_let24_0, _1395_dt__update_hforTraitParents_h6 => DCOMP.GenTypeContext.create((_1394_dt__update__tmp_h6).dtor_inBinding, (_1394_dt__update__tmp_h6).dtor_inFn, _1395_dt__update_hforTraitParents_h6)))))); + _out93 = (this).GenType(_1391_key, Dafny.Helpers.Let(genTypeContext, _pat_let21_0 => Dafny.Helpers.Let(_pat_let21_0, _1394_dt__update__tmp_h6 => Dafny.Helpers.Let(false, _pat_let22_0 => Dafny.Helpers.Let(_pat_let22_0, _1395_dt__update_hforTraitParents_h6 => DCOMP.GenTypeContext.create((_1394_dt__update__tmp_h6).dtor_inBinding, (_1394_dt__update__tmp_h6).dtor_inFn, _1395_dt__update_hforTraitParents_h6)))))); _1393_keyType = _out93; RAST._IType _1396_valueType; RAST._IType _out94; @@ -1978,17 +1974,17 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) _1396_valueType = _out94; s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Map")), Dafny.Sequence.FromElements(_1393_keyType, _1396_valueType)); } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_MapBuilder) { DAST._IType _1397_key = _source61.dtor_key; DAST._IType _1398_value = _source61.dtor_value; - unmatched61 = false; { RAST._IType _1399_keyType; RAST._IType _out95; - _out95 = (this).GenType(_1397_key, Dafny.Helpers.Let(genTypeContext, _pat_let25_0 => Dafny.Helpers.Let(_pat_let25_0, _1400_dt__update__tmp_h7 => Dafny.Helpers.Let(false, _pat_let26_0 => Dafny.Helpers.Let(_pat_let26_0, _1401_dt__update_hforTraitParents_h7 => DCOMP.GenTypeContext.create((_1400_dt__update__tmp_h7).dtor_inBinding, (_1400_dt__update__tmp_h7).dtor_inFn, _1401_dt__update_hforTraitParents_h7)))))); + _out95 = (this).GenType(_1397_key, Dafny.Helpers.Let(genTypeContext, _pat_let23_0 => Dafny.Helpers.Let(_pat_let23_0, _1400_dt__update__tmp_h7 => Dafny.Helpers.Let(false, _pat_let24_0 => Dafny.Helpers.Let(_pat_let24_0, _1401_dt__update_hforTraitParents_h7 => DCOMP.GenTypeContext.create((_1400_dt__update__tmp_h7).dtor_inBinding, (_1400_dt__update__tmp_h7).dtor_inFn, _1401_dt__update_hforTraitParents_h7)))))); _1399_keyType = _out95; RAST._IType _1402_valueType; RAST._IType _out96; @@ -1996,26 +1992,26 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) _1402_valueType = _out96; s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("MapBuilder")), Dafny.Sequence.FromElements(_1399_keyType, _1402_valueType)); } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_SetBuilder) { DAST._IType _1403_elem = _source61.dtor_element; - unmatched61 = false; { RAST._IType _1404_elemType; RAST._IType _out97; - _out97 = (this).GenType(_1403_elem, Dafny.Helpers.Let(genTypeContext, _pat_let27_0 => Dafny.Helpers.Let(_pat_let27_0, _1405_dt__update__tmp_h8 => Dafny.Helpers.Let(false, _pat_let28_0 => Dafny.Helpers.Let(_pat_let28_0, _1406_dt__update_hforTraitParents_h8 => DCOMP.GenTypeContext.create((_1405_dt__update__tmp_h8).dtor_inBinding, (_1405_dt__update__tmp_h8).dtor_inFn, _1406_dt__update_hforTraitParents_h8)))))); + _out97 = (this).GenType(_1403_elem, Dafny.Helpers.Let(genTypeContext, _pat_let25_0 => Dafny.Helpers.Let(_pat_let25_0, _1405_dt__update__tmp_h8 => Dafny.Helpers.Let(false, _pat_let26_0 => Dafny.Helpers.Let(_pat_let26_0, _1406_dt__update_hforTraitParents_h8 => DCOMP.GenTypeContext.create((_1405_dt__update__tmp_h8).dtor_inBinding, (_1405_dt__update__tmp_h8).dtor_inFn, _1406_dt__update_hforTraitParents_h8)))))); _1404_elemType = _out97; s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("SetBuilder")), Dafny.Sequence.FromElements(_1404_elemType)); } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Arrow) { Dafny.ISequence _1407_args = _source61.dtor_args; DAST._IType _1408_result = _source61.dtor_result; - unmatched61 = false; { Dafny.ISequence _1409_argTypes; _1409_argTypes = Dafny.Sequence.FromElements(); @@ -2024,7 +2020,7 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) while ((_1410_i) < (new BigInteger((_1407_args).Count))) { RAST._IType _1411_generated; RAST._IType _out98; - _out98 = (this).GenType((_1407_args).Select(_1410_i), Dafny.Helpers.Let(genTypeContext, _pat_let29_0 => Dafny.Helpers.Let(_pat_let29_0, _1412_dt__update__tmp_h9 => Dafny.Helpers.Let(false, _pat_let30_0 => Dafny.Helpers.Let(_pat_let30_0, _1413_dt__update_hforTraitParents_h9 => Dafny.Helpers.Let(true, _pat_let31_0 => Dafny.Helpers.Let(_pat_let31_0, _1414_dt__update_hinFn_h0 => DCOMP.GenTypeContext.create((_1412_dt__update__tmp_h9).dtor_inBinding, _1414_dt__update_hinFn_h0, _1413_dt__update_hforTraitParents_h9)))))))); + _out98 = (this).GenType((_1407_args).Select(_1410_i), Dafny.Helpers.Let(genTypeContext, _pat_let27_0 => Dafny.Helpers.Let(_pat_let27_0, _1412_dt__update__tmp_h9 => Dafny.Helpers.Let(false, _pat_let28_0 => Dafny.Helpers.Let(_pat_let28_0, _1413_dt__update_hforTraitParents_h9 => Dafny.Helpers.Let(true, _pat_let29_0 => Dafny.Helpers.Let(_pat_let29_0, _1414_dt__update_hinFn_h0 => DCOMP.GenTypeContext.create((_1412_dt__update__tmp_h9).dtor_inBinding, _1414_dt__update_hinFn_h0, _1413_dt__update_hforTraitParents_h9)))))))); _1411_generated = _out98; _1409_argTypes = Dafny.Sequence.Concat(_1409_argTypes, Dafny.Sequence.FromElements(RAST.Type.create_Borrowed(_1411_generated))); _1410_i = (_1410_i) + (BigInteger.One); @@ -2035,59 +2031,59 @@ public RAST._IType GenType(DAST._IType c, DCOMP._IGenTypeContext genTypeContext) _1415_resultType = _out99; s = RAST.__default.Rc(RAST.Type.create_DynType(RAST.Type.create_FnType(_1409_argTypes, _1415_resultType))); } + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_TypeArg) { Dafny.ISequence _h90 = _source61.dtor_TypeArg_a0; Dafny.ISequence _1416_name = _h90; - unmatched61 = false; s = RAST.Type.create_TIdentifier(DCOMP.__default.escapeName(_1416_name)); + goto after_match8; } } - if (unmatched61) { + { if (_source61.is_Primitive) { DAST._IPrimitive _1417_p = _source61.dtor_Primitive_a0; - unmatched61 = false; { DAST._IPrimitive _source64 = _1417_p; - bool unmatched64 = true; - if (unmatched64) { + { if (_source64.is_Int) { - unmatched64 = false; s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("DafnyInt")); + goto after_match11; } } - if (unmatched64) { + { if (_source64.is_Real) { - unmatched64 = false; s = (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("BigRational")); + goto after_match11; } } - if (unmatched64) { + { if (_source64.is_String) { - unmatched64 = false; s = RAST.Type.create_TypeApp((RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("Sequence")), Dafny.Sequence.FromElements((RAST.__default.dafny__runtime__type).MSel((this).DafnyChar))); + goto after_match11; } } - if (unmatched64) { + { if (_source64.is_Bool) { - unmatched64 = false; s = RAST.Type.create_Bool(); + goto after_match11; } } - if (unmatched64) { - unmatched64 = false; + { s = (RAST.__default.dafny__runtime__type).MSel((this).DafnyChar); } + after_match11: ; } + goto after_match8; } } - if (unmatched61) { + { Dafny.ISequence _1418_v = _source61.dtor_Passthrough_a0; - unmatched61 = false; s = RAST.__default.RawType(_1418_v); } + after_match8: ; return s; } public bool EnclosingIsTrait(DAST._IType tpe) { @@ -2102,17 +2098,13 @@ public void GenClassImplBody(Dafny.ISequence body, bool forTrait, BigInteger _hi25 = new BigInteger((body).Count); for (BigInteger _1419_i = BigInteger.Zero; _1419_i < _hi25; _1419_i++) { DAST._IMethod _source65 = (body).Select(_1419_i); - bool unmatched65 = true; - if (unmatched65) { + { DAST._IMethod _1420_m = _source65; - unmatched65 = false; { Std.Wrappers._IOption>> _source66 = (_1420_m).dtor_overridingPath; - bool unmatched66 = true; - if (unmatched66) { + { if (_source66.is_Some) { Dafny.ISequence> _1421_p = _source66.dtor_value; - unmatched66 = false; { Dafny.ISequence _1422_existing; _1422_existing = Dafny.Sequence.FromElements(); @@ -2129,10 +2121,10 @@ public void GenClassImplBody(Dafny.ISequence body, bool forTrait, _1422_existing = Dafny.Sequence.Concat(_1422_existing, Dafny.Sequence.FromElements(_1423_genMethod)); traitBodies = Dafny.Map>, Dafny.ISequence>.Merge(traitBodies, Dafny.Map>, Dafny.ISequence>.FromElements(new Dafny.Pair>, Dafny.ISequence>(_1421_p, _1422_existing))); } + goto after_match13; } } - if (unmatched66) { - unmatched66 = false; + { { RAST._IImplMember _1424_generated; RAST._IImplMember _out101; @@ -2141,8 +2133,10 @@ public void GenClassImplBody(Dafny.ISequence body, bool forTrait, s = Dafny.Sequence.Concat(s, Dafny.Sequence.FromElements(_1424_generated)); } } + after_match13: ; } } + after_match12: ; } } public Dafny.ISequence GenParams(Dafny.ISequence @params) @@ -2196,28 +2190,27 @@ public RAST._IImplMember GenMethod(DAST._IMethod m, bool forTrait, DAST._IType e if ((m).dtor_outVarsAreUninitFieldsToAssign) { _1437_selfId = Dafny.Sequence.UnicodeFromString("this"); } - var _pat_let_tv139 = enclosingTypeParams; - var _pat_let_tv140 = enclosingType; + var _pat_let_tv2 = enclosingTypeParams; DAST._IType _1438_instanceType; - _1438_instanceType = ((System.Func)(() => { - DAST._IType _source67 = enclosingType; - bool unmatched67 = true; - if (unmatched67) { - if (_source67.is_UserDefined) { - DAST._IResolvedType _1439_r = _source67.dtor_resolved; - unmatched67 = false; - return DAST.Type.create_UserDefined(Dafny.Helpers.Let(_1439_r, _pat_let32_0 => Dafny.Helpers.Let(_pat_let32_0, _1440_dt__update__tmp_h0 => Dafny.Helpers.Let, DAST._IResolvedType>(_pat_let_tv139, _pat_let33_0 => Dafny.Helpers.Let, DAST._IResolvedType>(_pat_let33_0, _1441_dt__update_htypeArgs_h0 => DAST.ResolvedType.create((_1440_dt__update__tmp_h0).dtor_path, _1441_dt__update_htypeArgs_h0, (_1440_dt__update__tmp_h0).dtor_kind, (_1440_dt__update__tmp_h0).dtor_attributes, (_1440_dt__update__tmp_h0).dtor_properMethods, (_1440_dt__update__tmp_h0).dtor_extendedTypes)))))); - } - } - if (unmatched67) { - unmatched67 = false; - return _pat_let_tv140; + DAST._IType _source67 = enclosingType; + { + if (_source67.is_UserDefined) { + DAST._IResolvedType _1439_r = _source67.dtor_resolved; + _1438_instanceType = DAST.Type.create_UserDefined(Dafny.Helpers.Let(_1439_r, _pat_let30_0 => Dafny.Helpers.Let(_pat_let30_0, _1440_dt__update__tmp_h0 => Dafny.Helpers.Let, DAST._IResolvedType>(_pat_let_tv2, _pat_let31_0 => Dafny.Helpers.Let, DAST._IResolvedType>(_pat_let31_0, _1441_dt__update_htypeArgs_h0 => DAST.ResolvedType.create((_1440_dt__update__tmp_h0).dtor_path, _1441_dt__update_htypeArgs_h0, (_1440_dt__update__tmp_h0).dtor_kind, (_1440_dt__update__tmp_h0).dtor_attributes, (_1440_dt__update__tmp_h0).dtor_properMethods, (_1440_dt__update__tmp_h0).dtor_extendedTypes)))))); + goto after_match14; } - throw new System.Exception("unexpected control point"); - }))(); + } + { + _1438_instanceType = enclosingType; + } + after_match14: ; if (forTrait) { RAST._IFormal _1442_selfFormal; - _1442_selfFormal = (((m).dtor_wasFunction) ? (RAST.Formal.selfBorrowed) : (RAST.Formal.selfBorrowedMut)); + if ((m).dtor_wasFunction) { + _1442_selfFormal = RAST.Formal.selfBorrowed; + } else { + _1442_selfFormal = RAST.Formal.selfBorrowedMut; + } _1428_params = Dafny.Sequence.Concat(Dafny.Sequence.FromElements(_1442_selfFormal), _1428_params); } else { RAST._IType _1443_tpe; @@ -2258,7 +2251,11 @@ public RAST._IImplMember GenMethod(DAST._IMethod m, bool forTrait, DAST._IType e _1445_typeI = (_1445_typeI) + (BigInteger.One); } RAST._IVisibility _1447_visibility; - _1447_visibility = ((forTrait) ? (RAST.Visibility.create_PRIV()) : (RAST.Visibility.create_PUB())); + if (forTrait) { + _1447_visibility = RAST.Visibility.create_PRIV(); + } else { + _1447_visibility = RAST.Visibility.create_PUB(); + } Dafny.ISequence _1448_typeParamsFiltered; _1448_typeParamsFiltered = Dafny.Sequence.FromElements(); BigInteger _hi28 = new BigInteger(((m).dtor_typeParams).Count); @@ -2281,8 +2278,9 @@ public RAST._IImplMember GenMethod(DAST._IMethod m, bool forTrait, DAST._IType e (this).GenTypeParam((_1448_typeParamsFiltered).Select(_1452_i), out _out106, out _out107); _1453_typeArg = _out106; _1454_rTypeParamDecl = _out107; - var _pat_let_tv141 = _1454_rTypeParamDecl; - _1454_rTypeParamDecl = Dafny.Helpers.Let(_1454_rTypeParamDecl, _pat_let34_0 => Dafny.Helpers.Let(_pat_let34_0, _1455_dt__update__tmp_h1 => Dafny.Helpers.Let, RAST._ITypeParamDecl>(Dafny.Sequence.Concat((_pat_let_tv141).dtor_constraints, Dafny.Sequence.FromElements(((RAST.__default.std__type).MSel(Dafny.Sequence.UnicodeFromString("default"))).MSel(Dafny.Sequence.UnicodeFromString("Default")))), _pat_let35_0 => Dafny.Helpers.Let, RAST._ITypeParamDecl>(_pat_let35_0, _1456_dt__update_hconstraints_h0 => RAST.TypeParamDecl.create((_1455_dt__update__tmp_h1).dtor_content, _1456_dt__update_hconstraints_h0))))); + RAST._ITypeParamDecl _1455_dt__update__tmp_h1 = _1454_rTypeParamDecl; + Dafny.ISequence _1456_dt__update_hconstraints_h0 = Dafny.Sequence.Concat((_1454_rTypeParamDecl).dtor_constraints, Dafny.Sequence.FromElements(((RAST.__default.std__type).MSel(Dafny.Sequence.UnicodeFromString("default"))).MSel(Dafny.Sequence.UnicodeFromString("Default")))); + _1454_rTypeParamDecl = RAST.TypeParamDecl.create((_1455_dt__update__tmp_h1).dtor_content, _1456_dt__update_hconstraints_h0); _1451_typeParams = Dafny.Sequence.Concat(_1451_typeParams, Dafny.Sequence.FromElements(_1454_rTypeParamDecl)); } } @@ -2298,11 +2296,9 @@ public RAST._IImplMember GenMethod(DAST._IMethod m, bool forTrait, DAST._IType e Std.Wrappers._IOption>> _1462_earlyReturn; _1462_earlyReturn = Std.Wrappers.Option>>.create_None(); Std.Wrappers._IOption>> _source68 = (m).dtor_outVars; - bool unmatched68 = true; - if (unmatched68) { + { if (_source68.is_Some) { Dafny.ISequence> _1463_outVars = _source68.dtor_value; - unmatched68 = false; { if ((m).dtor_outVarsAreUninitFieldsToAssign) { _1462_earlyReturn = Std.Wrappers.Option>>.create_Some(Dafny.Sequence>.FromElements()); @@ -2333,18 +2329,23 @@ public RAST._IImplMember GenMethod(DAST._IMethod m, bool forTrait, DAST._IType e _1472_outName = DCOMP.__default.escapeName((_1470_outVar)); _1429_paramNames = Dafny.Sequence>.Concat(_1429_paramNames, Dafny.Sequence>.FromElements(_1472_outName)); RAST._IType _1473_outMaybeType; - _1473_outMaybeType = (((_1471_outType).CanReadWithoutClone()) ? (_1471_outType) : (RAST.__default.MaybePlaceboType(_1471_outType))); + if ((_1471_outType).CanReadWithoutClone()) { + _1473_outMaybeType = _1471_outType; + } else { + _1473_outMaybeType = RAST.__default.MaybePlaceboType(_1471_outType); + } _1430_paramTypes = Dafny.Map, RAST._IType>.Update(_1430_paramTypes, _1472_outName, _1473_outMaybeType); _1468_tupleArgs = Dafny.Sequence>.Concat(_1468_tupleArgs, Dafny.Sequence>.FromElements(_1472_outName)); } _1462_earlyReturn = Std.Wrappers.Option>>.create_Some(_1468_tupleArgs); } } + goto after_match15; } } - if (unmatched68) { - unmatched68 = false; + { } + after_match15: ; _1458_env = DCOMP.Environment.create(Dafny.Sequence>.Concat(_1460_preAssignNames, _1429_paramNames), Dafny.Map, RAST._IType>.Merge(_1461_preAssignTypes, _1430_paramTypes)); RAST._IExpr _1474_body; Dafny.ISet> _1475___v69; @@ -2382,42 +2383,40 @@ public void GenStmts(Dafny.ISequence stmts, DCOMP._ISelfInfo s DAST._IStatement _1480_stmt; _1480_stmt = (_1479_stmts).Select(_1478_i); DAST._IStatement _source69 = _1480_stmt; - bool unmatched69 = true; - if (unmatched69) { + { if (_source69.is_DeclareVar) { Dafny.ISequence _1481_name = _source69.dtor_name; DAST._IType _1482_optType = _source69.dtor_typ; Std.Wrappers._IOption maybeValue0 = _source69.dtor_maybeValue; if (maybeValue0.is_None) { - unmatched69 = false; if (((_1478_i) + (BigInteger.One)) < (new BigInteger((_1479_stmts).Count))) { DAST._IStatement _source70 = (_1479_stmts).Select((_1478_i) + (BigInteger.One)); - bool unmatched70 = true; - if (unmatched70) { + { if (_source70.is_Assign) { DAST._IAssignLhs lhs0 = _source70.dtor_lhs; if (lhs0.is_Ident) { Dafny.ISequence ident0 = lhs0.dtor_ident; Dafny.ISequence _1483_name2 = ident0; DAST._IExpression _1484_rhs = _source70.dtor_value; - unmatched70 = false; if (object.Equals(_1483_name2, _1481_name)) { _1479_stmts = Dafny.Sequence.Concat(Dafny.Sequence.Concat((_1479_stmts).Subsequence(BigInteger.Zero, _1478_i), Dafny.Sequence.FromElements(DAST.Statement.create_DeclareVar(_1481_name, _1482_optType, Std.Wrappers.Option.create_Some(_1484_rhs)))), (_1479_stmts).Drop((_1478_i) + (new BigInteger(2)))); _1480_stmt = (_1479_stmts).Select(_1478_i); } + goto after_match17; } } } - if (unmatched70) { - unmatched70 = false; + { } + after_match17: ; } + goto after_match16; } } } - if (unmatched69) { - unmatched69 = false; + { } + after_match16: ; RAST._IExpr _1485_stmtExpr; Dafny.ISet> _1486_recIdents; DCOMP._IEnvironment _1487_newEnv2; @@ -2430,19 +2429,18 @@ public void GenStmts(Dafny.ISequence stmts, DCOMP._ISelfInfo s _1487_newEnv2 = _out114; newEnv = _1487_newEnv2; DAST._IStatement _source71 = _1480_stmt; - bool unmatched71 = true; - if (unmatched71) { + { if (_source71.is_DeclareVar) { Dafny.ISequence _1488_name = _source71.dtor_name; - unmatched71 = false; { _1477_declarations = Dafny.Set>.Union(_1477_declarations, Dafny.Set>.FromElements(DCOMP.__default.escapeName(_1488_name))); } + goto after_match18; } } - if (unmatched71) { - unmatched71 = false; + { } + after_match18: ; readIdents = Dafny.Set>.Union(readIdents, Dafny.Set>.Difference(_1486_recIdents, _1477_declarations)); generated = (generated).Then(_1485_stmtExpr); _1478_i = (_1478_i) + (BigInteger.One); @@ -2461,12 +2459,10 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, DCOMP._ISelfInfo newEnv = DCOMP.Environment.Default(); newEnv = env; DAST._IAssignLhs _source72 = lhs; - bool unmatched72 = true; - if (unmatched72) { + { if (_source72.is_Ident) { Dafny.ISequence ident1 = _source72.dtor_ident; Dafny.ISequence _1489_id = ident1; - unmatched72 = false; { Dafny.ISequence _1490_idRust; _1490_idRust = DCOMP.__default.escapeName(_1489_id); @@ -2478,13 +2474,13 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, DCOMP._ISelfInfo readIdents = Dafny.Set>.FromElements(_1490_idRust); needsIIFE = false; } + goto after_match19; } } - if (unmatched72) { + { if (_source72.is_Select) { DAST._IExpression _1491_on = _source72.dtor_expr; Dafny.ISequence _1492_field = _source72.dtor_field; - unmatched72 = false; { Dafny.ISequence _1493_fieldName; _1493_fieldName = DCOMP.__default.escapeName(_1492_field); @@ -2499,9 +2495,8 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, DCOMP._ISelfInfo _1495_onOwned = _out116; _1496_recIdents = _out117; RAST._IExpr _source73 = _1494_onExpr; - bool unmatched73 = true; - if (unmatched73) { - bool disjunctiveMatch11 = false; + { + bool disjunctiveMatch10 = false; if (_source73.is_Call) { RAST._IExpr obj2 = _source73.dtor_obj; if (obj2.is_Select) { @@ -2511,7 +2506,7 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, DCOMP._ISelfInfo if (object.Equals(name11, Dafny.Sequence.UnicodeFromString("this"))) { Dafny.ISequence name12 = obj2.dtor_name; if (object.Equals(name12, Dafny.Sequence.UnicodeFromString("clone"))) { - disjunctiveMatch11 = true; + disjunctiveMatch10 = true; } } } @@ -2520,7 +2515,7 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, DCOMP._ISelfInfo if (_source73.is_Identifier) { Dafny.ISequence name13 = _source73.dtor_name; if (object.Equals(name13, Dafny.Sequence.UnicodeFromString("this"))) { - disjunctiveMatch11 = true; + disjunctiveMatch10 = true; } } if (_source73.is_UnaryOp) { @@ -2530,13 +2525,12 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, DCOMP._ISelfInfo if (underlying4.is_Identifier) { Dafny.ISequence name14 = underlying4.dtor_name; if (object.Equals(name14, Dafny.Sequence.UnicodeFromString("this"))) { - disjunctiveMatch11 = true; + disjunctiveMatch10 = true; } } } } - if (disjunctiveMatch11) { - unmatched73 = false; + if (disjunctiveMatch10) { Dafny.ISequence _1497_isAssignedVar; _1497_isAssignedVar = DCOMP.__default.AddAssignedPrefix(_1493_fieldName); if (((newEnv).dtor_names).Contains(_1497_isAssignedVar)) { @@ -2546,24 +2540,25 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, DCOMP._ISelfInfo (this).error = Std.Wrappers.Option>.create_Some(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("Unespected field to assign whose isAssignedVar is not in the environment: "), _1497_isAssignedVar)); generated = RAST.__default.AssignMember(RAST.Expr.create_RawExpr((this.error).dtor_value), _1493_fieldName, rhs); } + goto after_match20; } } - if (unmatched73) { - unmatched73 = false; + { if (!object.Equals(_1494_onExpr, RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("self")))) { _1494_onExpr = ((this).modify__macro).Apply1(_1494_onExpr); } generated = RAST.__default.AssignMember(_1494_onExpr, _1493_fieldName, rhs); } + after_match20: ; readIdents = _1496_recIdents; needsIIFE = false; } + goto after_match19; } } - if (unmatched72) { + { DAST._IExpression _1498_on = _source72.dtor_expr; Dafny.ISequence _1499_indices = _source72.dtor_indices; - unmatched72 = false; { RAST._IExpr _1500_onExpr; DCOMP._IOwnership _1501_onOwned; @@ -2604,14 +2599,15 @@ public void GenAssignLhs(DAST._IAssignLhs lhs, RAST._IExpr rhs, DCOMP._ISelfInfo } RAST._IExpr _1510_rhs; _1510_rhs = rhs; - var _pat_let_tv142 = env; - if (((_1500_onExpr).IsLhsIdentifier()) && (Dafny.Helpers.Let, bool>((_1500_onExpr).LhsIdentifierName(), _pat_let36_0 => Dafny.Helpers.Let, bool>(_pat_let36_0, _1511_name => (true) && (Dafny.Helpers.Let, bool>((_pat_let_tv142).GetType(_1511_name), _pat_let37_0 => Dafny.Helpers.Let, bool>(_pat_let37_0, _1512_tpe => ((_1512_tpe).is_Some) && (((_1512_tpe).dtor_value).IsUninitArray())))))))) { + var _pat_let_tv3 = env; + if (((_1500_onExpr).IsLhsIdentifier()) && (Dafny.Helpers.Let, bool>((_1500_onExpr).LhsIdentifierName(), _pat_let32_0 => Dafny.Helpers.Let, bool>(_pat_let32_0, _1511_name => (true) && (Dafny.Helpers.Let, bool>((_pat_let_tv3).GetType(_1511_name), _pat_let33_0 => Dafny.Helpers.Let, bool>(_pat_let33_0, _1512_tpe => ((_1512_tpe).is_Some) && (((_1512_tpe).dtor_value).IsUninitArray())))))))) { _1510_rhs = RAST.__default.MaybeUninitNew(_1510_rhs); } generated = (_1503_r).Then(RAST.Expr.create_Assign(Std.Wrappers.Option.create_Some(RAST.AssignLhs.create_Index(_1500_onExpr, _1504_indicesExpr)), _1510_rhs)); needsIIFE = true; } } + after_match19: ; } public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IEnvironment env, bool isLast, Std.Wrappers._IOption>> earlyReturn, out RAST._IExpr generated, out Dafny.ISet> readIdents, out DCOMP._IEnvironment newEnv) { @@ -2619,11 +2615,9 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE readIdents = Dafny.Set>.Empty; newEnv = DCOMP.Environment.Default(); DAST._IStatement _source74 = stmt; - bool unmatched74 = true; - if (unmatched74) { + { if (_source74.is_ConstructorNewSeparator) { Dafny.ISequence _1513_fields = _source74.dtor_fields; - unmatched74 = false; { generated = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); readIdents = Dafny.Set>.FromElements(); @@ -2657,16 +2651,16 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE } } } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_DeclareVar) { Dafny.ISequence _1522_name = _source74.dtor_name; DAST._IType _1523_typ = _source74.dtor_typ; Std.Wrappers._IOption maybeValue1 = _source74.dtor_maybeValue; if (maybeValue1.is_Some) { DAST._IExpression _1524_expression = maybeValue1.dtor_value; - unmatched74 = false; { RAST._IType _1525_tpe; RAST._IType _out128; @@ -2697,21 +2691,25 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE _1529_recIdents = _out131; } readIdents = _1529_recIdents; - _1525_tpe = (((_1524_expression).is_NewUninitArray) ? ((_1525_tpe).TypeAtInitialization()) : (_1525_tpe)); + if ((_1524_expression).is_NewUninitArray) { + _1525_tpe = (_1525_tpe).TypeAtInitialization(); + } else { + _1525_tpe = _1525_tpe; + } generated = RAST.Expr.create_DeclareVar(RAST.DeclareType.create_MUT(), DCOMP.__default.escapeName(_1522_name), Std.Wrappers.Option.create_Some(_1525_tpe), Std.Wrappers.Option.create_Some(_1528_expr)); newEnv = (env).AddAssigned(DCOMP.__default.escapeName(_1522_name), _1525_tpe); } } + goto after_match21; } } } - if (unmatched74) { + { if (_source74.is_DeclareVar) { Dafny.ISequence _1531_name = _source74.dtor_name; DAST._IType _1532_typ = _source74.dtor_typ; Std.Wrappers._IOption maybeValue2 = _source74.dtor_maybeValue; if (maybeValue2.is_None) { - unmatched74 = false; { DAST._IStatement _1533_newStmt; _1533_newStmt = DAST.Statement.create_DeclareVar(_1531_name, _1532_typ, Std.Wrappers.Option.create_Some(DAST.Expression.create_InitializationValue(_1532_typ))); @@ -2723,14 +2721,14 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE readIdents = _out133; newEnv = _out134; } + goto after_match21; } } } - if (unmatched74) { + { if (_source74.is_Assign) { DAST._IAssignLhs _1534_lhs = _source74.dtor_lhs; DAST._IExpression _1535_expression = _source74.dtor_value; - unmatched74 = false; { RAST._IExpr _1536_exprGen; DCOMP._IOwnership _1537___v82; @@ -2780,14 +2778,14 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE } readIdents = Dafny.Set>.Union(_1545_recIdents, _1538_exprIdents); } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_If) { DAST._IExpression _1547_cond = _source74.dtor_cond; Dafny.ISequence _1548_thnDafny = _source74.dtor_thn; Dafny.ISequence _1549_elsDafny = _source74.dtor_els; - unmatched74 = false; { RAST._IExpr _1550_cond; DCOMP._IOwnership _1551___v83; @@ -2827,13 +2825,13 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE newEnv = env; generated = RAST.Expr.create_IfExpr(_1550_cond, _1554_thn, _1557_els); } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_Labeled) { Dafny.ISequence _1560_lbl = _source74.dtor_lbl; Dafny.ISequence _1561_body = _source74.dtor_body; - unmatched74 = false; { RAST._IExpr _1562_body; Dafny.ISet> _1563_bodyIdents; @@ -2849,13 +2847,13 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE generated = RAST.Expr.create_Labelled(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1560_lbl), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), RAST.Expr.create_StmtExpr(_1562_body, RAST.Expr.create_Break(Std.Wrappers.Option>.create_None())))); newEnv = env; } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_While) { DAST._IExpression _1565_cond = _source74.dtor_cond; Dafny.ISequence _1566_body = _source74.dtor_body; - unmatched74 = false; { RAST._IExpr _1567_cond; DCOMP._IOwnership _1568___v84; @@ -2882,15 +2880,15 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE readIdents = Dafny.Set>.Union(readIdents, _1571_bodyIdents); generated = RAST.Expr.create_Loop(Std.Wrappers.Option.create_Some(_1567_cond), _1570_bodyExpr); } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_Foreach) { Dafny.ISequence _1573_boundName = _source74.dtor_boundName; DAST._IType _1574_boundType = _source74.dtor_boundType; DAST._IExpression _1575_overExpr = _source74.dtor_over; Dafny.ISequence _1576_body = _source74.dtor_body; - unmatched74 = false; { RAST._IExpr _1577_over; DCOMP._IOwnership _1578___v85; @@ -2926,39 +2924,38 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE newEnv = env; generated = RAST.Expr.create_For(_1581_boundRName, _1577_over, _1582_bodyExpr); } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_Break) { Std.Wrappers._IOption> _1585_toLabel = _source74.dtor_toLabel; - unmatched74 = false; { Std.Wrappers._IOption> _source75 = _1585_toLabel; - bool unmatched75 = true; - if (unmatched75) { + { if (_source75.is_Some) { Dafny.ISequence _1586_lbl = _source75.dtor_value; - unmatched75 = false; { generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_Some(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("label_"), _1586_lbl))); } + goto after_match22; } } - if (unmatched75) { - unmatched75 = false; + { { generated = RAST.Expr.create_Break(Std.Wrappers.Option>.create_None()); } } + after_match22: ; readIdents = Dafny.Set>.FromElements(); newEnv = env; } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_TailRecursive) { Dafny.ISequence _1587_body = _source74.dtor_body; - unmatched74 = false; { generated = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")); if (!object.Equals(selfIdent, DCOMP.SelfInfo.create_NoSelf())) { @@ -3009,26 +3006,26 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE readIdents = _1598_bodyIdents; generated = (generated).Then(RAST.Expr.create_Labelled(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"), RAST.Expr.create_Loop(Std.Wrappers.Option.create_None(), _1597_bodyExpr))); } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_JumpTailCallStart) { - unmatched74 = false; { generated = RAST.Expr.create_Continue(Std.Wrappers.Option>.create_Some(Dafny.Sequence.UnicodeFromString("TAIL_CALL_START"))); readIdents = Dafny.Set>.FromElements(); newEnv = env; } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_Call) { DAST._IExpression _1600_on = _source74.dtor_on; DAST._ICallName _1601_name = _source74.dtor_callName; Dafny.ISequence _1602_typeArgs = _source74.dtor_typeArgs; Dafny.ISequence _1603_args = _source74.dtor_args; Std.Wrappers._IOption>> _1604_maybeOutVars = _source74.dtor_outs; - unmatched74 = false; { Dafny.ISequence _1605_argExprs; Dafny.ISet> _1606_recIdents; @@ -3045,14 +3042,12 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE _1608_fullNameQualifier = _out179; readIdents = _1606_recIdents; Std.Wrappers._IOption _source76 = _1608_fullNameQualifier; - bool unmatched76 = true; - if (unmatched76) { + { if (_source76.is_Some) { DAST._IResolvedType value9 = _source76.dtor_value; Dafny.ISequence> _1609_path = value9.dtor_path; Dafny.ISequence _1610_onTypeArgs = value9.dtor_typeArgs; DAST._IResolvedTypeBase _1611_base = value9.dtor_kind; - unmatched76 = false; RAST._IExpr _1612_fullPath; RAST._IExpr _out180; _out180 = DCOMP.COMP.GenPathExpr(_1609_path); @@ -3085,10 +3080,10 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE readIdents = Dafny.Set>.Union(readIdents, _1616_recIdents); } generated = ((((_1612_fullPath).ApplyType(_1613_onTypeExprs)).MSel(DCOMP.__default.escapeName((_1601_name).dtor_name))).ApplyType(_1607_typeExprs)).Apply(Dafny.Sequence.Concat(Dafny.Sequence.FromElements(_1614_onExpr), _1605_argExprs)); + goto after_match23; } } - if (unmatched76) { - unmatched76 = false; + { RAST._IExpr _1617_onExpr; DCOMP._IOwnership _1618___v94; Dafny.ISet> _1619_enclosingIdents; @@ -3101,62 +3096,49 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE _1619_enclosingIdents = _out190; readIdents = Dafny.Set>.Union(readIdents, _1619_enclosingIdents); Dafny.ISequence _1620_renderedName; - _1620_renderedName = ((System.Func>)(() => { - DAST._ICallName _source77 = _1601_name; - bool unmatched77 = true; - if (unmatched77) { - if (_source77.is_CallName) { - Dafny.ISequence _1621_name = _source77.dtor_name; - unmatched77 = false; - return DCOMP.__default.escapeName(_1621_name); - } + DAST._ICallName _source77 = _1601_name; + { + if (_source77.is_CallName) { + Dafny.ISequence _1621_name = _source77.dtor_name; + _1620_renderedName = DCOMP.__default.escapeName(_1621_name); + goto after_match24; } - if (unmatched77) { - bool disjunctiveMatch12 = false; - if (_source77.is_MapBuilderAdd) { - disjunctiveMatch12 = true; - } - if (_source77.is_SetBuilderAdd) { - disjunctiveMatch12 = true; - } - if (disjunctiveMatch12) { - unmatched77 = false; - return Dafny.Sequence.UnicodeFromString("add"); - } + } + { + bool disjunctiveMatch11 = false; + if (_source77.is_MapBuilderAdd) { + disjunctiveMatch11 = true; } - if (unmatched77) { - bool disjunctiveMatch13 = false; - disjunctiveMatch13 = true; - disjunctiveMatch13 = true; - if (disjunctiveMatch13) { - unmatched77 = false; - return Dafny.Sequence.UnicodeFromString("build"); - } + if (_source77.is_SetBuilderAdd) { + disjunctiveMatch11 = true; } - throw new System.Exception("unexpected control point"); - }))(); + if (disjunctiveMatch11) { + _1620_renderedName = Dafny.Sequence.UnicodeFromString("add"); + goto after_match24; + } + } + { + _1620_renderedName = Dafny.Sequence.UnicodeFromString("build"); + } + after_match24: ; DAST._IExpression _source78 = _1600_on; - bool unmatched78 = true; - if (unmatched78) { + { if (_source78.is_Companion) { - unmatched78 = false; { _1617_onExpr = (_1617_onExpr).MSel(_1620_renderedName); } + goto after_match25; } } - if (unmatched78) { - unmatched78 = false; + { { if (!object.Equals(_1617_onExpr, RAST.__default.self)) { DAST._ICallName _source79 = _1601_name; - bool unmatched79 = true; - if (unmatched79) { + { if (_source79.is_CallName) { Std.Wrappers._IOption onType0 = _source79.dtor_onType; if (onType0.is_Some) { DAST._IType _1622_tpe = onType0.dtor_value; - unmatched79 = false; RAST._IType _1623_typ; RAST._IType _out191; _out191 = (this).GenType(_1622_tpe, DCOMP.GenTypeContext.@default()); @@ -3164,18 +3146,21 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE if (((_1623_typ).IsObjectOrPointer()) && (!object.Equals(_1617_onExpr, RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("self"))))) { _1617_onExpr = ((this).modify__macro).Apply1(_1617_onExpr); } + goto after_match26; } } } - if (unmatched79) { - unmatched79 = false; + { } + after_match26: ; } _1617_onExpr = (_1617_onExpr).Sel(_1620_renderedName); } } + after_match25: ; generated = ((_1617_onExpr).ApplyType(_1607_typeExprs)).Apply(_1605_argExprs); } + after_match23: ; if (((_1604_maybeOutVars).is_Some) && ((new BigInteger(((_1604_maybeOutVars).dtor_value).Count)) == (BigInteger.One))) { Dafny.ISequence _1624_outVar; _1624_outVar = DCOMP.__default.escapeName((((_1604_maybeOutVars).dtor_value).Select(BigInteger.Zero))); @@ -3206,12 +3191,12 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE } newEnv = env; } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_Return) { DAST._IExpression _1631_exprDafny = _source74.dtor_expr; - unmatched74 = false; { RAST._IExpr _1632_expr; DCOMP._IOwnership _1633___v105; @@ -3231,23 +3216,21 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE } newEnv = env; } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_EarlyReturn) { - unmatched74 = false; { Std.Wrappers._IOption>> _source80 = earlyReturn; - bool unmatched80 = true; - if (unmatched80) { + { if (_source80.is_None) { - unmatched80 = false; generated = RAST.Expr.create_Return(Std.Wrappers.Option.create_None()); + goto after_match27; } } - if (unmatched80) { + { Dafny.ISequence> _1635_rustIdents = _source80.dtor_value; - unmatched80 = false; Dafny.ISequence _1636_tupleArgs; _1636_tupleArgs = Dafny.Sequence.FromElements(); BigInteger _hi36 = new BigInteger((_1635_rustIdents).Count); @@ -3270,24 +3253,25 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE generated = RAST.Expr.create_Return(Std.Wrappers.Option.create_Some(RAST.Expr.create_Tuple(_1636_tupleArgs))); } } + after_match27: ; readIdents = Dafny.Set>.FromElements(); newEnv = env; } + goto after_match21; } } - if (unmatched74) { + { if (_source74.is_Halt) { - unmatched74 = false; { generated = (RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("panic!"))).Apply1(RAST.Expr.create_LiteralString(Dafny.Sequence.UnicodeFromString("Halt"), false, false)); readIdents = Dafny.Set>.FromElements(); newEnv = env; } + goto after_match21; } } - if (unmatched74) { + { DAST._IExpression _1641_e = _source74.dtor_Print_a0; - unmatched74 = false; { RAST._IExpr _1642_printedExpr; DCOMP._IOwnership _1643_recOwnership; @@ -3304,82 +3288,69 @@ public void GenStmt(DAST._IStatement stmt, DCOMP._ISelfInfo selfIdent, DCOMP._IE newEnv = env; } } + after_match21: ; } public static Std.Wrappers._IOption NewtypeToRustType(DAST._IType @base, DAST._INewtypeRange range) { DAST._INewtypeRange _source81 = range; - bool unmatched81 = true; - if (unmatched81) { + { if (_source81.is_NoRange) { - unmatched81 = false; return Std.Wrappers.Option.create_None(); } } - if (unmatched81) { + { if (_source81.is_U8) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_U8()); } } - if (unmatched81) { + { if (_source81.is_U16) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_U16()); } } - if (unmatched81) { + { if (_source81.is_U32) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_U32()); } } - if (unmatched81) { + { if (_source81.is_U64) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_U64()); } } - if (unmatched81) { + { if (_source81.is_U128) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_U128()); } } - if (unmatched81) { + { if (_source81.is_I8) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_I8()); } } - if (unmatched81) { + { if (_source81.is_I16) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_I16()); } } - if (unmatched81) { + { if (_source81.is_I32) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_I32()); } } - if (unmatched81) { + { if (_source81.is_I64) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_I64()); } } - if (unmatched81) { + { if (_source81.is_I128) { - unmatched81 = false; return Std.Wrappers.Option.create_Some(RAST.Type.create_I128()); } } - if (unmatched81) { - unmatched81 = false; + { return Std.Wrappers.Option.create_None(); } - throw new System.Exception("unexpected control point"); } public void FromOwned(RAST._IExpr r, DCOMP._IOwnership expectedOwnership, out RAST._IExpr @out, out DCOMP._IOwnership resultingOwnership) { @@ -3451,13 +3422,11 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = DCOMP.Ownership.Default(); readIdents = Dafny.Set>.Empty; DAST._IExpression _source82 = e; - bool unmatched82 = true; - if (unmatched82) { + { if (_source82.is_Literal) { DAST._ILiteral _h170 = _source82.dtor_Literal_a0; if (_h170.is_BoolLiteral) { bool _1645_b = _h170.dtor_BoolLiteral_a0; - unmatched82 = false; { RAST._IExpr _out205; DCOMP._IOwnership _out206; @@ -3467,24 +3436,22 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match28; } } } - if (unmatched82) { + { if (_source82.is_Literal) { DAST._ILiteral _h171 = _source82.dtor_Literal_a0; if (_h171.is_IntLiteral) { Dafny.ISequence _1646_i = _h171.dtor_IntLiteral_a0; DAST._IType _1647_t = _h171.dtor_IntLiteral_a1; - unmatched82 = false; { DAST._IType _source83 = _1647_t; - bool unmatched83 = true; - if (unmatched83) { + { if (_source83.is_Primitive) { DAST._IPrimitive _h70 = _source83.dtor_Primitive_a0; if (_h70.is_Int) { - unmatched83 = false; { if ((new BigInteger((_1646_i).Count)) <= (new BigInteger(4))) { r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralInt(_1646_i)); @@ -3492,12 +3459,12 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("int!"))).Apply1(RAST.Expr.create_LiteralString(_1646_i, true, false)); } } + goto after_match29; } } } - if (unmatched83) { + { DAST._IType _1648_o = _source83; - unmatched83 = false; { RAST._IType _1649_genType; RAST._IType _out207; @@ -3506,6 +3473,7 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(_1646_i), _1649_genType); } } + after_match29: ; RAST._IExpr _out208; DCOMP._IOwnership _out209; (this).FromOwned(r, expectedOwnership, out _out208, out _out209); @@ -3514,34 +3482,32 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match28; } } } - if (unmatched82) { + { if (_source82.is_Literal) { DAST._ILiteral _h172 = _source82.dtor_Literal_a0; if (_h172.is_DecLiteral) { Dafny.ISequence _1650_n = _h172.dtor_DecLiteral_a0; Dafny.ISequence _1651_d = _h172.dtor_DecLiteral_a1; DAST._IType _1652_t = _h172.dtor_DecLiteral_a2; - unmatched82 = false; { DAST._IType _source84 = _1652_t; - bool unmatched84 = true; - if (unmatched84) { + { if (_source84.is_Primitive) { DAST._IPrimitive _h71 = _source84.dtor_Primitive_a0; if (_h71.is_Real) { - unmatched84 = false; { r = RAST.__default.RcNew(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::dafny_runtime::BigRational::new(::dafny_runtime::BigInt::parse_bytes(b\""), _1650_n), Dafny.Sequence.UnicodeFromString("\", 10).unwrap(), ::dafny_runtime::BigInt::parse_bytes(b\"")), _1651_d), Dafny.Sequence.UnicodeFromString("\", 10).unwrap())")))); } + goto after_match30; } } } - if (unmatched84) { + { DAST._IType _1653_o = _source84; - unmatched84 = false; { RAST._IType _1654_genType; RAST._IType _out210; @@ -3550,6 +3516,7 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM r = RAST.Expr.create_TypeAscription(RAST.Expr.create_RawExpr(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), _1650_n), Dafny.Sequence.UnicodeFromString(".0 / ")), _1651_d), Dafny.Sequence.UnicodeFromString(".0")), Dafny.Sequence.UnicodeFromString(")"))), _1654_genType); } } + after_match30: ; RAST._IExpr _out211; DCOMP._IOwnership _out212; (this).FromOwned(r, expectedOwnership, out _out211, out _out212); @@ -3558,16 +3525,16 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match28; } } } - if (unmatched82) { + { if (_source82.is_Literal) { DAST._ILiteral _h173 = _source82.dtor_Literal_a0; if (_h173.is_StringLiteral) { Dafny.ISequence _1655_l = _h173.dtor_StringLiteral_a0; bool _1656_verbatim = _h173.dtor_verbatim; - unmatched82 = false; { r = ((RAST.__default.dafny__runtime).MSel((this).string__of)).Apply1(RAST.Expr.create_LiteralString(_1655_l, false, _1656_verbatim)); RAST._IExpr _out213; @@ -3578,15 +3545,15 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match28; } } } - if (unmatched82) { + { if (_source82.is_Literal) { DAST._ILiteral _h174 = _source82.dtor_Literal_a0; if (_h174.is_CharLiteralUTF16) { BigInteger _1657_c = _h174.dtor_CharLiteralUTF16_a0; - unmatched82 = false; { r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(_1657_c)); r = RAST.Expr.create_TypeAscription(r, RAST.Type.create_U16()); @@ -3599,15 +3566,15 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match28; } } } - if (unmatched82) { + { if (_source82.is_Literal) { DAST._ILiteral _h175 = _source82.dtor_Literal_a0; if (_h175.is_CharLiteral) { Dafny.Rune _1658_c = _h175.dtor_CharLiteral_a0; - unmatched82 = false; { r = RAST.Expr.create_LiteralInt(Std.Strings.__default.OfNat(new BigInteger((_1658_c).Value))); if (!((this).UnicodeChars)) { @@ -3624,13 +3591,13 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match28; } } } - if (unmatched82) { + { DAST._ILiteral _h176 = _source82.dtor_Literal_a0; DAST._IType _1659_tpe = _h176.dtor_Null_a0; - unmatched82 = false; { RAST._IType _1660_tpeGen; RAST._IType _out219; @@ -3650,6 +3617,7 @@ public void GenExprLiteral(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM return ; } } + after_match28: ; } public void GenExprBinary(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnvironment env, DCOMP._IOwnership expectedOwnership, out RAST._IExpr r, out DCOMP._IOwnership resultingOwnership, out Dafny.ISet> readIdents) { @@ -3662,160 +3630,160 @@ public void GenExprBinary(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP DAST._IExpression _1663_rExpr = _let_tmp_rhs54.dtor_right; DAST.Format._IBinaryOpFormat _1664_format = _let_tmp_rhs54.dtor_format2; bool _1665_becomesLeftCallsRight; - _1665_becomesLeftCallsRight = ((System.Func)(() => { - DAST._IBinOp _source85 = _1661_op; - bool unmatched85 = true; - if (unmatched85) { - bool disjunctiveMatch14 = false; - if (_source85.is_SetMerge) { - disjunctiveMatch14 = true; - } - if (_source85.is_SetSubtraction) { - disjunctiveMatch14 = true; - } - if (_source85.is_SetIntersection) { - disjunctiveMatch14 = true; - } - if (_source85.is_SetDisjoint) { - disjunctiveMatch14 = true; - } - if (_source85.is_MapMerge) { - disjunctiveMatch14 = true; - } - if (_source85.is_MapSubtraction) { - disjunctiveMatch14 = true; - } - if (_source85.is_MultisetMerge) { - disjunctiveMatch14 = true; - } - if (_source85.is_MultisetSubtraction) { - disjunctiveMatch14 = true; - } - if (_source85.is_MultisetIntersection) { - disjunctiveMatch14 = true; - } - if (_source85.is_MultisetDisjoint) { - disjunctiveMatch14 = true; - } - if (_source85.is_Concat) { - disjunctiveMatch14 = true; - } - if (disjunctiveMatch14) { - unmatched85 = false; - return true; - } + DAST._IBinOp _source85 = _1661_op; + { + bool disjunctiveMatch12 = false; + if (_source85.is_SetMerge) { + disjunctiveMatch12 = true; } - if (unmatched85) { - unmatched85 = false; - return false; + if (_source85.is_SetSubtraction) { + disjunctiveMatch12 = true; } - throw new System.Exception("unexpected control point"); - }))(); - bool _1666_becomesRightCallsLeft; - _1666_becomesRightCallsLeft = ((System.Func)(() => { - DAST._IBinOp _source86 = _1661_op; - bool unmatched86 = true; - if (unmatched86) { - if (_source86.is_In) { - unmatched86 = false; - return true; - } + if (_source85.is_SetIntersection) { + disjunctiveMatch12 = true; } - if (unmatched86) { - unmatched86 = false; - return false; + if (_source85.is_SetDisjoint) { + disjunctiveMatch12 = true; } - throw new System.Exception("unexpected control point"); - }))(); - bool _1667_becomesCallLeftRight; - _1667_becomesCallLeftRight = ((System.Func)(() => { - DAST._IBinOp _source87 = _1661_op; - bool unmatched87 = true; - if (unmatched87) { - if (_source87.is_Eq) { - bool referential0 = _source87.dtor_referential; - if ((referential0) == (true)) { - unmatched87 = false; - return false; - } - } + if (_source85.is_MapMerge) { + disjunctiveMatch12 = true; } - if (unmatched87) { - if (_source87.is_SetMerge) { - unmatched87 = false; - return true; - } + if (_source85.is_MapSubtraction) { + disjunctiveMatch12 = true; } - if (unmatched87) { - if (_source87.is_SetSubtraction) { - unmatched87 = false; - return true; - } + if (_source85.is_MultisetMerge) { + disjunctiveMatch12 = true; } - if (unmatched87) { - if (_source87.is_SetIntersection) { - unmatched87 = false; - return true; - } + if (_source85.is_MultisetSubtraction) { + disjunctiveMatch12 = true; } - if (unmatched87) { - if (_source87.is_SetDisjoint) { - unmatched87 = false; - return true; - } + if (_source85.is_MultisetIntersection) { + disjunctiveMatch12 = true; } - if (unmatched87) { - if (_source87.is_MapMerge) { - unmatched87 = false; - return true; - } + if (_source85.is_MultisetDisjoint) { + disjunctiveMatch12 = true; } - if (unmatched87) { - if (_source87.is_MapSubtraction) { - unmatched87 = false; - return true; - } + if (_source85.is_Concat) { + disjunctiveMatch12 = true; } - if (unmatched87) { - if (_source87.is_MultisetMerge) { - unmatched87 = false; - return true; - } + if (disjunctiveMatch12) { + _1665_becomesLeftCallsRight = true; + goto after_match31; } - if (unmatched87) { - if (_source87.is_MultisetSubtraction) { - unmatched87 = false; - return true; - } + } + { + _1665_becomesLeftCallsRight = false; + } + after_match31: ; + bool _1666_becomesRightCallsLeft; + DAST._IBinOp _source86 = _1661_op; + { + if (_source86.is_In) { + _1666_becomesRightCallsLeft = true; + goto after_match32; } - if (unmatched87) { - if (_source87.is_MultisetIntersection) { - unmatched87 = false; - return true; + } + { + _1666_becomesRightCallsLeft = false; + } + after_match32: ; + bool _1667_becomesCallLeftRight; + DAST._IBinOp _source87 = _1661_op; + { + if (_source87.is_Eq) { + bool referential0 = _source87.dtor_referential; + if ((referential0) == (true)) { + _1667_becomesCallLeftRight = false; + goto after_match33; } } - if (unmatched87) { - if (_source87.is_MultisetDisjoint) { - unmatched87 = false; - return true; - } + } + { + if (_source87.is_SetMerge) { + _1667_becomesCallLeftRight = true; + goto after_match33; } - if (unmatched87) { - if (_source87.is_Concat) { - unmatched87 = false; - return true; - } + } + { + if (_source87.is_SetSubtraction) { + _1667_becomesCallLeftRight = true; + goto after_match33; } - if (unmatched87) { - unmatched87 = false; - return false; + } + { + if (_source87.is_SetIntersection) { + _1667_becomesCallLeftRight = true; + goto after_match33; } - throw new System.Exception("unexpected control point"); - }))(); + } + { + if (_source87.is_SetDisjoint) { + _1667_becomesCallLeftRight = true; + goto after_match33; + } + } + { + if (_source87.is_MapMerge) { + _1667_becomesCallLeftRight = true; + goto after_match33; + } + } + { + if (_source87.is_MapSubtraction) { + _1667_becomesCallLeftRight = true; + goto after_match33; + } + } + { + if (_source87.is_MultisetMerge) { + _1667_becomesCallLeftRight = true; + goto after_match33; + } + } + { + if (_source87.is_MultisetSubtraction) { + _1667_becomesCallLeftRight = true; + goto after_match33; + } + } + { + if (_source87.is_MultisetIntersection) { + _1667_becomesCallLeftRight = true; + goto after_match33; + } + } + { + if (_source87.is_MultisetDisjoint) { + _1667_becomesCallLeftRight = true; + goto after_match33; + } + } + { + if (_source87.is_Concat) { + _1667_becomesCallLeftRight = true; + goto after_match33; + } + } + { + _1667_becomesCallLeftRight = false; + } + after_match33: ; DCOMP._IOwnership _1668_expectedLeftOwnership; - _1668_expectedLeftOwnership = ((_1665_becomesLeftCallsRight) ? (DCOMP.Ownership.create_OwnershipAutoBorrowed()) : ((((_1666_becomesRightCallsLeft) || (_1667_becomesCallLeftRight)) ? (DCOMP.Ownership.create_OwnershipBorrowed()) : (DCOMP.Ownership.create_OwnershipOwned())))); + if (_1665_becomesLeftCallsRight) { + _1668_expectedLeftOwnership = DCOMP.Ownership.create_OwnershipAutoBorrowed(); + } else if ((_1666_becomesRightCallsLeft) || (_1667_becomesCallLeftRight)) { + _1668_expectedLeftOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else { + _1668_expectedLeftOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } DCOMP._IOwnership _1669_expectedRightOwnership; - _1669_expectedRightOwnership = (((_1665_becomesLeftCallsRight) || (_1667_becomesCallLeftRight)) ? (DCOMP.Ownership.create_OwnershipBorrowed()) : (((_1666_becomesRightCallsLeft) ? (DCOMP.Ownership.create_OwnershipAutoBorrowed()) : (DCOMP.Ownership.create_OwnershipOwned())))); + if ((_1665_becomesLeftCallsRight) || (_1667_becomesCallLeftRight)) { + _1669_expectedRightOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else if (_1666_becomesRightCallsLeft) { + _1669_expectedRightOwnership = DCOMP.Ownership.create_OwnershipAutoBorrowed(); + } else { + _1669_expectedRightOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } RAST._IExpr _1670_left; DCOMP._IOwnership _1671___v112; Dafny.ISet> _1672_recIdentsL; @@ -3837,159 +3805,155 @@ public void GenExprBinary(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP _1674___v113 = _out226; _1675_recIdentsR = _out227; DAST._IBinOp _source88 = _1661_op; - bool unmatched88 = true; - if (unmatched88) { + { if (_source88.is_In) { - unmatched88 = false; { r = ((_1673_right).Sel(Dafny.Sequence.UnicodeFromString("contains"))).Apply1(_1670_left); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_SeqProperPrefix) { - unmatched88 = false; r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1670_left, _1673_right, _1664_format); + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_SeqPrefix) { - unmatched88 = false; r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1670_left, _1673_right, _1664_format); + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_SetMerge) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_SetSubtraction) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_SetIntersection) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_Subset) { - unmatched88 = false; { r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1670_left, _1673_right, _1664_format); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_ProperSubset) { - unmatched88 = false; { r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1670_left, _1673_right, _1664_format); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_SetDisjoint) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_MapMerge) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_MapSubtraction) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_MultisetMerge) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("merge"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_MultisetSubtraction) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("subtract"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_MultisetIntersection) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("intersect"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_Submultiset) { - unmatched88 = false; { r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _1670_left, _1673_right, _1664_format); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_ProperSubmultiset) { - unmatched88 = false; { r = RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<"), _1670_left, _1673_right, _1664_format); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_MultisetDisjoint) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("disjoint"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { + { if (_source88.is_Concat) { - unmatched88 = false; { r = ((_1670_left).Sel(Dafny.Sequence.UnicodeFromString("concat"))).Apply1(_1673_right); } + goto after_match34; } } - if (unmatched88) { - unmatched88 = false; + { { if ((DCOMP.COMP.OpTable).Contains(_1661_op)) { r = RAST.Expr.create_BinaryOp(Dafny.Map>.Select(DCOMP.COMP.OpTable,_1661_op), _1670_left, _1673_right, _1664_format); } else { DAST._IBinOp _source89 = _1661_op; - bool unmatched89 = true; - if (unmatched89) { + { if (_source89.is_Eq) { bool _1676_referential = _source89.dtor_referential; - unmatched89 = false; { if (_1676_referential) { if (((this).ObjectType).is_RawPointers) { @@ -4008,34 +3972,36 @@ public void GenExprBinary(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP } } } + goto after_match35; } } - if (unmatched89) { + { if (_source89.is_EuclidianDiv) { - unmatched89 = false; { r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_division"))).Apply(Dafny.Sequence.FromElements(_1670_left, _1673_right)); } + goto after_match35; } } - if (unmatched89) { + { if (_source89.is_EuclidianMod) { - unmatched89 = false; { r = (RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("::dafny_runtime::euclidian_modulo"))).Apply(Dafny.Sequence.FromElements(_1670_left, _1673_right)); } + goto after_match35; } } - if (unmatched89) { + { Dafny.ISequence _1677_op = _source89.dtor_Passthrough_a0; - unmatched89 = false; { r = RAST.Expr.create_BinaryOp(_1677_op, _1670_left, _1673_right, _1664_format); } } + after_match35: ; } } } + after_match34: ; RAST._IExpr _out228; DCOMP._IOwnership _out229; (this).FromOwned(r, expectedOwnership, out _out228, out _out229); @@ -4079,21 +4045,19 @@ public void GenExprConvertToNewtype(DAST._IExpression e, DCOMP._ISelfInfo selfId _1692_recIdents = _out232; readIdents = _1692_recIdents; Std.Wrappers._IOption _source90 = _1689_nativeToType; - bool unmatched90 = true; - if (unmatched90) { + { if (_source90.is_Some) { RAST._IType _1693_v = _source90.dtor_value; - unmatched90 = false; r = ((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("truncate!"))).Apply(Dafny.Sequence.FromElements(_1690_recursiveGen, RAST.Expr.create_ExprFromType(_1693_v))); RAST._IExpr _out233; DCOMP._IOwnership _out234; (this).FromOwned(r, expectedOwnership, out _out233, out _out234); r = _out233; resultingOwnership = _out234; + goto after_match36; } } - if (unmatched90) { - unmatched90 = false; + { if (_1685_erase) { r = _1690_recursiveGen; } else { @@ -4109,11 +4073,11 @@ public void GenExprConvertToNewtype(DAST._IExpression e, DCOMP._ISelfInfo selfId r = _out236; resultingOwnership = _out237; } + after_match36: ; } else { if ((_1689_nativeToType).is_Some) { DAST._IType _source91 = _1679_fromTpe; - bool unmatched91 = true; - if (unmatched91) { + { if (_source91.is_UserDefined) { DAST._IResolvedType resolved1 = _source91.dtor_resolved; DAST._IResolvedTypeBase kind1 = resolved1.dtor_kind; @@ -4122,7 +4086,6 @@ public void GenExprConvertToNewtype(DAST._IExpression e, DCOMP._ISelfInfo selfId DAST._INewtypeRange _1696_range0 = kind1.dtor_range; bool _1697_erase0 = kind1.dtor_erase; Dafny.ISequence _1698_attributes0 = resolved1.dtor_attributes; - unmatched91 = false; { Std.Wrappers._IOption _1699_nativeFromType; _1699_nativeFromType = DCOMP.COMP.NewtypeToRustType(_1695_b0, _1696_range0); @@ -4146,12 +4109,13 @@ public void GenExprConvertToNewtype(DAST._IExpression e, DCOMP._ISelfInfo selfId return ; } } + goto after_match37; } } } - if (unmatched91) { - unmatched91 = false; + { } + after_match37: ; if (object.Equals(_1679_fromTpe, DAST.Type.create_Primitive(DAST.Primitive.create_Char()))) { RAST._IExpr _1703_recursiveGen; DCOMP._IOwnership _1704_recOwned; @@ -4216,11 +4180,9 @@ public void GenExprConvertFromNewtype(DAST._IExpression e, DCOMP._ISelfInfo self _1720_recIdents = _out253; readIdents = _1720_recIdents; Std.Wrappers._IOption _source92 = _1717_nativeFromType; - bool unmatched92 = true; - if (unmatched92) { + { if (_source92.is_Some) { RAST._IType _1721_v = _source92.dtor_value; - unmatched92 = false; RAST._IType _1722_toTpeRust; RAST._IType _out254; _out254 = (this).GenType(_1708_toTpe, DCOMP.GenTypeContext.@default()); @@ -4231,10 +4193,10 @@ public void GenExprConvertFromNewtype(DAST._IExpression e, DCOMP._ISelfInfo self (this).FromOwned(r, expectedOwnership, out _out255, out _out256); r = _out255; resultingOwnership = _out256; + goto after_match38; } } - if (unmatched92) { - unmatched92 = false; + { if (_1713_erase) { r = _1718_recursiveGen; } else { @@ -4246,6 +4208,7 @@ public void GenExprConvertFromNewtype(DAST._IExpression e, DCOMP._ISelfInfo self r = _out257; resultingOwnership = _out258; } + after_match38: ; } else { if ((_1717_nativeFromType).is_Some) { if (object.Equals(_1708_toTpe, DAST.Type.create_Primitive(DAST.Primitive.create_Char()))) { @@ -4511,8 +4474,7 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM readIdents = _1775_recIdents; } else { _System._ITuple2 _source93 = _System.Tuple2.create(_1771_fromTpe, _1772_toTpe); - bool unmatched93 = true; - if (unmatched93) { + { DAST._IType _10 = _source93.dtor__1; if (_10.is_UserDefined) { DAST._IResolvedType resolved2 = _10.dtor_resolved; @@ -4522,7 +4484,6 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM DAST._INewtypeRange _1777_range = kind2.dtor_range; bool _1778_erase = kind2.dtor_erase; Dafny.ISequence _1779_attributes = resolved2.dtor_attributes; - unmatched93 = false; { RAST._IExpr _out289; DCOMP._IOwnership _out290; @@ -4532,10 +4493,11 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out290; readIdents = _out291; } + goto after_match39; } } } - if (unmatched93) { + { DAST._IType _00 = _source93.dtor__0; if (_00.is_UserDefined) { DAST._IResolvedType resolved3 = _00.dtor_resolved; @@ -4545,7 +4507,6 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM DAST._INewtypeRange _1781_range = kind3.dtor_range; bool _1782_erase = kind3.dtor_erase; Dafny.ISequence _1783_attributes = resolved3.dtor_attributes; - unmatched93 = false; { RAST._IExpr _out292; DCOMP._IOwnership _out293; @@ -4555,10 +4516,11 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out293; readIdents = _out294; } + goto after_match39; } } } - if (unmatched93) { + { DAST._IType _01 = _source93.dtor__0; if (_01.is_Primitive) { DAST._IPrimitive _h72 = _01.dtor_Primitive_a0; @@ -4567,7 +4529,6 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM if (_11.is_Primitive) { DAST._IPrimitive _h73 = _11.dtor_Primitive_a0; if (_h73.is_Real) { - unmatched93 = false; { RAST._IExpr _1784_recursiveGen; DCOMP._IOwnership _1785___v137; @@ -4587,12 +4548,13 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out299; readIdents = _1786_recIdents; } + goto after_match39; } } } } } - if (unmatched93) { + { DAST._IType _02 = _source93.dtor__0; if (_02.is_Primitive) { DAST._IPrimitive _h74 = _02.dtor_Primitive_a0; @@ -4601,7 +4563,6 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM if (_12.is_Primitive) { DAST._IPrimitive _h75 = _12.dtor_Primitive_a0; if (_h75.is_Int) { - unmatched93 = false; { RAST._IExpr _1787_recursiveGen; DCOMP._IOwnership _1788___v138; @@ -4621,19 +4582,19 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out304; readIdents = _1789_recIdents; } + goto after_match39; } } } } } - if (unmatched93) { + { DAST._IType _03 = _source93.dtor__0; if (_03.is_Primitive) { DAST._IPrimitive _h76 = _03.dtor_Primitive_a0; if (_h76.is_Int) { DAST._IType _13 = _source93.dtor__1; if (_13.is_Passthrough) { - unmatched93 = false; { RAST._IType _1790_rhsType; RAST._IType _out305; @@ -4657,18 +4618,18 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out310; readIdents = _1793_recIdents; } + goto after_match39; } } } } - if (unmatched93) { + { DAST._IType _04 = _source93.dtor__0; if (_04.is_Passthrough) { DAST._IType _14 = _source93.dtor__1; if (_14.is_Primitive) { DAST._IPrimitive _h77 = _14.dtor_Primitive_a0; if (_h77.is_Int) { - unmatched93 = false; { RAST._IType _1794_rhsType; RAST._IType _out311; @@ -4692,11 +4653,12 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out316; readIdents = _1797_recIdents; } + goto after_match39; } } } } - if (unmatched93) { + { DAST._IType _05 = _source93.dtor__0; if (_05.is_Primitive) { DAST._IPrimitive _h78 = _05.dtor_Primitive_a0; @@ -4705,7 +4667,6 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM if (_15.is_Primitive) { DAST._IPrimitive _h79 = _15.dtor_Primitive_a0; if (_h79.is_Char) { - unmatched93 = false; { RAST._IType _1798_rhsType; RAST._IType _out317; @@ -4729,12 +4690,13 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out322; readIdents = _1801_recIdents; } + goto after_match39; } } } } } - if (unmatched93) { + { DAST._IType _06 = _source93.dtor__0; if (_06.is_Primitive) { DAST._IPrimitive _h710 = _06.dtor_Primitive_a0; @@ -4743,7 +4705,6 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM if (_16.is_Primitive) { DAST._IPrimitive _h711 = _16.dtor_Primitive_a0; if (_h711.is_Int) { - unmatched93 = false; { RAST._IType _1802_rhsType; RAST._IType _out323; @@ -4767,17 +4728,17 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out328; readIdents = _1805_recIdents; } + goto after_match39; } } } } } - if (unmatched93) { + { DAST._IType _07 = _source93.dtor__0; if (_07.is_Passthrough) { DAST._IType _17 = _source93.dtor__1; if (_17.is_Passthrough) { - unmatched93 = false; { RAST._IExpr _1806_recursiveGen; DCOMP._IOwnership _1807___v147; @@ -4801,11 +4762,11 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM resultingOwnership = _out334; readIdents = _1808_recIdents; } + goto after_match39; } } } - if (unmatched93) { - unmatched93 = false; + { { RAST._IExpr _out335; DCOMP._IOwnership _out336; @@ -4816,6 +4777,7 @@ public void GenExprConvert(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOM readIdents = _out337; } } + after_match39: ; } return ; } @@ -4828,7 +4790,11 @@ public void GenIdent(Dafny.ISequence rName, DCOMP._ISelfInfo selfIde Std.Wrappers._IOption _1810_tpe; _1810_tpe = (env).GetType(rName); Std.Wrappers._IOption _1811_placeboOpt; - _1811_placeboOpt = (((_1810_tpe).is_Some) ? (((_1810_tpe).dtor_value).ExtractMaybePlacebo()) : (Std.Wrappers.Option.create_None())); + if ((_1810_tpe).is_Some) { + _1811_placeboOpt = ((_1810_tpe).dtor_value).ExtractMaybePlacebo(); + } else { + _1811_placeboOpt = Std.Wrappers.Option.create_None(); + } bool _1812_currentlyBorrowed; _1812_currentlyBorrowed = (env).IsBorrowed(rName); bool _1813_noNeedOfClone; @@ -4840,7 +4806,11 @@ public void GenIdent(Dafny.ISequence rName, DCOMP._ISelfInfo selfIde _1810_tpe = Std.Wrappers.Option.create_Some((_1811_placeboOpt).dtor_value); } if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipAutoBorrowed())) { - resultingOwnership = ((_1812_currentlyBorrowed) ? (DCOMP.Ownership.create_OwnershipBorrowed()) : (DCOMP.Ownership.create_OwnershipOwned())); + if (_1812_currentlyBorrowed) { + resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowed(); + } else { + resultingOwnership = DCOMP.Ownership.create_OwnershipOwned(); + } } else if (object.Equals(expectedOwnership, DCOMP.Ownership.create_OwnershipBorrowedMut())) { if ((rName).Equals(Dafny.Sequence.UnicodeFromString("self"))) { resultingOwnership = DCOMP.Ownership.create_OwnershipBorrowedMut(); @@ -4856,21 +4826,17 @@ public void GenIdent(Dafny.ISequence rName, DCOMP._ISelfInfo selfIde bool _1814_needObjectFromRef; _1814_needObjectFromRef = ((((selfIdent).is_ThisTyped) && ((selfIdent).IsSelf())) && (((selfIdent).dtor_rSelfName).Equals(rName))) && (((System.Func)(() => { DAST._IType _source94 = (selfIdent).dtor_dafnyType; - bool unmatched94 = true; - if (unmatched94) { + { if (_source94.is_UserDefined) { DAST._IResolvedType resolved4 = _source94.dtor_resolved; DAST._IResolvedTypeBase _1815_base = resolved4.dtor_kind; Dafny.ISequence _1816_attributes = resolved4.dtor_attributes; - unmatched94 = false; return ((_1815_base).is_Class) || ((_1815_base).is_Trait); } } - if (unmatched94) { - unmatched94 = false; + { return false; } - throw new System.Exception("unexpected control point"); }))()); if (_1814_needObjectFromRef) { r = ((((RAST.__default.dafny__runtime).MSel(Dafny.Sequence.UnicodeFromString("Object"))).ApplyType(Dafny.Sequence.FromElements(RAST.__default.RawType(Dafny.Sequence.UnicodeFromString("_"))))).MSel(Dafny.Sequence.UnicodeFromString("from_ref"))).Apply(Dafny.Sequence.FromElements(r)); @@ -4951,8 +4917,7 @@ public void GenArgs(DCOMP._ISelfInfo selfIdent, DAST._ICallName name, Dafny.ISeq typeExprs = Dafny.Sequence.Concat(typeExprs, Dafny.Sequence.FromElements(_1826_typeExpr)); } DAST._ICallName _source95 = name; - bool unmatched95 = true; - if (unmatched95) { + { if (_source95.is_CallName) { Dafny.ISequence _1827_nameIdent = _source95.dtor_name; Std.Wrappers._IOption onType1 = _source95.dtor_onType; @@ -4960,7 +4925,6 @@ public void GenArgs(DCOMP._ISelfInfo selfIdent, DAST._ICallName name, Dafny.ISeq DAST._IType value10 = onType1.dtor_value; if (value10.is_UserDefined) { DAST._IResolvedType _1828_resolvedType = value10.dtor_resolved; - unmatched95 = false; if ((((_1828_resolvedType).dtor_kind).is_Trait) || (Dafny.Helpers.Id, bool>>((_1829_resolvedType, _1830_nameIdent) => Dafny.Helpers.Quantifier>(((_1829_resolvedType).dtor_properMethods).UniqueElements, true, (((_forall_var_8) => { Dafny.ISequence _1831_m = (Dafny.ISequence)_forall_var_8; return !(((_1829_resolvedType).dtor_properMethods).Contains(_1831_m)) || (!object.Equals((_1831_m), _1830_nameIdent)); @@ -4969,14 +4933,15 @@ public void GenArgs(DCOMP._ISelfInfo selfIdent, DAST._ICallName name, Dafny.ISeq } else { fullNameQualifier = Std.Wrappers.Option.create_None(); } + goto after_match40; } } } } - if (unmatched95) { - unmatched95 = false; + { fullNameQualifier = Std.Wrappers.Option.create_None(); } + after_match40: ; if ((((((fullNameQualifier).is_Some) && ((selfIdent).is_ThisTyped)) && (((selfIdent).dtor_dafnyType).is_UserDefined)) && ((this).IsSameResolvedType(((selfIdent).dtor_dafnyType).dtor_resolved, (fullNameQualifier).dtor_value))) && (!((this).HasExternAttributeRenamingModule(((fullNameQualifier).dtor_value).dtor_attributes)))) { fullNameQualifier = Std.Wrappers.Option.create_None(); } @@ -4987,10 +4952,8 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = DCOMP.Ownership.Default(); readIdents = Dafny.Set>.Empty; DAST._IExpression _source96 = e; - bool unmatched96 = true; - if (unmatched96) { + { if (_source96.is_Literal) { - unmatched96 = false; RAST._IExpr _out343; DCOMP._IOwnership _out344; Dafny.ISet> _out345; @@ -4998,12 +4961,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv r = _out343; resultingOwnership = _out344; readIdents = _out345; + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Ident) { Dafny.ISequence _1832_name = _source96.dtor_name; - unmatched96 = false; { RAST._IExpr _out346; DCOMP._IOwnership _out347; @@ -5013,13 +4976,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out347; readIdents = _out348; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Companion) { Dafny.ISequence> _1833_path = _source96.dtor_Companion_a0; Dafny.ISequence _1834_typeArgs = _source96.dtor_typeArgs; - unmatched96 = false; { RAST._IExpr _out349; _out349 = DCOMP.COMP.GenPathExpr(_1833_path); @@ -5051,12 +5014,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_InitializationValue) { DAST._IType _1838_typ = _source96.dtor_typ; - unmatched96 = false; { RAST._IType _1839_typExpr; RAST._IType _out353; @@ -5075,12 +5038,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Tuple) { Dafny.ISequence _1840_values = _source96.dtor_Tuple_a0; - unmatched96 = false; { Dafny.ISequence _1841_exprs; _1841_exprs = Dafny.Sequence.FromElements(); @@ -5100,7 +5063,11 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv _1841_exprs = Dafny.Sequence.Concat(_1841_exprs, Dafny.Sequence.FromElements(_1843_recursiveGen)); readIdents = Dafny.Set>.Union(readIdents, _1845_recIdents); } - r = (((new BigInteger((_1840_values).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) ? (RAST.Expr.create_Tuple(_1841_exprs)) : (RAST.__default.SystemTuple(_1841_exprs))); + if ((new BigInteger((_1840_values).Count)) <= (RAST.__default.MAX__TUPLE__SIZE)) { + r = RAST.Expr.create_Tuple(_1841_exprs); + } else { + r = RAST.__default.SystemTuple(_1841_exprs); + } RAST._IExpr _out359; DCOMP._IOwnership _out360; (this).FromOwned(r, expectedOwnership, out _out359, out _out360); @@ -5108,14 +5075,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out360; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_New) { Dafny.ISequence> _1846_path = _source96.dtor_path; Dafny.ISequence _1847_typeArgs = _source96.dtor_typeArgs; Dafny.ISequence _1848_args = _source96.dtor_args; - unmatched96 = false; { RAST._IExpr _out361; _out361 = DCOMP.COMP.GenPathExpr(_1846_path); @@ -5160,13 +5127,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out367; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_NewUninitArray) { Dafny.ISequence _1857_dims = _source96.dtor_dims; DAST._IType _1858_typ = _source96.dtor_typ; - unmatched96 = false; { if ((new BigInteger(16)) < (new BigInteger((_1857_dims).Count))) { Dafny.ISequence _1859_msg; @@ -5214,12 +5181,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv r = _out372; resultingOwnership = _out373; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_ArrayIndexToInt) { DAST._IExpression _1867_underlying = _source96.dtor_value; - unmatched96 = false; { RAST._IExpr _1868_recursiveGen; DCOMP._IOwnership _1869___v162; @@ -5239,13 +5206,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv r = _out377; resultingOwnership = _out378; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_FinalizeNewArray) { DAST._IExpression _1871_underlying = _source96.dtor_value; DAST._IType _1872_typ = _source96.dtor_typ; - unmatched96 = false; { RAST._IType _1873_tpe; RAST._IType _out379; @@ -5285,16 +5252,16 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv r = _out383; resultingOwnership = _out384; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_DatatypeValue) { DAST._IResolvedType _1879_datatypeType = _source96.dtor_datatypeType; Dafny.ISequence _1880_typeArgs = _source96.dtor_typeArgs; Dafny.ISequence _1881_variant = _source96.dtor_variant; bool _1882_isCo = _source96.dtor_isCo; Dafny.ISequence<_System._ITuple2, DAST._IExpression>> _1883_values = _source96.dtor_contents; - unmatched96 = false; { RAST._IExpr _out385; _out385 = DCOMP.COMP.GenPathExpr((_1879_datatypeType).dtor_path); @@ -5377,11 +5344,11 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out394; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Convert) { - unmatched96 = false; { RAST._IExpr _out395; DCOMP._IOwnership _out396; @@ -5391,13 +5358,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out396; readIdents = _out397; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_SeqConstruct) { DAST._IExpression _1900_length = _source96.dtor_length; DAST._IExpression _1901_expr = _source96.dtor_elem; - unmatched96 = false; { RAST._IExpr _1902_recursiveGen; DCOMP._IOwnership _1903___v169; @@ -5428,13 +5395,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out405; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_SeqValue) { Dafny.ISequence _1908_exprs = _source96.dtor_elements; DAST._IType _1909_typ = _source96.dtor_typ; - unmatched96 = false; { readIdents = Dafny.Set>.FromElements(); RAST._IType _1910_genTpe; @@ -5471,12 +5438,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out411; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_SetValue) { Dafny.ISequence _1916_exprs = _source96.dtor_elements; - unmatched96 = false; { Dafny.ISequence _1917_generatedValues; _1917_generatedValues = Dafny.Sequence.FromElements(); @@ -5506,12 +5473,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out416; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_MultisetValue) { Dafny.ISequence _1922_exprs = _source96.dtor_elements; - unmatched96 = false; { Dafny.ISequence _1923_generatedValues; _1923_generatedValues = Dafny.Sequence.FromElements(); @@ -5541,12 +5508,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out421; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_ToMultiset) { DAST._IExpression _1928_expr = _source96.dtor_ToMultiset_a0; - unmatched96 = false; { RAST._IExpr _1929_recursiveGen; DCOMP._IOwnership _1930___v174; @@ -5567,12 +5534,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out426; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_MapValue) { Dafny.ISequence<_System._ITuple2> _1932_mapElems = _source96.dtor_mapElems; - unmatched96 = false; { Dafny.ISequence<_System._ITuple2> _1933_generatedValues; _1933_generatedValues = Dafny.Sequence<_System._ITuple2>.FromElements(); @@ -5623,14 +5590,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out434; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_SeqUpdate) { DAST._IExpression _1944_expr = _source96.dtor_expr; DAST._IExpression _1945_index = _source96.dtor_indexExpr; DAST._IExpression _1946_value = _source96.dtor_value; - unmatched96 = false; { RAST._IExpr _1947_exprR; DCOMP._IOwnership _1948___v177; @@ -5671,14 +5638,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1949_exprIdents, _1952_indexIdents), _1955_valueIdents); return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_MapUpdate) { DAST._IExpression _1956_expr = _source96.dtor_expr; DAST._IExpression _1957_index = _source96.dtor_indexExpr; DAST._IExpression _1958_value = _source96.dtor_value; - unmatched96 = false; { RAST._IExpr _1959_exprR; DCOMP._IOwnership _1960___v178; @@ -5719,19 +5686,17 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1961_exprIdents, _1964_indexIdents), _1967_valueIdents); return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_This) { - unmatched96 = false; { DCOMP._ISelfInfo _source97 = selfIdent; - bool unmatched97 = true; - if (unmatched97) { + { if (_source97.is_ThisTyped) { Dafny.ISequence _1968_id = _source97.dtor_rSelfName; DAST._IType _1969_dafnyType = _source97.dtor_dafnyType; - unmatched97 = false; { RAST._IExpr _out457; DCOMP._IOwnership _out458; @@ -5741,11 +5706,11 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out458; readIdents = _out459; } + goto after_match42; } } - if (unmatched97) { + { DCOMP._ISelfInfo _1970_None = _source97; - unmatched97 = false; { r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("panic!(\"this outside of a method\")")); RAST._IExpr _out460; @@ -5756,16 +5721,17 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.FromElements(); } } + after_match42: ; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Ite) { DAST._IExpression _1971_cond = _source96.dtor_cond; DAST._IExpression _1972_t = _source96.dtor_thn; DAST._IExpression _1973_f = _source96.dtor_els; - unmatched96 = false; { RAST._IExpr _1974_cond; DCOMP._IOwnership _1975___v179; @@ -5806,15 +5772,15 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.Union(Dafny.Set>.Union(_1976_recIdentsCond, _1982_recIdentsT), _1979_recIdentsF); return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_UnOp) { DAST._IUnaryOp unOp0 = _source96.dtor_unOp; if (unOp0.is_Not) { DAST._IExpression _1983_e = _source96.dtor_expr; DAST.Format._IUnaryOpFormat _1984_format = _source96.dtor_format1; - unmatched96 = false; { RAST._IExpr _1985_recursiveGen; DCOMP._IOwnership _1986___v181; @@ -5835,16 +5801,16 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _1987_recIdents; return ; } + goto after_match41; } } } - if (unmatched96) { + { if (_source96.is_UnOp) { DAST._IUnaryOp unOp1 = _source96.dtor_unOp; if (unOp1.is_BitwiseNot) { DAST._IExpression _1988_e = _source96.dtor_expr; DAST.Format._IUnaryOpFormat _1989_format = _source96.dtor_format1; - unmatched96 = false; { RAST._IExpr _1990_recursiveGen; DCOMP._IOwnership _1991___v182; @@ -5865,16 +5831,16 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _1992_recIdents; return ; } + goto after_match41; } } } - if (unmatched96) { + { if (_source96.is_UnOp) { DAST._IUnaryOp unOp2 = _source96.dtor_unOp; if (unOp2.is_Cardinality) { DAST._IExpression _1993_e = _source96.dtor_expr; DAST.Format._IUnaryOpFormat _1994_format = _source96.dtor_format1; - unmatched96 = false; { RAST._IExpr _1995_recursiveGen; DCOMP._IOwnership _1996_recOwned; @@ -5895,12 +5861,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _1997_recIdents; return ; } + goto after_match41; } } } - if (unmatched96) { + { if (_source96.is_BinOp) { - unmatched96 = false; RAST._IExpr _out488; DCOMP._IOwnership _out489; Dafny.ISet> _out490; @@ -5908,15 +5874,15 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv r = _out488; resultingOwnership = _out489; readIdents = _out490; + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_ArrayLen) { DAST._IExpression _1998_expr = _source96.dtor_expr; DAST._IType _1999_exprType = _source96.dtor_exprType; BigInteger _2000_dim = _source96.dtor_dim; bool _2001_native = _source96.dtor_native; - unmatched96 = false; { RAST._IExpr _2002_recursiveGen; DCOMP._IOwnership _2003___v187; @@ -5961,12 +5927,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _2004_recIdents; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_MapKeys) { DAST._IExpression _2008_expr = _source96.dtor_expr; - unmatched96 = false; { RAST._IExpr _2009_recursiveGen; DCOMP._IOwnership _2010___v188; @@ -5987,12 +5953,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out501; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_MapValues) { DAST._IExpression _2012_expr = _source96.dtor_expr; - unmatched96 = false; { RAST._IExpr _2013_recursiveGen; DCOMP._IOwnership _2014___v189; @@ -6013,16 +5979,16 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out506; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_SelectFn) { DAST._IExpression _2016_on = _source96.dtor_expr; Dafny.ISequence _2017_field = _source96.dtor_field; bool _2018_isDatatype = _source96.dtor_onDatatype; bool _2019_isStatic = _source96.dtor_isStatic; BigInteger _2020_arity = _source96.dtor_arity; - unmatched96 = false; { RAST._IExpr _2021_onExpr; DCOMP._IOwnership _2022_onOwned; @@ -6080,9 +6046,10 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _2023_recIdents; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Select) { DAST._IExpression expr0 = _source96.dtor_expr; if (expr0.is_Companion) { @@ -6092,7 +6059,6 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv bool _2033_isConstant = _source96.dtor_isConstant; bool _2034_isDatatype = _source96.dtor_onDatatype; DAST._IType _2035_fieldType = _source96.dtor_fieldType; - unmatched96 = false; { RAST._IExpr _2036_onExpr; DCOMP._IOwnership _2037_onOwned; @@ -6113,17 +6079,17 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _2038_recIdents; return ; } + goto after_match41; } } } - if (unmatched96) { + { if (_source96.is_Select) { DAST._IExpression _2039_on = _source96.dtor_expr; Dafny.ISequence _2040_field = _source96.dtor_field; bool _2041_isConstant = _source96.dtor_isConstant; bool _2042_isDatatype = _source96.dtor_onDatatype; DAST._IType _2043_fieldType = _source96.dtor_fieldType; - unmatched96 = false; { if (_2042_isDatatype) { RAST._IExpr _2044_onExpr; @@ -6161,8 +6127,7 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv r = _2048_onExpr; if (!object.Equals(_2048_onExpr, RAST.__default.self)) { RAST._IExpr _source98 = _2048_onExpr; - bool unmatched98 = true; - if (unmatched98) { + { if (_source98.is_UnaryOp) { Dafny.ISequence op15 = _source98.dtor_op1; if (object.Equals(op15, Dafny.Sequence.UnicodeFromString("&"))) { @@ -6170,16 +6135,16 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv if (underlying5.is_Identifier) { Dafny.ISequence name15 = underlying5.dtor_name; if (object.Equals(name15, Dafny.Sequence.UnicodeFromString("this"))) { - unmatched98 = false; r = RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("this")); + goto after_match43; } } } } } - if (unmatched98) { - unmatched98 = false; + { } + after_match43: ; if (((this).ObjectType).is_RcMut) { r = (r).Clone(); } @@ -6199,14 +6164,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv } return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Index) { DAST._IExpression _2051_on = _source96.dtor_expr; DAST._ICollKind _2052_collKind = _source96.dtor_collKind; Dafny.ISequence _2053_indices = _source96.dtor_indices; - unmatched96 = false; { RAST._IExpr _2054_onExpr; DCOMP._IOwnership _2055_onOwned; @@ -6270,15 +6235,15 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out538; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_IndexRange) { DAST._IExpression _2065_on = _source96.dtor_expr; bool _2066_isArray = _source96.dtor_isArray; Std.Wrappers._IOption _2067_low = _source96.dtor_low; Std.Wrappers._IOption _2068_high = _source96.dtor_high; - unmatched96 = false; { RAST._IExpr _2069_onExpr; DCOMP._IOwnership _2070_onOwned; @@ -6292,15 +6257,23 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv _2071_recIdents = _out541; readIdents = _2071_recIdents; Dafny.ISequence _2072_methodName; - _2072_methodName = (((_2067_low).is_Some) ? ((((_2068_high).is_Some) ? (Dafny.Sequence.UnicodeFromString("slice")) : (Dafny.Sequence.UnicodeFromString("drop")))) : ((((_2068_high).is_Some) ? (Dafny.Sequence.UnicodeFromString("take")) : (Dafny.Sequence.UnicodeFromString(""))))); + if ((_2067_low).is_Some) { + if ((_2068_high).is_Some) { + _2072_methodName = Dafny.Sequence.UnicodeFromString("slice"); + } else { + _2072_methodName = Dafny.Sequence.UnicodeFromString("drop"); + } + } else if ((_2068_high).is_Some) { + _2072_methodName = Dafny.Sequence.UnicodeFromString("take"); + } else { + _2072_methodName = Dafny.Sequence.UnicodeFromString(""); + } Dafny.ISequence _2073_arguments; _2073_arguments = Dafny.Sequence.FromElements(); Std.Wrappers._IOption _source99 = _2067_low; - bool unmatched99 = true; - if (unmatched99) { + { if (_source99.is_Some) { DAST._IExpression _2074_l = _source99.dtor_value; - unmatched99 = false; { RAST._IExpr _2075_lExpr; DCOMP._IOwnership _2076___v192; @@ -6315,17 +6288,16 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv _2073_arguments = Dafny.Sequence.Concat(_2073_arguments, Dafny.Sequence.FromElements(_2075_lExpr)); readIdents = Dafny.Set>.Union(readIdents, _2077_recIdentsL); } + goto after_match44; } } - if (unmatched99) { - unmatched99 = false; + { } + after_match44: ; Std.Wrappers._IOption _source100 = _2068_high; - bool unmatched100 = true; - if (unmatched100) { + { if (_source100.is_Some) { DAST._IExpression _2078_h = _source100.dtor_value; - unmatched100 = false; { RAST._IExpr _2079_hExpr; DCOMP._IOwnership _2080___v193; @@ -6340,11 +6312,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv _2073_arguments = Dafny.Sequence.Concat(_2073_arguments, Dafny.Sequence.FromElements(_2079_hExpr)); readIdents = Dafny.Set>.Union(readIdents, _2081_recIdentsH); } + goto after_match45; } } - if (unmatched100) { - unmatched100 = false; + { } + after_match45: ; r = _2069_onExpr; if (_2066_isArray) { if (!(_2072_methodName).Equals(Dafny.Sequence.UnicodeFromString(""))) { @@ -6363,14 +6336,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out549; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_TupleSelect) { DAST._IExpression _2082_on = _source96.dtor_expr; BigInteger _2083_idx = _source96.dtor_index; DAST._IType _2084_fieldType = _source96.dtor_fieldType; - unmatched96 = false; { RAST._IExpr _2085_onExpr; DCOMP._IOwnership _2086_onOwnership; @@ -6385,19 +6358,18 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv Dafny.ISequence _2088_selName; _2088_selName = Std.Strings.__default.OfNat(_2083_idx); DAST._IType _source101 = _2084_fieldType; - bool unmatched101 = true; - if (unmatched101) { + { if (_source101.is_Tuple) { Dafny.ISequence _2089_tps = _source101.dtor_Tuple_a0; - unmatched101 = false; if (((_2084_fieldType).is_Tuple) && ((new BigInteger((_2089_tps).Count)) > (RAST.__default.MAX__TUPLE__SIZE))) { _2088_selName = Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("_"), _2088_selName); } + goto after_match46; } } - if (unmatched101) { - unmatched101 = false; + { } + after_match46: ; r = ((_2085_onExpr).Sel(_2088_selName)).Clone(); RAST._IExpr _out553; DCOMP._IOwnership _out554; @@ -6407,15 +6379,15 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _2087_recIdents; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Call) { DAST._IExpression _2090_on = _source96.dtor_on; DAST._ICallName _2091_name = _source96.dtor_callName; Dafny.ISequence _2092_typeArgs = _source96.dtor_typeArgs; Dafny.ISequence _2093_args = _source96.dtor_args; - unmatched96 = false; { Dafny.ISequence _2094_argExprs; Dafny.ISet> _2095_recIdents; @@ -6432,14 +6404,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv _2097_fullNameQualifier = _out558; readIdents = _2095_recIdents; Std.Wrappers._IOption _source102 = _2097_fullNameQualifier; - bool unmatched102 = true; - if (unmatched102) { + { if (_source102.is_Some) { DAST._IResolvedType value11 = _source102.dtor_value; Dafny.ISequence> _2098_path = value11.dtor_path; Dafny.ISequence _2099_onTypeArgs = value11.dtor_typeArgs; DAST._IResolvedTypeBase _2100_base = value11.dtor_kind; - unmatched102 = false; RAST._IExpr _2101_fullPath; RAST._IExpr _out559; _out559 = DCOMP.COMP.GenPathExpr(_2098_path); @@ -6477,10 +6447,10 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv (this).FromOwned(r, expectedOwnership, out _out567, out _out568); r = _out567; resultingOwnership = _out568; + goto after_match47; } } - if (unmatched102) { - unmatched102 = false; + { RAST._IExpr _2106_onExpr; DCOMP._IOwnership _2107___v199; Dafny.ISet> _2108_recIdents; @@ -6493,62 +6463,49 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv _2108_recIdents = _out571; readIdents = Dafny.Set>.Union(readIdents, _2108_recIdents); Dafny.ISequence _2109_renderedName; - _2109_renderedName = ((System.Func>)(() => { - DAST._ICallName _source103 = _2091_name; - bool unmatched103 = true; - if (unmatched103) { - if (_source103.is_CallName) { - Dafny.ISequence _2110_ident = _source103.dtor_name; - unmatched103 = false; - return DCOMP.__default.escapeName(_2110_ident); - } + DAST._ICallName _source103 = _2091_name; + { + if (_source103.is_CallName) { + Dafny.ISequence _2110_ident = _source103.dtor_name; + _2109_renderedName = DCOMP.__default.escapeName(_2110_ident); + goto after_match48; } - if (unmatched103) { - bool disjunctiveMatch15 = false; - if (_source103.is_MapBuilderAdd) { - disjunctiveMatch15 = true; - } - if (_source103.is_SetBuilderAdd) { - disjunctiveMatch15 = true; - } - if (disjunctiveMatch15) { - unmatched103 = false; - return Dafny.Sequence.UnicodeFromString("add"); - } + } + { + bool disjunctiveMatch13 = false; + if (_source103.is_MapBuilderAdd) { + disjunctiveMatch13 = true; } - if (unmatched103) { - bool disjunctiveMatch16 = false; - disjunctiveMatch16 = true; - disjunctiveMatch16 = true; - if (disjunctiveMatch16) { - unmatched103 = false; - return Dafny.Sequence.UnicodeFromString("build"); - } + if (_source103.is_SetBuilderAdd) { + disjunctiveMatch13 = true; + } + if (disjunctiveMatch13) { + _2109_renderedName = Dafny.Sequence.UnicodeFromString("add"); + goto after_match48; } - throw new System.Exception("unexpected control point"); - }))(); + } + { + _2109_renderedName = Dafny.Sequence.UnicodeFromString("build"); + } + after_match48: ; DAST._IExpression _source104 = _2090_on; - bool unmatched104 = true; - if (unmatched104) { + { if (_source104.is_Companion) { - unmatched104 = false; { _2106_onExpr = (_2106_onExpr).MSel(_2109_renderedName); } + goto after_match49; } } - if (unmatched104) { - unmatched104 = false; + { { if (!object.Equals(_2106_onExpr, RAST.__default.self)) { DAST._ICallName _source105 = _2091_name; - bool unmatched105 = true; - if (unmatched105) { + { if (_source105.is_CallName) { Std.Wrappers._IOption onType2 = _source105.dtor_onType; if (onType2.is_Some) { DAST._IType _2111_tpe = onType2.dtor_value; - unmatched105 = false; RAST._IType _2112_typ; RAST._IType _out572; _out572 = (this).GenType(_2111_tpe, DCOMP.GenTypeContext.@default()); @@ -6556,16 +6513,18 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv if ((_2112_typ).IsObjectOrPointer()) { _2106_onExpr = ((this).read__macro).Apply1(_2106_onExpr); } + goto after_match50; } } } - if (unmatched105) { - unmatched105 = false; + { } + after_match50: ; } _2106_onExpr = (_2106_onExpr).Sel(_2109_renderedName); } } + after_match49: ; r = ((_2106_onExpr).ApplyType(_2096_typeExprs)).Apply(_2094_argExprs); RAST._IExpr _out573; DCOMP._IOwnership _out574; @@ -6574,15 +6533,16 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out574; return ; } + after_match47: ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Lambda) { Dafny.ISequence _2113_paramsDafny = _source96.dtor_params; DAST._IType _2114_retType = _source96.dtor_retType; Dafny.ISequence _2115_body = _source96.dtor_body; - unmatched96 = false; { Dafny.ISequence _2116_params; Dafny.ISequence _out575; @@ -6666,14 +6626,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out584; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_BetaRedex) { Dafny.ISequence<_System._ITuple2> _2134_values = _source96.dtor_values; DAST._IType _2135_retType = _source96.dtor_retType; DAST._IExpression _2136_expr = _source96.dtor_expr; - unmatched96 = false; { Dafny.ISequence> _2137_paramNames; _2137_paramNames = Dafny.Sequence>.FromElements(); @@ -6739,15 +6699,15 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out594; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_IIFE) { Dafny.ISequence _2154_name = _source96.dtor_ident; DAST._IType _2155_tpe = _source96.dtor_typ; DAST._IExpression _2156_value = _source96.dtor_value; DAST._IExpression _2157_iifeBody = _source96.dtor_iifeBody; - unmatched96 = false; { RAST._IExpr _2158_valueGen; DCOMP._IOwnership _2159___v214; @@ -6783,13 +6743,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out603; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_Apply) { DAST._IExpression _2165_func = _source96.dtor_expr; Dafny.ISequence _2166_args = _source96.dtor_args; - unmatched96 = false; { RAST._IExpr _2167_funcExpr; DCOMP._IOwnership _2168___v216; @@ -6827,14 +6787,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out611; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_TypeTest) { DAST._IExpression _2175_on = _source96.dtor_on; Dafny.ISequence> _2176_dType = _source96.dtor_dType; Dafny.ISequence _2177_variant = _source96.dtor_variant; - unmatched96 = false; { RAST._IExpr _2178_exprGen; DCOMP._IOwnership _2179___v217; @@ -6859,11 +6819,11 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _2180_recIdents; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_BoolBoundedPool) { - unmatched96 = false; { r = RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("[false, true]")); RAST._IExpr _out618; @@ -6874,12 +6834,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_SetBoundedPool) { DAST._IExpression _2182_of = _source96.dtor_of; - unmatched96 = false; { RAST._IExpr _2183_exprGen; DCOMP._IOwnership _2184___v218; @@ -6900,13 +6860,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _2185_recIdents; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_SeqBoundedPool) { DAST._IExpression _2186_of = _source96.dtor_of; bool _2187_includeDuplicates = _source96.dtor_includeDuplicates; - unmatched96 = false; { RAST._IExpr _2188_exprGen; DCOMP._IOwnership _2189___v219; @@ -6930,12 +6890,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _2190_recIdents; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_MapBoundedPool) { DAST._IExpression _2191_of = _source96.dtor_of; - unmatched96 = false; { RAST._IExpr _2192_exprGen; DCOMP._IOwnership _2193___v220; @@ -6955,14 +6915,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv r = _out633; resultingOwnership = _out634; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_IntRange) { DAST._IExpression _2195_lo = _source96.dtor_lo; DAST._IExpression _2196_hi = _source96.dtor_hi; bool _2197_up = _source96.dtor_up; - unmatched96 = false; { RAST._IExpr _2198_lo; DCOMP._IOwnership _2199___v221; @@ -6997,13 +6957,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.Union(_2200_recIdentsLo, _2203_recIdentsHi); return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_UnboundedIntRange) { DAST._IExpression _2204_start = _source96.dtor_start; bool _2205_up = _source96.dtor_up; - unmatched96 = false; { RAST._IExpr _2206_start; DCOMP._IOwnership _2207___v223; @@ -7028,13 +6988,13 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = _2208_recIdentStart; return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_MapBuilder) { DAST._IType _2209_keyType = _source96.dtor_keyType; DAST._IType _2210_valueType = _source96.dtor_valueType; - unmatched96 = false; { RAST._IType _2211_kType; RAST._IType _out648; @@ -7053,12 +7013,12 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv readIdents = Dafny.Set>.FromElements(); return ; } + goto after_match41; } } - if (unmatched96) { + { if (_source96.is_SetBuilder) { DAST._IType _2213_elemType = _source96.dtor_elemType; - unmatched96 = false; { RAST._IType _2214_eType; RAST._IType _out652; @@ -7073,14 +7033,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out654; return ; } + goto after_match41; } } - if (unmatched96) { + { DAST._IType _2215_elemType = _source96.dtor_elemType; DAST._IExpression _2216_collection = _source96.dtor_collection; bool _2217_is__forall = _source96.dtor_is__forall; DAST._IExpression _2218_lambda = _source96.dtor_lambda; - unmatched96 = false; { RAST._IType _2219_tpe; RAST._IType _out655; @@ -7108,13 +7068,14 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv _2225_newFormals = Dafny.Sequence.FromElements(); BigInteger _hi51 = new BigInteger((_2224_formals).Count); for (BigInteger _2226_i = BigInteger.Zero; _2226_i < _hi51; _2226_i++) { - var _pat_let_tv143 = _2223_extraAttributes; - var _pat_let_tv144 = _2224_formals; - _2225_newFormals = Dafny.Sequence.Concat(_2225_newFormals, Dafny.Sequence.FromElements(Dafny.Helpers.Let((_2224_formals).Select(_2226_i), _pat_let38_0 => Dafny.Helpers.Let(_pat_let38_0, _2227_dt__update__tmp_h0 => Dafny.Helpers.Let, DAST._IFormal>(Dafny.Sequence.Concat(_pat_let_tv143, ((_pat_let_tv144).Select(_2226_i)).dtor_attributes), _pat_let39_0 => Dafny.Helpers.Let, DAST._IFormal>(_pat_let39_0, _2228_dt__update_hattributes_h0 => DAST.Formal.create((_2227_dt__update__tmp_h0).dtor_name, (_2227_dt__update__tmp_h0).dtor_typ, _2228_dt__update_hattributes_h0))))))); + var _pat_let_tv4 = _2223_extraAttributes; + var _pat_let_tv5 = _2224_formals; + _2225_newFormals = Dafny.Sequence.Concat(_2225_newFormals, Dafny.Sequence.FromElements(Dafny.Helpers.Let((_2224_formals).Select(_2226_i), _pat_let34_0 => Dafny.Helpers.Let(_pat_let34_0, _2227_dt__update__tmp_h0 => Dafny.Helpers.Let, DAST._IFormal>(Dafny.Sequence.Concat(_pat_let_tv4, ((_pat_let_tv5).Select(_2226_i)).dtor_attributes), _pat_let35_0 => Dafny.Helpers.Let, DAST._IFormal>(_pat_let35_0, _2228_dt__update_hattributes_h0 => DAST.Formal.create((_2227_dt__update__tmp_h0).dtor_name, (_2227_dt__update__tmp_h0).dtor_typ, _2228_dt__update_hattributes_h0))))))); } - var _pat_let_tv145 = _2225_newFormals; DAST._IExpression _2229_newLambda; - _2229_newLambda = Dafny.Helpers.Let(_2218_lambda, _pat_let40_0 => Dafny.Helpers.Let(_pat_let40_0, _2230_dt__update__tmp_h1 => Dafny.Helpers.Let, DAST._IExpression>(_pat_let_tv145, _pat_let41_0 => Dafny.Helpers.Let, DAST._IExpression>(_pat_let41_0, _2231_dt__update_hparams_h0 => DAST.Expression.create_Lambda(_2231_dt__update_hparams_h0, (_2230_dt__update__tmp_h1).dtor_retType, (_2230_dt__update__tmp_h1).dtor_body))))); + DAST._IExpression _2230_dt__update__tmp_h1 = _2218_lambda; + Dafny.ISequence _2231_dt__update_hparams_h0 = _2225_newFormals; + _2229_newLambda = DAST.Expression.create_Lambda(_2231_dt__update_hparams_h0, (_2230_dt__update__tmp_h1).dtor_retType, (_2230_dt__update__tmp_h1).dtor_body); RAST._IExpr _2232_lambdaGen; DCOMP._IOwnership _2233___v225; Dafny.ISet> _2234_recLambdaIdents; @@ -7126,7 +7087,11 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv _2233___v225 = _out660; _2234_recLambdaIdents = _out661; Dafny.ISequence _2235_fn; - _2235_fn = ((_2217_is__forall) ? (Dafny.Sequence.UnicodeFromString("all")) : (Dafny.Sequence.UnicodeFromString("any"))); + if (_2217_is__forall) { + _2235_fn = Dafny.Sequence.UnicodeFromString("all"); + } else { + _2235_fn = Dafny.Sequence.UnicodeFromString("any"); + } r = ((_2220_collectionGen).Sel(_2235_fn)).Apply1(((_2232_lambdaGen).Sel(Dafny.Sequence.UnicodeFromString("as_ref"))).Apply(Dafny.Sequence.FromElements())); readIdents = Dafny.Set>.Union(_2222_recIdents, _2234_recLambdaIdents); } else { @@ -7141,6 +7106,7 @@ public void GenExpr(DAST._IExpression e, DCOMP._ISelfInfo selfIdent, DCOMP._IEnv resultingOwnership = _out663; } } + after_match41: ; } public Dafny.ISequence Compile(Dafny.ISequence p) { diff --git a/Source/DafnyCore/GeneratedFromDafny/RAST.cs b/Source/DafnyCore/GeneratedFromDafny/RAST.cs index d6cec2e8b57..c8a5fe19bfd 100644 --- a/Source/DafnyCore/GeneratedFromDafny/RAST.cs +++ b/Source/DafnyCore/GeneratedFromDafny/RAST.cs @@ -302,28 +302,20 @@ public Dafny.ISequence dtor_body { } public abstract _IMod DowncastClone(); public Dafny.ISequence _ToString(Dafny.ISequence ind) { - var _pat_let_tv37 = ind; - var _pat_let_tv38 = ind; - var _pat_let_tv39 = ind; - var _pat_let_tv40 = ind; RAST._IMod _source27 = this; - bool unmatched27 = true; - if (unmatched27) { + { if (_source27.is_ExternMod) { Dafny.ISequence _791_name = _source27.dtor_name; - unmatched27 = false; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _791_name), Dafny.Sequence.UnicodeFromString(";")); } } - if (unmatched27) { + { Dafny.ISequence _792_name = _source27.dtor_name; Dafny.ISequence _793_body = _source27.dtor_body; - unmatched27 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _792_name), Dafny.Sequence.UnicodeFromString(" {")), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv37), RAST.__default.IND), RAST.__default.SeqToString(_793_body, Dafny.Helpers.Id, Func>>>((_794_ind) => ((System.Func>)((_795_modDecl) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("pub mod "), _792_name), Dafny.Sequence.UnicodeFromString(" {")), Dafny.Sequence.UnicodeFromString("\n")), ind), RAST.__default.IND), RAST.__default.SeqToString(_793_body, Dafny.Helpers.Id, Func>>>((_794_ind) => ((System.Func>)((_795_modDecl) => { return (_795_modDecl)._ToString(Dafny.Sequence.Concat(_794_ind, RAST.__default.IND)); - })))(_pat_let_tv38), Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n\n"), _pat_let_tv39), RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv40), Dafny.Sequence.UnicodeFromString("}")); + })))(ind), Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n\n"), ind), RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); } - throw new System.Exception("unexpected control point"); } } public class Mod_Mod : Mod { @@ -1948,107 +1940,85 @@ public Std.Wrappers._IOption> dtor_size { } public abstract _IType DowncastClone(); public RAST._IType Replace(Dafny.IMap mapping) { - var _pat_let_tv41 = mapping; - var _pat_let_tv42 = mapping; - var _pat_let_tv43 = mapping; - var _pat_let_tv44 = mapping; - var _pat_let_tv45 = mapping; - var _pat_let_tv46 = mapping; - var _pat_let_tv47 = mapping; - var _pat_let_tv48 = mapping; - var _pat_let_tv49 = mapping; - var _pat_let_tv50 = mapping; - var _pat_let_tv51 = mapping; - var _pat_let_tv52 = mapping; - var _pat_let_tv53 = mapping; - var _pat_let_tv54 = mapping; - var _pat_let_tv55 = mapping; if ((mapping).Contains(this)) { return Dafny.Map.Select(mapping,this); } else { RAST._IType _source28 = this; - bool unmatched28 = true; - if (unmatched28) { + { if (_source28.is_SelfOwned) { - unmatched28 = false; return this; } } - if (unmatched28) { - bool disjunctiveMatch1 = false; + { + bool disjunctiveMatch0 = false; if (_source28.is_U8) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_U16) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_U32) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_U64) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_U128) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_I8) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_I16) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_I32) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_I64) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_I128) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } if (_source28.is_Bool) { - disjunctiveMatch1 = true; + disjunctiveMatch0 = true; } - if (disjunctiveMatch1) { - unmatched28 = false; + if (disjunctiveMatch0) { return this; } } - if (unmatched28) { + { if (_source28.is_TIdentifier) { - unmatched28 = false; return this; } } - if (unmatched28) { + { if (_source28.is_TMemberSelect) { RAST._IType _816_base = _source28.dtor_base; Dafny.ISequence _817_name = _source28.dtor_name; - unmatched28 = false; RAST._IType _818_dt__update__tmp_h0 = this; - RAST._IType _819_dt__update_hbase_h0 = (_816_base).Replace(_pat_let_tv41); + RAST._IType _819_dt__update_hbase_h0 = (_816_base).Replace(mapping); return RAST.Type.create_TMemberSelect(_819_dt__update_hbase_h0, (_818_dt__update__tmp_h0).dtor_name); } } - if (unmatched28) { + { if (_source28.is_TypeApp) { RAST._IType _820_baseName = _source28.dtor_baseName; Dafny.ISequence _821_arguments = _source28.dtor_arguments; - unmatched28 = false; RAST._IType _822_dt__update__tmp_h1 = this; Dafny.ISequence _823_dt__update_harguments_h0 = Std.Collections.Seq.__default.Map(Dafny.Helpers.Id, Dafny.ISequence, Func>>((_824_mapping, _825_arguments) => ((System.Func)((_826_t) => { return (_826_t).Replace(_824_mapping); - })))(_pat_let_tv42, _821_arguments), _821_arguments); - RAST._IType _827_dt__update_hbaseName_h0 = (_820_baseName).Replace(_pat_let_tv43); + })))(mapping, _821_arguments), _821_arguments); + RAST._IType _827_dt__update_hbaseName_h0 = (_820_baseName).Replace(mapping); return RAST.Type.create_TypeApp(_827_dt__update_hbaseName_h0, _823_dt__update_harguments_h0); } } - if (unmatched28) { + { if (_source28.is_Borrowed) { RAST._IType _828_underlying = _source28.dtor_underlying; - unmatched28 = false; RAST._IType _829_dt__update__tmp_h2 = this; - RAST._IType _830_dt__update_hunderlying_h0 = (_828_underlying).Replace(_pat_let_tv44); + RAST._IType _830_dt__update_hunderlying_h0 = (_828_underlying).Replace(mapping); if ((_829_dt__update__tmp_h2).is_Borrowed) { return RAST.Type.create_Borrowed(_830_dt__update_hunderlying_h0); } else if ((_829_dt__update__tmp_h2).is_BorrowedMut) { @@ -2066,12 +2036,11 @@ public RAST._IType Replace(Dafny.IMap mapping) { } } } - if (unmatched28) { + { if (_source28.is_BorrowedMut) { RAST._IType _831_underlying = _source28.dtor_underlying; - unmatched28 = false; RAST._IType _832_dt__update__tmp_h3 = this; - RAST._IType _833_dt__update_hunderlying_h1 = (_831_underlying).Replace(_pat_let_tv45); + RAST._IType _833_dt__update_hunderlying_h1 = (_831_underlying).Replace(mapping); if ((_832_dt__update__tmp_h3).is_Borrowed) { return RAST.Type.create_Borrowed(_833_dt__update_hunderlying_h1); } else if ((_832_dt__update__tmp_h3).is_BorrowedMut) { @@ -2089,12 +2058,11 @@ public RAST._IType Replace(Dafny.IMap mapping) { } } } - if (unmatched28) { + { if (_source28.is_Pointer) { RAST._IType _834_underlying = _source28.dtor_underlying; - unmatched28 = false; RAST._IType _835_dt__update__tmp_h4 = this; - RAST._IType _836_dt__update_hunderlying_h2 = (_834_underlying).Replace(_pat_let_tv46); + RAST._IType _836_dt__update_hunderlying_h2 = (_834_underlying).Replace(mapping); if ((_835_dt__update__tmp_h4).is_Borrowed) { return RAST.Type.create_Borrowed(_836_dt__update_hunderlying_h2); } else if ((_835_dt__update__tmp_h4).is_BorrowedMut) { @@ -2112,12 +2080,11 @@ public RAST._IType Replace(Dafny.IMap mapping) { } } } - if (unmatched28) { + { if (_source28.is_PointerMut) { RAST._IType _837_underlying = _source28.dtor_underlying; - unmatched28 = false; RAST._IType _838_dt__update__tmp_h5 = this; - RAST._IType _839_dt__update_hunderlying_h3 = (_837_underlying).Replace(_pat_let_tv47); + RAST._IType _839_dt__update_hunderlying_h3 = (_837_underlying).Replace(mapping); if ((_838_dt__update__tmp_h5).is_Borrowed) { return RAST.Type.create_Borrowed(_839_dt__update_hunderlying_h3); } else if ((_838_dt__update__tmp_h5).is_BorrowedMut) { @@ -2135,12 +2102,11 @@ public RAST._IType Replace(Dafny.IMap mapping) { } } } - if (unmatched28) { + { if (_source28.is_ImplType) { RAST._IType _840_underlying = _source28.dtor_underlying; - unmatched28 = false; RAST._IType _841_dt__update__tmp_h6 = this; - RAST._IType _842_dt__update_hunderlying_h4 = (_840_underlying).Replace(_pat_let_tv48); + RAST._IType _842_dt__update_hunderlying_h4 = (_840_underlying).Replace(mapping); if ((_841_dt__update__tmp_h6).is_Borrowed) { return RAST.Type.create_Borrowed(_842_dt__update_hunderlying_h4); } else if ((_841_dt__update__tmp_h6).is_BorrowedMut) { @@ -2158,12 +2124,11 @@ public RAST._IType Replace(Dafny.IMap mapping) { } } } - if (unmatched28) { + { if (_source28.is_DynType) { RAST._IType _843_underlying = _source28.dtor_underlying; - unmatched28 = false; RAST._IType _844_dt__update__tmp_h7 = this; - RAST._IType _845_dt__update_hunderlying_h5 = (_843_underlying).Replace(_pat_let_tv49); + RAST._IType _845_dt__update_hunderlying_h5 = (_843_underlying).Replace(mapping); if ((_844_dt__update__tmp_h7).is_Borrowed) { return RAST.Type.create_Borrowed(_845_dt__update_hunderlying_h5); } else if ((_844_dt__update__tmp_h7).is_BorrowedMut) { @@ -2181,14 +2146,13 @@ public RAST._IType Replace(Dafny.IMap mapping) { } } } - if (unmatched28) { + { if (_source28.is_TupleType) { Dafny.ISequence _846_arguments = _source28.dtor_arguments; - unmatched28 = false; RAST._IType _847_dt__update__tmp_h8 = this; Dafny.ISequence _848_dt__update_harguments_h1 = Std.Collections.Seq.__default.Map(Dafny.Helpers.Id, Dafny.ISequence, Func>>((_849_mapping, _850_arguments) => ((System.Func)((_851_t) => { return (_851_t).Replace(_849_mapping); - })))(_pat_let_tv50, _846_arguments), _846_arguments); + })))(mapping, _846_arguments), _846_arguments); if ((_847_dt__update__tmp_h8).is_TypeApp) { return RAST.Type.create_TypeApp((_847_dt__update__tmp_h8).dtor_baseName, _848_dt__update_harguments_h1); } else if ((_847_dt__update__tmp_h8).is_TupleType) { @@ -2198,36 +2162,33 @@ public RAST._IType Replace(Dafny.IMap mapping) { } } } - if (unmatched28) { + { if (_source28.is_FnType) { Dafny.ISequence _852_arguments = _source28.dtor_arguments; RAST._IType _853_returnType = _source28.dtor_returnType; - unmatched28 = false; RAST._IType _854_dt__update__tmp_h9 = this; - RAST._IType _855_dt__update_hreturnType_h0 = (_853_returnType).Replace(_pat_let_tv51); + RAST._IType _855_dt__update_hreturnType_h0 = (_853_returnType).Replace(mapping); Dafny.ISequence _856_dt__update_harguments_h2 = Std.Collections.Seq.__default.Map(Dafny.Helpers.Id, Dafny.ISequence, Func>>((_857_mapping, _858_arguments) => ((System.Func)((_859_t) => { return (_859_t).Replace(_857_mapping); - })))(_pat_let_tv52, _852_arguments), _852_arguments); + })))(mapping, _852_arguments), _852_arguments); return RAST.Type.create_FnType(_856_dt__update_harguments_h2, _855_dt__update_hreturnType_h0); } } - if (unmatched28) { + { if (_source28.is_IntersectionType) { RAST._IType _860_left = _source28.dtor_left; RAST._IType _861_right = _source28.dtor_right; - unmatched28 = false; RAST._IType _862_dt__update__tmp_h10 = this; - RAST._IType _863_dt__update_hright_h0 = (_861_right).Replace(_pat_let_tv53); - RAST._IType _864_dt__update_hleft_h0 = (_860_left).Replace(_pat_let_tv54); + RAST._IType _863_dt__update_hright_h0 = (_861_right).Replace(mapping); + RAST._IType _864_dt__update_hleft_h0 = (_860_left).Replace(mapping); return RAST.Type.create_IntersectionType(_864_dt__update_hleft_h0, _863_dt__update_hright_h0); } } - if (unmatched28) { + { RAST._IType _865_underlying = _source28.dtor_underlying; Std.Wrappers._IOption> _866_size = _source28.dtor_size; - unmatched28 = false; RAST._IType _867_dt__update__tmp_h11 = this; - RAST._IType _868_dt__update_hunderlying_h6 = (_865_underlying).Replace(_pat_let_tv55); + RAST._IType _868_dt__update_hunderlying_h6 = (_865_underlying).Replace(mapping); if ((_867_dt__update__tmp_h11).is_Borrowed) { return RAST.Type.create_Borrowed(_868_dt__update_hunderlying_h6); } else if ((_867_dt__update__tmp_h11).is_BorrowedMut) { @@ -2244,7 +2205,6 @@ public RAST._IType Replace(Dafny.IMap mapping) { return RAST.Type.create_Array(_868_dt__update_hunderlying_h6, (_867_dt__update__tmp_h11).dtor_size); } } - throw new System.Exception("unexpected control point"); } } public bool CanReadWithoutClone() { @@ -2258,12 +2218,10 @@ public bool IsRcOrBorrowedRc() { } public Std.Wrappers._IOption ExtractMaybePlacebo() { RAST._IType _source29 = this; - bool unmatched29 = true; - if (unmatched29) { + { if (_source29.is_TypeApp) { RAST._IType _869_wrapper = _source29.dtor_baseName; Dafny.ISequence _870_arguments = _source29.dtor_arguments; - unmatched29 = false; if (((object.Equals(_869_wrapper, RAST.Type.create_TIdentifier(Dafny.Sequence.UnicodeFromString("MaybePlacebo")))) || (object.Equals(_869_wrapper, (RAST.__default.dafny__runtime__type).MSel(Dafny.Sequence.UnicodeFromString("MaybePlacebo"))))) && ((new BigInteger((_870_arguments).Count)) == (BigInteger.One))) { return Std.Wrappers.Option.create_Some((_870_arguments).Select(BigInteger.Zero)); } else { @@ -2271,11 +2229,9 @@ public bool IsRcOrBorrowedRc() { } } } - if (unmatched29) { - unmatched29 = false; + { return Std.Wrappers.Option.create_None(); } - throw new System.Exception("unexpected control point"); } public Std.Wrappers._IOption ExtractMaybeUninitArrayElement() { if ((this).IsObjectOrPointer()) { @@ -2292,200 +2248,158 @@ public bool IsRcOrBorrowedRc() { } } public Dafny.ISequence _ToString(Dafny.ISequence ind) { - var _pat_let_tv56 = ind; - var _pat_let_tv57 = ind; - var _pat_let_tv58 = ind; - var _pat_let_tv59 = ind; - var _pat_let_tv60 = ind; - var _pat_let_tv61 = ind; - var _pat_let_tv62 = ind; - var _pat_let_tv63 = ind; - var _pat_let_tv64 = ind; - var _pat_let_tv65 = ind; - var _pat_let_tv66 = ind; - var _pat_let_tv67 = ind; - var _pat_let_tv68 = ind; - var _pat_let_tv69 = ind; - var _pat_let_tv70 = ind; RAST._IType _source30 = this; - bool unmatched30 = true; - if (unmatched30) { + { if (_source30.is_Bool) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("bool"); } } - if (unmatched30) { + { if (_source30.is_TIdentifier) { Dafny.ISequence _872_underlying = _source30.dtor_name; - unmatched30 = false; return _872_underlying; } } - if (unmatched30) { + { if (_source30.is_TMemberSelect) { RAST._IType _873_underlying = _source30.dtor_base; Dafny.ISequence _874_name = _source30.dtor_name; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_873_underlying)._ToString(_pat_let_tv56), Dafny.Sequence.UnicodeFromString("::")), _874_name); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_873_underlying)._ToString(ind), Dafny.Sequence.UnicodeFromString("::")), _874_name); } } - if (unmatched30) { + { if (_source30.is_Borrowed) { RAST._IType _875_underlying = _source30.dtor_underlying; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&"), (_875_underlying)._ToString(_pat_let_tv57)); + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&"), (_875_underlying)._ToString(ind)); } } - if (unmatched30) { + { if (_source30.is_BorrowedMut) { RAST._IType _876_underlying = _source30.dtor_underlying; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&mut "), (_876_underlying)._ToString(_pat_let_tv58)); + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("&mut "), (_876_underlying)._ToString(ind)); } } - if (unmatched30) { + { if (_source30.is_Pointer) { RAST._IType _877_underlying = _source30.dtor_underlying; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*const "), (_877_underlying)._ToString(_pat_let_tv59)); + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*const "), (_877_underlying)._ToString(ind)); } } - if (unmatched30) { + { if (_source30.is_PointerMut) { RAST._IType _878_underlying = _source30.dtor_underlying; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*mut "), (_878_underlying)._ToString(_pat_let_tv60)); + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("*mut "), (_878_underlying)._ToString(ind)); } } - if (unmatched30) { + { if (_source30.is_ImplType) { RAST._IType _879_underlying = _source30.dtor_underlying; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("impl "), (_879_underlying)._ToString(_pat_let_tv61)); + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("impl "), (_879_underlying)._ToString(ind)); } } - if (unmatched30) { + { if (_source30.is_DynType) { RAST._IType _880_underlying = _source30.dtor_underlying; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("dyn "), (_880_underlying)._ToString(_pat_let_tv62)); + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("dyn "), (_880_underlying)._ToString(ind)); } } - if (unmatched30) { + { if (_source30.is_FnType) { Dafny.ISequence _881_arguments = _source30.dtor_arguments; RAST._IType _882_returnType = _source30.dtor_returnType; - unmatched30 = false; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("::std::ops::Fn("), RAST.__default.SeqToString(_881_arguments, Dafny.Helpers.Id, Func>>>((_883_ind) => ((System.Func>)((_884_arg) => { return (_884_arg)._ToString(Dafny.Sequence.Concat(_883_ind, RAST.__default.IND)); - })))(_pat_let_tv63), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(") -> ")), (_882_returnType)._ToString(Dafny.Sequence.Concat(_pat_let_tv64, RAST.__default.IND))); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(") -> ")), (_882_returnType)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))); } } - if (unmatched30) { + { if (_source30.is_IntersectionType) { RAST._IType _885_left = _source30.dtor_left; RAST._IType _886_right = _source30.dtor_right; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_885_left)._ToString(_pat_let_tv65), Dafny.Sequence.UnicodeFromString(" + ")), (_886_right)._ToString(_pat_let_tv66)); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat((_885_left)._ToString(ind), Dafny.Sequence.UnicodeFromString(" + ")), (_886_right)._ToString(ind)); } } - if (unmatched30) { + { if (_source30.is_TupleType) { Dafny.ISequence _887_args = _source30.dtor_arguments; - unmatched30 = false; if ((_887_args).Equals(Dafny.Sequence.FromElements())) { return Dafny.Sequence.UnicodeFromString("()"); } else { return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_887_args, Dafny.Helpers.Id, Func>>>((_888_ind) => ((System.Func>)((_889_arg) => { return (_889_arg)._ToString(Dafny.Sequence.Concat(_888_ind, RAST.__default.IND)); - })))(_pat_let_tv67), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")); } } } - if (unmatched30) { + { if (_source30.is_TypeApp) { RAST._IType _890_base = _source30.dtor_baseName; Dafny.ISequence _891_args = _source30.dtor_arguments; - unmatched30 = false; - return Dafny.Sequence.Concat((_890_base)._ToString(_pat_let_tv68), (((_891_args).Equals(Dafny.Sequence.FromElements())) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), RAST.__default.SeqToString(_891_args, Dafny.Helpers.Id, Func>>>((_892_ind) => ((System.Func>)((_893_arg) => { + return Dafny.Sequence.Concat((_890_base)._ToString(ind), (((_891_args).Equals(Dafny.Sequence.FromElements())) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("<"), RAST.__default.SeqToString(_891_args, Dafny.Helpers.Id, Func>>>((_892_ind) => ((System.Func>)((_893_arg) => { return (_893_arg)._ToString(Dafny.Sequence.Concat(_892_ind, RAST.__default.IND)); - })))(_pat_let_tv69), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">"))))); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">"))))); } } - if (unmatched30) { + { if (_source30.is_SelfOwned) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("Self"); } } - if (unmatched30) { + { if (_source30.is_U8) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("u8"); } } - if (unmatched30) { + { if (_source30.is_U16) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("u16"); } } - if (unmatched30) { + { if (_source30.is_U32) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("u32"); } } - if (unmatched30) { + { if (_source30.is_U64) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("u64"); } } - if (unmatched30) { + { if (_source30.is_U128) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("u128"); } } - if (unmatched30) { + { if (_source30.is_I8) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("i8"); } } - if (unmatched30) { + { if (_source30.is_I16) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("i16"); } } - if (unmatched30) { + { if (_source30.is_I32) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("i32"); } } - if (unmatched30) { + { if (_source30.is_I64) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("i64"); } } - if (unmatched30) { + { if (_source30.is_I128) { - unmatched30 = false; return Dafny.Sequence.UnicodeFromString("i128"); } } - if (unmatched30) { + { RAST._IType _894_underlying = _source30.dtor_underlying; Std.Wrappers._IOption> _895_size = _source30.dtor_size; - unmatched30 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("["), (_894_underlying)._ToString(_pat_let_tv70)), (((_895_size).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("; "), (_895_size).dtor_value)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("]")); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("["), (_894_underlying)._ToString(ind)), (((_895_size).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("; "), (_895_size).dtor_value)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("]")); } - throw new System.Exception("unexpected control point"); } public RAST._IType MSel(Dafny.ISequence name) { return RAST.Type.create_TMemberSelect(this, name); @@ -2498,27 +2412,22 @@ public RAST._IType Apply(Dafny.ISequence args) { } public RAST._IType ToOwned() { RAST._IType _source31 = this; - bool unmatched31 = true; - if (unmatched31) { + { if (_source31.is_Borrowed) { RAST._IType _896_x = _source31.dtor_underlying; - unmatched31 = false; return _896_x; } } - if (unmatched31) { + { if (_source31.is_BorrowedMut) { RAST._IType _897_x = _source31.dtor_underlying; - unmatched31 = false; return _897_x; } } - if (unmatched31) { + { RAST._IType _898_x = _source31; - unmatched31 = false; return _898_x; } - throw new System.Exception("unexpected control point"); } public RAST._IExpr ToNullExpr() { if ((this).IsObject()) { @@ -2585,8 +2494,7 @@ public bool IsUninitArray() { } public bool IsObject() { RAST._IType _source32 = this; - bool unmatched32 = true; - if (unmatched32) { + { if (_source32.is_TypeApp) { RAST._IType baseName0 = _source32.dtor_baseName; if (baseName0.is_TMemberSelect) { @@ -2601,7 +2509,6 @@ public bool IsObject() { Dafny.ISequence name2 = baseName0.dtor_name; if (object.Equals(name2, Dafny.Sequence.UnicodeFromString("Object"))) { Dafny.ISequence _907_elems1 = _source32.dtor_arguments; - unmatched32 = false; return (new BigInteger((_907_elems1).Count)) == (BigInteger.One); } } @@ -2611,11 +2518,9 @@ public bool IsObject() { } } } - if (unmatched32) { - unmatched32 = false; + { return false; } - throw new System.Exception("unexpected control point"); } public bool IsPointer() { return ((this).is_Pointer) || ((this).is_PointerMut); @@ -2628,28 +2533,20 @@ public RAST._IType ObjectOrPointerUnderlying() { return (this).dtor_underlying; } else { RAST._IType _source33 = this; - bool unmatched33 = true; - if (unmatched33) { + { RAST._IType baseName1 = _source33.dtor_baseName; RAST._IType base2 = baseName1.dtor_base; RAST._IType base3 = base2.dtor_base; Dafny.ISequence name3 = base3.dtor_name; - if (object.Equals(name3, Dafny.Sequence.UnicodeFromString(""))) { - Dafny.ISequence name4 = base2.dtor_name; - if (object.Equals(name4, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { - Dafny.ISequence _908_elems1 = _source33.dtor_arguments; - unmatched33 = false; - return (_908_elems1).Select(BigInteger.Zero); - } - } + Dafny.ISequence name4 = base2.dtor_name; + Dafny.ISequence _908_elems1 = _source33.dtor_arguments; + return (_908_elems1).Select(BigInteger.Zero); } - throw new System.Exception("unexpected control point"); } } public bool IsBuiltinCollection() { RAST._IType _source34 = this; - bool unmatched34 = true; - if (unmatched34) { + { if (_source34.is_TypeApp) { RAST._IType baseName2 = _source34.dtor_baseName; if (baseName2.is_TMemberSelect) { @@ -2663,7 +2560,6 @@ public bool IsBuiltinCollection() { if (object.Equals(name6, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { Dafny.ISequence _909_tpe = baseName2.dtor_name; Dafny.ISequence _910_elems1 = _source34.dtor_arguments; - unmatched34 = false; return (((((_909_tpe).Equals(Dafny.Sequence.UnicodeFromString("Set"))) || ((_909_tpe).Equals(Dafny.Sequence.UnicodeFromString("Sequence")))) || ((_909_tpe).Equals(Dafny.Sequence.UnicodeFromString("Multiset")))) && ((new BigInteger((_910_elems1).Count)) == (BigInteger.One))) || (((_909_tpe).Equals(Dafny.Sequence.UnicodeFromString("Map"))) && ((new BigInteger((_910_elems1).Count)) == (new BigInteger(2)))); } } @@ -2672,35 +2568,26 @@ public bool IsBuiltinCollection() { } } } - if (unmatched34) { - unmatched34 = false; + { return false; } - throw new System.Exception("unexpected control point"); } public RAST._IType GetBuiltinCollectionElement() { RAST._IType _source35 = this; - bool unmatched35 = true; - if (unmatched35) { + { RAST._IType baseName3 = _source35.dtor_baseName; RAST._IType base6 = baseName3.dtor_base; RAST._IType base7 = base6.dtor_base; Dafny.ISequence name7 = base7.dtor_name; - if (object.Equals(name7, Dafny.Sequence.UnicodeFromString(""))) { - Dafny.ISequence name8 = base6.dtor_name; - if (object.Equals(name8, Dafny.Sequence.UnicodeFromString("dafny_runtime"))) { - Dafny.ISequence _911_tpe = baseName3.dtor_name; - Dafny.ISequence _912_elems = _source35.dtor_arguments; - unmatched35 = false; - if ((_911_tpe).Equals(Dafny.Sequence.UnicodeFromString("Map"))) { - return (_912_elems).Select(BigInteger.One); - } else { - return (_912_elems).Select(BigInteger.Zero); - } - } + Dafny.ISequence name8 = base6.dtor_name; + Dafny.ISequence _911_tpe = baseName3.dtor_name; + Dafny.ISequence _912_elems = _source35.dtor_arguments; + if ((_911_tpe).Equals(Dafny.Sequence.UnicodeFromString("Map"))) { + return (_912_elems).Select(BigInteger.One); + } else { + return (_912_elems).Select(BigInteger.Zero); } } - throw new System.Exception("unexpected control point"); } public bool IsRc() { return (((this).is_TypeApp) && (object.Equals((this).dtor_baseName, RAST.__default.RcType))) && ((new BigInteger(((this).dtor_arguments).Count)) == (BigInteger.One)); @@ -5150,8 +5037,7 @@ public bool NoExtraSemicolonAfter() { } public RAST._IExpr Optimize() { RAST._IExpr _source36 = this; - bool unmatched36 = true; - if (unmatched36) { + { if (_source36.is_UnaryOp) { Dafny.ISequence op10 = _source36.dtor_op1; if (object.Equals(op10, Dafny.Sequence.UnicodeFromString("!"))) { @@ -5164,7 +5050,6 @@ public RAST._IExpr Optimize() { DAST.Format._IBinaryOpFormat _930_format = underlying0.dtor_format2; DAST.Format._IUnaryOpFormat format0 = _source36.dtor_format; if (format0.is_CombineFormat) { - unmatched36 = false; return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("!="), _928_left, _929_right, DAST.Format.BinaryOpFormat.create_NoFormat()); } } @@ -5172,7 +5057,7 @@ public RAST._IExpr Optimize() { } } } - if (unmatched36) { + { if (_source36.is_UnaryOp) { Dafny.ISequence op11 = _source36.dtor_op1; if (object.Equals(op11, Dafny.Sequence.UnicodeFromString("!"))) { @@ -5186,7 +5071,6 @@ public RAST._IExpr Optimize() { if (format20.is_NoFormat) { DAST.Format._IUnaryOpFormat format1 = _source36.dtor_format; if (format1.is_CombineFormat) { - unmatched36 = false; return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString(">="), _931_left, _932_right, DAST.Format.BinaryOpFormat.create_NoFormat()); } } @@ -5195,7 +5079,7 @@ public RAST._IExpr Optimize() { } } } - if (unmatched36) { + { if (_source36.is_UnaryOp) { Dafny.ISequence op12 = _source36.dtor_op1; if (object.Equals(op12, Dafny.Sequence.UnicodeFromString("!"))) { @@ -5209,7 +5093,6 @@ public RAST._IExpr Optimize() { if (format21.is_ReverseFormat) { DAST.Format._IUnaryOpFormat format2 = _source36.dtor_format; if (format2.is_CombineFormat) { - unmatched36 = false; return RAST.Expr.create_BinaryOp(Dafny.Sequence.UnicodeFromString("<="), _934_right, _933_left, DAST.Format.BinaryOpFormat.create_NoFormat()); } } @@ -5218,7 +5101,7 @@ public RAST._IExpr Optimize() { } } } - if (unmatched36) { + { if (_source36.is_Call) { RAST._IExpr obj0 = _source36.dtor_obj; if (obj0.is_MemberSelect) { @@ -5226,7 +5109,6 @@ public RAST._IExpr Optimize() { Dafny.ISequence name9 = obj0.dtor_name; if (object.Equals(name9, Dafny.Sequence.UnicodeFromString("truncate!"))) { Dafny.ISequence _936_args = _source36.dtor_arguments; - unmatched36 = false; if (((!object.Equals(_935_r, RAST.__default.dafny__runtime)) && (!object.Equals(_935_r, RAST.__default.@global))) || ((new BigInteger((_936_args).Count)) != (new BigInteger(2)))) { return this; } else { @@ -5238,8 +5120,7 @@ public RAST._IExpr Optimize() { RAST._IType _939_tpe = (_938_tpeExpr).dtor_tpe; if (((((((((((_939_tpe).is_U8) || ((_939_tpe).is_U16)) || ((_939_tpe).is_U32)) || ((_939_tpe).is_U64)) || ((_939_tpe).is_U128)) || ((_939_tpe).is_I8)) || ((_939_tpe).is_I16)) || ((_939_tpe).is_I32)) || ((_939_tpe).is_I64)) || ((_939_tpe).is_I128)) { RAST._IExpr _source37 = _937_expr; - bool unmatched37 = true; - if (unmatched37) { + { if (_source37.is_Call) { RAST._IExpr obj1 = _source37.dtor_obj; if (obj1.is_MemberSelect) { @@ -5247,29 +5128,23 @@ public RAST._IExpr Optimize() { Dafny.ISequence name10 = obj1.dtor_name; if (object.Equals(name10, Dafny.Sequence.UnicodeFromString("int!"))) { Dafny.ISequence _941_args = _source37.dtor_arguments; - unmatched37 = false; if (((new BigInteger((_941_args).Count)) == (BigInteger.One)) && ((object.Equals(_940_base, RAST.__default.dafny__runtime)) || (object.Equals(_940_base, RAST.__default.@global)))) { RAST._IExpr _source38 = (_941_args).Select(BigInteger.Zero); - bool unmatched38 = true; - if (unmatched38) { + { if (_source38.is_LiteralInt) { Dafny.ISequence _942_number = _source38.dtor_value; - unmatched38 = false; return RAST.Expr.create_LiteralInt(_942_number); } } - if (unmatched38) { + { if (_source38.is_LiteralString) { Dafny.ISequence _943_number = _source38.dtor_value; - unmatched38 = false; return RAST.Expr.create_LiteralInt(_943_number); } } - if (unmatched38) { - unmatched38 = false; + { return this; } - throw new System.Exception("unexpected control point"); } else { return this; } @@ -5277,11 +5152,9 @@ public RAST._IExpr Optimize() { } } } - if (unmatched37) { - unmatched37 = false; + { return this; } - throw new System.Exception("unexpected control point"); } else { return this; } @@ -5291,7 +5164,7 @@ public RAST._IExpr Optimize() { } } } - if (unmatched36) { + { if (_source36.is_StmtExpr) { RAST._IExpr stmt0 = _source36.dtor_stmt; if (stmt0.is_DeclareVar) { @@ -5309,7 +5182,6 @@ public RAST._IExpr Optimize() { Std.Wrappers._IOption _947_name2 = stmt1.dtor_names; RAST._IExpr _948_rhs = stmt1.dtor_rhs; RAST._IExpr _949_last = rhs0.dtor_rhs; - unmatched36 = false; if (object.Equals(_947_name2, Std.Wrappers.Option.create_Some(RAST.AssignLhs.create_LocalVar(_945_name)))) { RAST._IExpr _950_rewriting = RAST.Expr.create_StmtExpr(RAST.Expr.create_DeclareVar(_944_mod, _945_name, Std.Wrappers.Option.create_Some(_946_tpe), Std.Wrappers.Option.create_Some(_948_rhs)), _949_last); return _950_rewriting; @@ -5323,7 +5195,7 @@ public RAST._IExpr Optimize() { } } } - if (unmatched36) { + { if (_source36.is_StmtExpr) { RAST._IExpr stmt2 = _source36.dtor_stmt; if (stmt2.is_IfExpr) { @@ -5348,7 +5220,6 @@ public RAST._IExpr Optimize() { Dafny.ISequence content1 = els0.dtor_content; if (object.Equals(content1, Dafny.Sequence.UnicodeFromString(""))) { RAST._IExpr _955_last = _source36.dtor_rhs; - unmatched36 = false; RAST._IExpr _956_rewriting = RAST.Expr.create_StmtExpr((RAST.Expr.create_Identifier(Dafny.Sequence.UnicodeFromString("assert_eq!"))).Apply(Dafny.Sequence.FromElements(_951_a, _952_b)), _955_last); return _956_rewriting; } @@ -5362,11 +5233,9 @@ public RAST._IExpr Optimize() { } } } - if (unmatched36) { - unmatched36 = false; + { return this; } - throw new System.Exception("unexpected control point"); } public bool LeftRequiresParentheses(RAST._IExpr left) { return ((this).printingInfo).NeedParenthesesForLeft((left).printingInfo); @@ -5390,19 +5259,15 @@ public bool RightRequiresParentheses(RAST._IExpr right) { } public Std.Wrappers._IOption> RightMostIdentifier() { RAST._IExpr _source39 = this; - bool unmatched39 = true; - if (unmatched39) { + { if (_source39.is_MemberSelect) { Dafny.ISequence _957_id = _source39.dtor_name; - unmatched39 = false; return Std.Wrappers.Option>.create_Some(_957_id); } } - if (unmatched39) { - unmatched39 = false; + { return Std.Wrappers.Option>.create_None(); } - throw new System.Exception("unexpected control point"); } public static Dafny.ISequence MaxHashes(Dafny.ISequence s, Dafny.ISequence currentHashes, Dafny.ISequence mostHashes) { @@ -5449,94 +5314,28 @@ public bool RightRequiresParentheses(RAST._IExpr right) { } } public Dafny.ISequence _ToString(Dafny.ISequence ind) { - var _pat_let_tv71 = ind; - var _pat_let_tv72 = ind; - var _pat_let_tv73 = ind; - var _pat_let_tv74 = ind; - var _pat_let_tv75 = ind; - var _pat_let_tv76 = ind; - var _pat_let_tv77 = ind; - var _pat_let_tv78 = ind; - var _pat_let_tv79 = ind; - var _pat_let_tv80 = ind; - var _pat_let_tv81 = ind; - var _pat_let_tv82 = ind; - var _pat_let_tv83 = ind; - var _pat_let_tv84 = ind; - var _pat_let_tv85 = ind; - var _pat_let_tv86 = ind; - var _pat_let_tv87 = ind; - var _pat_let_tv88 = ind; - var _pat_let_tv89 = ind; - var _pat_let_tv90 = ind; - var _pat_let_tv91 = ind; - var _pat_let_tv92 = ind; - var _pat_let_tv93 = ind; - var _pat_let_tv94 = ind; - var _pat_let_tv95 = ind; - var _pat_let_tv96 = ind; - var _pat_let_tv97 = ind; - var _pat_let_tv98 = ind; - var _pat_let_tv99 = ind; - var _pat_let_tv100 = ind; - var _pat_let_tv101 = ind; - var _pat_let_tv102 = ind; - var _pat_let_tv103 = ind; - var _pat_let_tv104 = ind; - var _pat_let_tv105 = ind; - var _pat_let_tv106 = ind; - var _pat_let_tv107 = ind; - var _pat_let_tv108 = ind; - var _pat_let_tv109 = ind; - var _pat_let_tv110 = ind; - var _pat_let_tv111 = ind; - var _pat_let_tv112 = ind; - var _pat_let_tv113 = ind; - var _pat_let_tv114 = ind; - var _pat_let_tv115 = ind; - var _pat_let_tv116 = ind; - var _pat_let_tv117 = ind; - var _pat_let_tv118 = ind; - var _pat_let_tv119 = ind; - var _pat_let_tv120 = ind; - var _pat_let_tv121 = ind; - var _pat_let_tv122 = ind; - var _pat_let_tv123 = ind; - var _pat_let_tv124 = ind; - var _pat_let_tv125 = ind; - var _pat_let_tv126 = ind; - var _pat_let_tv127 = ind; - var _pat_let_tv128 = ind; - var _pat_let_tv129 = ind; - var _pat_let_tv130 = ind; - var _pat_let_tv131 = ind; RAST._IExpr _source40 = (this).Optimize(); - bool unmatched40 = true; - if (unmatched40) { + { if (_source40.is_Identifier) { Dafny.ISequence _959_name = _source40.dtor_name; - unmatched40 = false; return _959_name; } } - if (unmatched40) { + { if (_source40.is_ExprFromType) { RAST._IType _960_t = _source40.dtor_tpe; - unmatched40 = false; - return (_960_t)._ToString(_pat_let_tv71); + return (_960_t)._ToString(ind); } } - if (unmatched40) { + { if (_source40.is_LiteralInt) { Dafny.ISequence _961_number = _source40.dtor_value; - unmatched40 = false; return _961_number; } } - if (unmatched40) { + { if (_source40.is_LiteralBool) { bool _962_b = _source40.dtor_bvalue; - unmatched40 = false; if (_962_b) { return Dafny.Sequence.UnicodeFromString("true"); } else { @@ -5544,111 +5343,101 @@ public bool RightRequiresParentheses(RAST._IExpr right) { } } } - if (unmatched40) { + { if (_source40.is_LiteralString) { Dafny.ISequence _963_characters = _source40.dtor_value; bool _964_binary = _source40.dtor_binary; bool _965_verbatim = _source40.dtor_verbatim; - unmatched40 = false; Dafny.ISequence _966_hashes = ((_965_verbatim) ? (Dafny.Sequence.Concat(RAST.Expr.MaxHashes(_963_characters, Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")), Dafny.Sequence.UnicodeFromString("#"))) : (Dafny.Sequence.UnicodeFromString(""))); return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((_964_binary) ? (Dafny.Sequence.UnicodeFromString("b")) : (Dafny.Sequence.UnicodeFromString(""))), ((_965_verbatim) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("r"), _966_hashes)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("\"")), ((_965_verbatim) ? (RAST.Expr.RemoveDoubleQuotes(_963_characters)) : (_963_characters))), Dafny.Sequence.UnicodeFromString("\"")), _966_hashes); } } - if (unmatched40) { + { if (_source40.is_Match) { RAST._IExpr _967_matchee = _source40.dtor_matchee; Dafny.ISequence _968_cases = _source40.dtor_cases; - unmatched40 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("match "), (_967_matchee)._ToString(Dafny.Sequence.Concat(_pat_let_tv72, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_968_cases, Dafny.Helpers.Id, Func>>>((_969_ind) => ((System.Func>)((_970_c) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("match "), (_967_matchee)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_968_cases, Dafny.Helpers.Id, Func>>>((_969_ind) => ((System.Func>)((_970_c) => { return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _969_ind), RAST.__default.IND), (_970_c)._ToString(Dafny.Sequence.Concat(_969_ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(",")); - })))(_pat_let_tv73), Dafny.Sequence.UnicodeFromString(""))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv74), Dafny.Sequence.UnicodeFromString("}")); + })))(ind), Dafny.Sequence.UnicodeFromString(""))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); } } - if (unmatched40) { + { if (_source40.is_StmtExpr) { RAST._IExpr _971_stmt = _source40.dtor_stmt; RAST._IExpr _972_rhs = _source40.dtor_rhs; - unmatched40 = false; if (((_971_stmt).is_RawExpr) && (((_971_stmt).dtor_content).Equals(Dafny.Sequence.UnicodeFromString("")))) { - return (_972_rhs)._ToString(_pat_let_tv75); + return (_972_rhs)._ToString(ind); } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_971_stmt)._ToString(_pat_let_tv76), (((_971_stmt).NoExtraSemicolonAfter()) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.UnicodeFromString(";")))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv77), (_972_rhs)._ToString(_pat_let_tv78)); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_971_stmt)._ToString(ind), (((_971_stmt).NoExtraSemicolonAfter()) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.UnicodeFromString(";")))), Dafny.Sequence.UnicodeFromString("\n")), ind), (_972_rhs)._ToString(ind)); } } } - if (unmatched40) { + { if (_source40.is_Block) { RAST._IExpr _973_underlying = _source40.dtor_underlying; - unmatched40 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\n"), _pat_let_tv79), RAST.__default.IND), (_973_underlying)._ToString(Dafny.Sequence.Concat(_pat_let_tv80, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv81), Dafny.Sequence.UnicodeFromString("}")); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("{\n"), ind), RAST.__default.IND), (_973_underlying)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); } } - if (unmatched40) { + { if (_source40.is_IfExpr) { RAST._IExpr _974_cond = _source40.dtor_cond; RAST._IExpr _975_thn = _source40.dtor_thn; RAST._IExpr _976_els = _source40.dtor_els; - unmatched40 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("if "), (_974_cond)._ToString(Dafny.Sequence.Concat(_pat_let_tv82, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv83), RAST.__default.IND), (_975_thn)._ToString(Dafny.Sequence.Concat(_pat_let_tv84, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv85), Dafny.Sequence.UnicodeFromString("}")), ((object.Equals(_976_els, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" else {\n"), _pat_let_tv86), RAST.__default.IND), (_976_els)._ToString(Dafny.Sequence.Concat(_pat_let_tv87, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv88), Dafny.Sequence.UnicodeFromString("}"))))); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("if "), (_974_cond)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), ind), RAST.__default.IND), (_975_thn)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")), ((object.Equals(_976_els, RAST.Expr.create_RawExpr(Dafny.Sequence.UnicodeFromString("")))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" else {\n"), ind), RAST.__default.IND), (_976_els)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}"))))); } } - if (unmatched40) { + { if (_source40.is_StructBuild) { RAST._IExpr _977_name = _source40.dtor_underlying; Dafny.ISequence _978_assignments = _source40.dtor_assignments; - unmatched40 = false; if (((new BigInteger((_978_assignments).Count)).Sign == 1) && ((((_978_assignments).Select(BigInteger.Zero)).dtor_identifier).Equals(Dafny.Sequence.UnicodeFromString("0")))) { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_977_name)._ToString(_pat_let_tv89), Dafny.Sequence.UnicodeFromString(" (")), RAST.__default.SeqToString(_978_assignments, Dafny.Helpers.Id, Func>>>((_979_ind) => ((System.Func>)((_980_assignment) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_977_name)._ToString(ind), Dafny.Sequence.UnicodeFromString(" (")), RAST.__default.SeqToString(_978_assignments, Dafny.Helpers.Id, Func>>>((_979_ind) => ((System.Func>)((_980_assignment) => { return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _979_ind), RAST.__default.IND), ((_980_assignment).dtor_rhs)._ToString(Dafny.Sequence.Concat(_979_ind, RAST.__default.IND))); - })))(_pat_let_tv90), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_978_assignments).Count)) > (BigInteger.One)) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv91)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); + })))(ind), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_978_assignments).Count)) > (BigInteger.One)) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_977_name)._ToString(_pat_let_tv92), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_978_assignments, Dafny.Helpers.Id, Func>>>((_981_ind) => ((System.Func>)((_982_assignment) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat((_977_name)._ToString(ind), Dafny.Sequence.UnicodeFromString(" {")), RAST.__default.SeqToString(_978_assignments, Dafny.Helpers.Id, Func>>>((_981_ind) => ((System.Func>)((_982_assignment) => { return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _981_ind), RAST.__default.IND), (_982_assignment)._ToString(Dafny.Sequence.Concat(_981_ind, RAST.__default.IND))); - })))(_pat_let_tv93), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_978_assignments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv94)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("}")); + })))(ind), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_978_assignments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString("}")); } } } - if (unmatched40) { + { if (_source40.is_Tuple) { Dafny.ISequence _983_arguments = _source40.dtor_arguments; - unmatched40 = false; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString(_983_arguments, Dafny.Helpers.Id, Func>>>((_984_ind) => ((System.Func>)((_985_arg) => { return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _984_ind), RAST.__default.IND), (_985_arg)._ToString(Dafny.Sequence.Concat(_984_ind, RAST.__default.IND))); - })))(_pat_let_tv95), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_983_arguments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), _pat_let_tv96)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); + })))(ind), Dafny.Sequence.UnicodeFromString(","))), (((new BigInteger((_983_arguments).Count)).Sign == 1) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind)) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(")")); } } - if (unmatched40) { + { if (_source40.is_UnaryOp) { Dafny.ISequence _986_op = _source40.dtor_op1; RAST._IExpr _987_underlying = _source40.dtor_underlying; DAST.Format._IUnaryOpFormat _988_format = _source40.dtor_format; - unmatched40 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs41 = ((((this).printingInfo).NeedParenthesesFor((_987_underlying).printingInfo)) ? (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")"))) : (_System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString(""), Dafny.Sequence.UnicodeFromString("")))); Dafny.ISequence _989_leftP = _let_tmp_rhs41.dtor__0; Dafny.ISequence _990_rightP = _let_tmp_rhs41.dtor__1; Dafny.ISequence _991_leftOp = ((((_986_op).Equals(Dafny.Sequence.UnicodeFromString("&mut"))) && (!(_989_leftP).Equals(Dafny.Sequence.UnicodeFromString("(")))) ? (Dafny.Sequence.Concat(_986_op, Dafny.Sequence.UnicodeFromString(" "))) : ((((_986_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (Dafny.Sequence.UnicodeFromString("")) : (_986_op)))); Dafny.ISequence _992_rightOp = (((_986_op).Equals(Dafny.Sequence.UnicodeFromString("?"))) ? (_986_op) : (Dafny.Sequence.UnicodeFromString(""))); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_991_leftOp, _989_leftP), (_987_underlying)._ToString(_pat_let_tv97)), _990_rightP), _992_rightOp); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_991_leftOp, _989_leftP), (_987_underlying)._ToString(ind)), _990_rightP), _992_rightOp); } } - if (unmatched40) { + { if (_source40.is_TypeAscription) { RAST._IExpr _993_left = _source40.dtor_left; RAST._IType _994_tpe = _source40.dtor_tpe; - unmatched40 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs42 = (this).LeftParentheses(_993_left); Dafny.ISequence _995_leftLeftP = _let_tmp_rhs42.dtor__0; Dafny.ISequence _996_leftRightP = _let_tmp_rhs42.dtor__1; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_995_leftLeftP, (_993_left)._ToString(RAST.__default.IND)), _996_leftRightP), Dafny.Sequence.UnicodeFromString(" as ")), (_994_tpe)._ToString(RAST.__default.IND)); } } - if (unmatched40) { + { if (_source40.is_BinaryOp) { Dafny.ISequence _997_op2 = _source40.dtor_op2; RAST._IExpr _998_left = _source40.dtor_left; RAST._IExpr _999_right = _source40.dtor_right; DAST.Format._IBinaryOpFormat _1000_format = _source40.dtor_format2; - unmatched40 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs43 = (this).LeftParentheses(_998_left); Dafny.ISequence _1001_leftLeftP = _let_tmp_rhs43.dtor__0; Dafny.ISequence _1002_leftRighP = _let_tmp_rhs43.dtor__1; @@ -5656,307 +5445,267 @@ public bool RightRequiresParentheses(RAST._IExpr right) { Dafny.ISequence _1003_rightLeftP = _let_tmp_rhs44.dtor__0; Dafny.ISequence _1004_rightRightP = _let_tmp_rhs44.dtor__1; Dafny.ISequence _1005_opRendered = Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), _997_op2), Dafny.Sequence.UnicodeFromString(" ")); - Dafny.ISequence _1006_indLeft = (((_1001_leftLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(_pat_let_tv98, RAST.__default.IND)) : (_pat_let_tv99)); - Dafny.ISequence _1007_indRight = (((_1003_rightLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(_pat_let_tv100, RAST.__default.IND)) : (_pat_let_tv101)); + Dafny.ISequence _1006_indLeft = (((_1001_leftLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(ind, RAST.__default.IND)) : (ind)); + Dafny.ISequence _1007_indRight = (((_1003_rightLeftP).Equals(Dafny.Sequence.UnicodeFromString("("))) ? (Dafny.Sequence.Concat(ind, RAST.__default.IND)) : (ind)); return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1001_leftLeftP, (_998_left)._ToString(_1006_indLeft)), _1002_leftRighP), _1005_opRendered), _1003_rightLeftP), (_999_right)._ToString(_1007_indRight)), _1004_rightRightP); } } - if (unmatched40) { + { if (_source40.is_DeclareVar) { RAST._IDeclareType _1008_declareType = _source40.dtor_declareType; Dafny.ISequence _1009_name = _source40.dtor_name; Std.Wrappers._IOption _1010_optType = _source40.dtor_optType; Std.Wrappers._IOption _1011_optExpr = _source40.dtor_optRhs; - unmatched40 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("let "), ((object.Equals(_1008_declareType, RAST.DeclareType.create_MUT())) ? (Dafny.Sequence.UnicodeFromString("mut ")) : (Dafny.Sequence.UnicodeFromString("")))), _1009_name), (((_1010_optType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(": "), ((_1010_optType).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv102, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), (((_1011_optExpr).is_Some) ? (Dafny.Helpers.Let, Dafny.ISequence>(((_1011_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv103, RAST.__default.IND)), _pat_let7_0 => Dafny.Helpers.Let, Dafny.ISequence>(_pat_let7_0, _1012_optExprString => (((_1012_optExprString).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("= /*issue with empty RHS*/"), ((((_1011_optExpr).dtor_value).is_RawExpr) ? (Dafny.Sequence.UnicodeFromString("Empty Raw expr")) : (((((_1011_optExpr).dtor_value).is_LiteralString) ? (Dafny.Sequence.UnicodeFromString("Empty string literal")) : (((((_1011_optExpr).dtor_value).is_LiteralInt) ? (Dafny.Sequence.UnicodeFromString("Empty int literal")) : (Dafny.Sequence.UnicodeFromString("Another case"))))))))) : (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" = "), _1012_optExprString)))))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("let "), ((object.Equals(_1008_declareType, RAST.DeclareType.create_MUT())) ? (Dafny.Sequence.UnicodeFromString("mut ")) : (Dafny.Sequence.UnicodeFromString("")))), _1009_name), (((_1010_optType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(": "), ((_1010_optType).dtor_value)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), (((_1011_optExpr).is_Some) ? (Dafny.Helpers.Let, Dafny.ISequence>(((_1011_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND)), _pat_let7_0 => Dafny.Helpers.Let, Dafny.ISequence>(_pat_let7_0, _1012_optExprString => (((_1012_optExprString).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("= /*issue with empty RHS*/"), ((((_1011_optExpr).dtor_value).is_RawExpr) ? (Dafny.Sequence.UnicodeFromString("Empty Raw expr")) : (((((_1011_optExpr).dtor_value).is_LiteralString) ? (Dafny.Sequence.UnicodeFromString("Empty string literal")) : (((((_1011_optExpr).dtor_value).is_LiteralInt) ? (Dafny.Sequence.UnicodeFromString("Empty int literal")) : (Dafny.Sequence.UnicodeFromString("Another case"))))))))) : (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" = "), _1012_optExprString)))))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); } } - if (unmatched40) { + { if (_source40.is_Assign) { Std.Wrappers._IOption _1013_names = _source40.dtor_names; RAST._IExpr _1014_expr = _source40.dtor_rhs; - unmatched40 = false; Dafny.ISequence _1015_lhs = ((System.Func>)(() => { Std.Wrappers._IOption _source41 = _1013_names; - bool unmatched41 = true; - if (unmatched41) { + { if (_source41.is_Some) { RAST._IAssignLhs value0 = _source41.dtor_value; if (value0.is_LocalVar) { Dafny.ISequence _1016_name = value0.dtor_name; - unmatched41 = false; return Dafny.Sequence.Concat(_1016_name, Dafny.Sequence.UnicodeFromString(" = ")); } } } - if (unmatched41) { + { if (_source41.is_Some) { RAST._IAssignLhs value1 = _source41.dtor_value; if (value1.is_SelectMember) { RAST._IExpr _1017_member = value1.dtor_on; Dafny.ISequence _1018_field = value1.dtor_field; - unmatched41 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs45 = (RAST.Expr.create_Select(_1017_member, _1018_field)).LeftParentheses(_1017_member); Dafny.ISequence _1019_leftP = _let_tmp_rhs45.dtor__0; Dafny.ISequence _1020_rightP = _let_tmp_rhs45.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1019_leftP, (_1017_member)._ToString(_pat_let_tv104)), _1020_rightP), Dafny.Sequence.UnicodeFromString(".")), _1018_field), Dafny.Sequence.UnicodeFromString(" = ")); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1019_leftP, (_1017_member)._ToString(ind)), _1020_rightP), Dafny.Sequence.UnicodeFromString(".")), _1018_field), Dafny.Sequence.UnicodeFromString(" = ")); } } } - if (unmatched41) { + { if (_source41.is_Some) { RAST._IAssignLhs value2 = _source41.dtor_value; if (value2.is_ExtractTuple) { Dafny.ISequence> _1021_names = value2.dtor_names; - unmatched41 = false; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("("), RAST.__default.SeqToString>(_1021_names, ((System.Func, Dafny.ISequence>)((_1022_name) => { return _1022_name; })), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString(") = ")); } } } - if (unmatched41) { + { if (_source41.is_Some) { RAST._IAssignLhs value3 = _source41.dtor_value; if (value3.is_Index) { RAST._IExpr _1023_e = value3.dtor_expr; Dafny.ISequence _1024_indices = value3.dtor_indices; - unmatched41 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs46 = (RAST.Expr.create_Call(_1023_e, _1024_indices)).LeftParentheses(_1023_e); Dafny.ISequence _1025_leftP = _let_tmp_rhs46.dtor__0; Dafny.ISequence _1026_rightP = _let_tmp_rhs46.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1025_leftP, (_1023_e)._ToString(_pat_let_tv105)), _1026_rightP), Dafny.Sequence.UnicodeFromString("[")), RAST.__default.SeqToString(_1024_indices, Dafny.Helpers.Id, Func>>>((_1027_ind) => ((System.Func>)((_1028_index) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1025_leftP, (_1023_e)._ToString(ind)), _1026_rightP), Dafny.Sequence.UnicodeFromString("[")), RAST.__default.SeqToString(_1024_indices, Dafny.Helpers.Id, Func>>>((_1027_ind) => ((System.Func>)((_1028_index) => { return (_1028_index)._ToString(Dafny.Sequence.Concat(_1027_ind, RAST.__default.IND)); - })))(_pat_let_tv106), Dafny.Sequence.UnicodeFromString("]["))), Dafny.Sequence.UnicodeFromString("] = ")); + })))(ind), Dafny.Sequence.UnicodeFromString("]["))), Dafny.Sequence.UnicodeFromString("] = ")); } } } - if (unmatched41) { - unmatched41 = false; + { return Dafny.Sequence.UnicodeFromString("_ = "); } - throw new System.Exception("unexpected control point"); }))(); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1015_lhs, (_1014_expr)._ToString(Dafny.Sequence.Concat(_pat_let_tv107, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(";")); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1015_lhs, (_1014_expr)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(";")); } } - if (unmatched40) { + { if (_source40.is_Labelled) { Dafny.ISequence _1029_name = _source40.dtor_lbl; RAST._IExpr _1030_underlying = _source40.dtor_underlying; - unmatched40 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("'"), _1029_name), Dafny.Sequence.UnicodeFromString(": ")), (_1030_underlying)._ToString(_pat_let_tv108)); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("'"), _1029_name), Dafny.Sequence.UnicodeFromString(": ")), (_1030_underlying)._ToString(ind)); } } - if (unmatched40) { + { if (_source40.is_Break) { Std.Wrappers._IOption> _1031_optLbl = _source40.dtor_optLbl; - unmatched40 = false; Std.Wrappers._IOption> _source42 = _1031_optLbl; - bool unmatched42 = true; - if (unmatched42) { + { if (_source42.is_Some) { Dafny.ISequence _1032_lbl = _source42.dtor_value; - unmatched42 = false; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("break '"), _1032_lbl), Dafny.Sequence.UnicodeFromString(";")); } } - if (unmatched42) { - unmatched42 = false; + { return Dafny.Sequence.UnicodeFromString("break;"); } - throw new System.Exception("unexpected control point"); } } - if (unmatched40) { + { if (_source40.is_Continue) { Std.Wrappers._IOption> _1033_optLbl = _source40.dtor_optLbl; - unmatched40 = false; Std.Wrappers._IOption> _source43 = _1033_optLbl; - bool unmatched43 = true; - if (unmatched43) { + { if (_source43.is_Some) { Dafny.ISequence _1034_lbl = _source43.dtor_value; - unmatched43 = false; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("continue '"), _1034_lbl), Dafny.Sequence.UnicodeFromString(";")); } } - if (unmatched43) { - unmatched43 = false; + { return Dafny.Sequence.UnicodeFromString("continue;"); } - throw new System.Exception("unexpected control point"); } } - if (unmatched40) { + { if (_source40.is_Loop) { Std.Wrappers._IOption _1035_optCond = _source40.dtor_optCond; RAST._IExpr _1036_underlying = _source40.dtor_underlying; - unmatched40 = false; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(((System.Func>)(() => { Std.Wrappers._IOption _source44 = _1035_optCond; - bool unmatched44 = true; - if (unmatched44) { + { if (_source44.is_None) { - unmatched44 = false; return Dafny.Sequence.UnicodeFromString("loop"); } } - if (unmatched44) { + { RAST._IExpr _1037_c = _source44.dtor_value; - unmatched44 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("while "), (_1037_c)._ToString(Dafny.Sequence.Concat(_pat_let_tv109, RAST.__default.IND))); + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("while "), (_1037_c)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))); } - throw new System.Exception("unexpected control point"); - }))(), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv110), RAST.__default.IND), (_1036_underlying)._ToString(Dafny.Sequence.Concat(_pat_let_tv111, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv112), Dafny.Sequence.UnicodeFromString("}")); + }))(), Dafny.Sequence.UnicodeFromString(" {\n")), ind), RAST.__default.IND), (_1036_underlying)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); } } - if (unmatched40) { + { if (_source40.is_For) { Dafny.ISequence _1038_name = _source40.dtor_name; RAST._IExpr _1039_range = _source40.dtor_range; RAST._IExpr _1040_body = _source40.dtor_body; - unmatched40 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("for "), _1038_name), Dafny.Sequence.UnicodeFromString(" in ")), (_1039_range)._ToString(Dafny.Sequence.Concat(_pat_let_tv113, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), _pat_let_tv114), RAST.__default.IND), (_1040_body)._ToString(Dafny.Sequence.Concat(_pat_let_tv115, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv116), Dafny.Sequence.UnicodeFromString("}")); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("for "), _1038_name), Dafny.Sequence.UnicodeFromString(" in ")), (_1039_range)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString(" {\n")), ind), RAST.__default.IND), (_1040_body)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); } } - if (unmatched40) { + { if (_source40.is_Return) { Std.Wrappers._IOption _1041_optExpr = _source40.dtor_optExpr; - unmatched40 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("return"), (((_1041_optExpr).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), ((_1041_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(_pat_let_tv117, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("return"), (((_1041_optExpr).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" "), ((_1041_optExpr).dtor_value)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND)))) : (Dafny.Sequence.UnicodeFromString("")))), Dafny.Sequence.UnicodeFromString(";")); } } - if (unmatched40) { + { if (_source40.is_CallType) { RAST._IExpr _1042_expr = _source40.dtor_obj; Dafny.ISequence _1043_tpes = _source40.dtor_typeParameters; - unmatched40 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs47 = (this).LeftParentheses(_1042_expr); Dafny.ISequence _1044_leftP = _let_tmp_rhs47.dtor__0; Dafny.ISequence _1045_rightP = _let_tmp_rhs47.dtor__1; if ((_1043_tpes).Equals(Dafny.Sequence.FromElements())) { - return (_1042_expr)._ToString(_pat_let_tv118); + return (_1042_expr)._ToString(ind); } else { - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1044_leftP, (_1042_expr)._ToString(_pat_let_tv119)), _1045_rightP), Dafny.Sequence.UnicodeFromString("::<")), RAST.__default.SeqToString(_1043_tpes, Dafny.Helpers.Id, Func>>>((_1046_ind) => ((System.Func>)((_1047_tpe) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1044_leftP, (_1042_expr)._ToString(ind)), _1045_rightP), Dafny.Sequence.UnicodeFromString("::<")), RAST.__default.SeqToString(_1043_tpes, Dafny.Helpers.Id, Func>>>((_1046_ind) => ((System.Func>)((_1047_tpe) => { return (_1047_tpe)._ToString(Dafny.Sequence.Concat(_1046_ind, RAST.__default.IND)); - })))(_pat_let_tv120), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">")); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(">")); } } } - if (unmatched40) { + { if (_source40.is_Call) { RAST._IExpr _1048_expr = _source40.dtor_obj; Dafny.ISequence _1049_args = _source40.dtor_arguments; - unmatched40 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs48 = (this).LeftParentheses(_1048_expr); Dafny.ISequence _1050_leftP = _let_tmp_rhs48.dtor__0; Dafny.ISequence _1051_rightP = _let_tmp_rhs48.dtor__1; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs49 = ((System.Func<_System._ITuple2, Dafny.ISequence>>)(() => { Std.Wrappers._IOption> _source45 = (_1048_expr).RightMostIdentifier(); - bool unmatched45 = true; - if (unmatched45) { - bool disjunctiveMatch2 = false; + { + bool disjunctiveMatch1 = false; if (_source45.is_Some) { Dafny.ISequence value4 = _source45.dtor_value; if (object.Equals(value4, Dafny.Sequence.UnicodeFromString("seq!"))) { - disjunctiveMatch2 = true; + disjunctiveMatch1 = true; } } if (_source45.is_Some) { Dafny.ISequence value5 = _source45.dtor_value; if (object.Equals(value5, Dafny.Sequence.UnicodeFromString("map!"))) { - disjunctiveMatch2 = true; + disjunctiveMatch1 = true; } } - if (disjunctiveMatch2) { - unmatched45 = false; + if (disjunctiveMatch1) { return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("["), Dafny.Sequence.UnicodeFromString("]")); } } - if (unmatched45) { - bool disjunctiveMatch3 = false; + { + bool disjunctiveMatch2 = false; if (_source45.is_Some) { Dafny.ISequence value6 = _source45.dtor_value; if (object.Equals(value6, Dafny.Sequence.UnicodeFromString("set!"))) { - disjunctiveMatch3 = true; + disjunctiveMatch2 = true; } } if (_source45.is_Some) { Dafny.ISequence value7 = _source45.dtor_value; if (object.Equals(value7, Dafny.Sequence.UnicodeFromString("multiset!"))) { - disjunctiveMatch3 = true; + disjunctiveMatch2 = true; } } - if (disjunctiveMatch3) { - unmatched45 = false; + if (disjunctiveMatch2) { return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("{"), Dafny.Sequence.UnicodeFromString("}")); } } - if (unmatched45) { - unmatched45 = false; + { return _System.Tuple2, Dafny.ISequence>.create(Dafny.Sequence.UnicodeFromString("("), Dafny.Sequence.UnicodeFromString(")")); } - throw new System.Exception("unexpected control point"); }))(); Dafny.ISequence _1052_leftCallP = _let_tmp_rhs49.dtor__0; Dafny.ISequence _1053_rightCallP = _let_tmp_rhs49.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1050_leftP, (_1048_expr)._ToString(_pat_let_tv121)), _1051_rightP), _1052_leftCallP), RAST.__default.SeqToString(_1049_args, Dafny.Helpers.Id, Func>>>((_1054_ind) => ((System.Func>)((_1055_arg) => { + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1050_leftP, (_1048_expr)._ToString(ind)), _1051_rightP), _1052_leftCallP), RAST.__default.SeqToString(_1049_args, Dafny.Helpers.Id, Func>>>((_1054_ind) => ((System.Func>)((_1055_arg) => { return (_1055_arg)._ToString(Dafny.Sequence.Concat(_1054_ind, RAST.__default.IND)); - })))(_pat_let_tv122), Dafny.Sequence.UnicodeFromString(", "))), _1053_rightCallP); + })))(ind), Dafny.Sequence.UnicodeFromString(", "))), _1053_rightCallP); } } - if (unmatched40) { + { if (_source40.is_Select) { RAST._IExpr _1056_expression = _source40.dtor_obj; Dafny.ISequence _1057_name = _source40.dtor_name; - unmatched40 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs50 = (this).LeftParentheses(_1056_expression); Dafny.ISequence _1058_leftP = _let_tmp_rhs50.dtor__0; Dafny.ISequence _1059_rightP = _let_tmp_rhs50.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1058_leftP, (_1056_expression)._ToString(_pat_let_tv123)), _1059_rightP), Dafny.Sequence.UnicodeFromString(".")), _1057_name); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1058_leftP, (_1056_expression)._ToString(ind)), _1059_rightP), Dafny.Sequence.UnicodeFromString(".")), _1057_name); } } - if (unmatched40) { + { if (_source40.is_SelectIndex) { RAST._IExpr _1060_expression = _source40.dtor_obj; RAST._IExpr _1061_range = _source40.dtor_range; - unmatched40 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs51 = (this).LeftParentheses(_1060_expression); Dafny.ISequence _1062_leftP = _let_tmp_rhs51.dtor__0; Dafny.ISequence _1063_rightP = _let_tmp_rhs51.dtor__1; - Dafny.ISequence _1064_rangeStr = (_1061_range)._ToString(Dafny.Sequence.Concat(_pat_let_tv124, RAST.__default.IND)); - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1062_leftP, (_1060_expression)._ToString(_pat_let_tv125)), _1063_rightP), Dafny.Sequence.UnicodeFromString("[")), _1064_rangeStr), Dafny.Sequence.UnicodeFromString("]")); + Dafny.ISequence _1064_rangeStr = (_1061_range)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND)); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1062_leftP, (_1060_expression)._ToString(ind)), _1063_rightP), Dafny.Sequence.UnicodeFromString("[")), _1064_rangeStr), Dafny.Sequence.UnicodeFromString("]")); } } - if (unmatched40) { + { if (_source40.is_MemberSelect) { RAST._IExpr _1065_expression = _source40.dtor_obj; Dafny.ISequence _1066_name = _source40.dtor_name; - unmatched40 = false; _System._ITuple2, Dafny.ISequence> _let_tmp_rhs52 = (this).LeftParentheses(_1065_expression); Dafny.ISequence _1067_leftP = _let_tmp_rhs52.dtor__0; Dafny.ISequence _1068_rightP = _let_tmp_rhs52.dtor__1; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1067_leftP, (_1065_expression)._ToString(_pat_let_tv126)), _1068_rightP), Dafny.Sequence.UnicodeFromString("::")), _1066_name); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(_1067_leftP, (_1065_expression)._ToString(ind)), _1068_rightP), Dafny.Sequence.UnicodeFromString("::")), _1066_name); } } - if (unmatched40) { + { if (_source40.is_Lambda) { Dafny.ISequence _1069_params = _source40.dtor_params; Std.Wrappers._IOption _1070_retType = _source40.dtor_retType; RAST._IExpr _1071_body = _source40.dtor_body; - unmatched40 = false; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("move |"), RAST.__default.SeqToString(_1069_params, Dafny.Helpers.Id, Func>>>((_1072_ind) => ((System.Func>)((_1073_arg) => { return (_1073_arg)._ToString(_1072_ind); - })))(_pat_let_tv127), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString("| ")), (((_1070_retType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("-> "), ((_1070_retType).dtor_value)._ToString(_pat_let_tv128))) : (Dafny.Sequence.UnicodeFromString("")))), ((((_1070_retType).is_Some) && (!((_1071_body).is_Block))) ? ((RAST.Expr.create_Block(_1071_body))._ToString(_pat_let_tv129)) : ((_1071_body)._ToString(_pat_let_tv130)))); + })))(ind), Dafny.Sequence.UnicodeFromString(","))), Dafny.Sequence.UnicodeFromString("| ")), (((_1070_retType).is_Some) ? (Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("-> "), ((_1070_retType).dtor_value)._ToString(ind))) : (Dafny.Sequence.UnicodeFromString("")))), ((((_1070_retType).is_Some) && (!((_1071_body).is_Block))) ? ((RAST.Expr.create_Block(_1071_body))._ToString(ind)) : ((_1071_body)._ToString(ind)))); } } - if (unmatched40) { + { RAST._IExpr _1074_r = _source40; - unmatched40 = false; - return RAST.__default.AddIndent((_1074_r).dtor_content, _pat_let_tv131); + return RAST.__default.AddIndent((_1074_r).dtor_content, ind); } - throw new System.Exception("unexpected control point"); } public RAST._IExpr Then(RAST._IExpr rhs2) { if ((this).is_StmtExpr) { @@ -6006,307 +5755,270 @@ public RAST._IExpr Clone() { } public RAST._IPrintingInfo printingInfo { get { RAST._IExpr _source46 = this; - bool unmatched46 = true; - if (unmatched46) { + { if (_source46.is_RawExpr) { - unmatched46 = false; return RAST.PrintingInfo.create_UnknownPrecedence(); } } - if (unmatched46) { + { if (_source46.is_ExprFromType) { - unmatched46 = false; return RAST.PrintingInfo.create_Precedence(BigInteger.One); } } - if (unmatched46) { + { if (_source46.is_Identifier) { - unmatched46 = false; return RAST.PrintingInfo.create_Precedence(BigInteger.One); } } - if (unmatched46) { + { if (_source46.is_LiteralInt) { - unmatched46 = false; return RAST.PrintingInfo.create_Precedence(BigInteger.One); } } - if (unmatched46) { + { if (_source46.is_LiteralBool) { - unmatched46 = false; return RAST.PrintingInfo.create_Precedence(BigInteger.One); } } - if (unmatched46) { + { if (_source46.is_LiteralString) { - unmatched46 = false; return RAST.PrintingInfo.create_Precedence(BigInteger.One); } } - if (unmatched46) { + { if (_source46.is_UnaryOp) { Dafny.ISequence _1076_op = _source46.dtor_op1; RAST._IExpr _1077_underlying = _source46.dtor_underlying; DAST.Format._IUnaryOpFormat _1078_format = _source46.dtor_format; - unmatched46 = false; Dafny.ISequence _source47 = _1076_op; - bool unmatched47 = true; - if (unmatched47) { + { if (object.Equals(_source47, Dafny.Sequence.UnicodeFromString("?"))) { - unmatched47 = false; return RAST.PrintingInfo.create_SuffixPrecedence(new BigInteger(5)); } } - if (unmatched47) { - bool disjunctiveMatch4 = false; + { + bool disjunctiveMatch3 = false; if (object.Equals(_source47, Dafny.Sequence.UnicodeFromString("-"))) { - disjunctiveMatch4 = true; + disjunctiveMatch3 = true; } if (object.Equals(_source47, Dafny.Sequence.UnicodeFromString("*"))) { - disjunctiveMatch4 = true; + disjunctiveMatch3 = true; } if (object.Equals(_source47, Dafny.Sequence.UnicodeFromString("!"))) { - disjunctiveMatch4 = true; + disjunctiveMatch3 = true; } if (object.Equals(_source47, Dafny.Sequence.UnicodeFromString("&"))) { - disjunctiveMatch4 = true; + disjunctiveMatch3 = true; } if (object.Equals(_source47, Dafny.Sequence.UnicodeFromString("&mut"))) { - disjunctiveMatch4 = true; + disjunctiveMatch3 = true; } - if (disjunctiveMatch4) { - unmatched47 = false; + if (disjunctiveMatch3) { return RAST.PrintingInfo.create_Precedence(new BigInteger(6)); } } - if (unmatched47) { - unmatched47 = false; + { return RAST.PrintingInfo.create_UnknownPrecedence(); } - throw new System.Exception("unexpected control point"); } } - if (unmatched46) { + { if (_source46.is_Select) { RAST._IExpr _1079_underlying = _source46.dtor_obj; Dafny.ISequence _1080_name = _source46.dtor_name; - unmatched46 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } } - if (unmatched46) { + { if (_source46.is_SelectIndex) { RAST._IExpr _1081_underlying = _source46.dtor_obj; RAST._IExpr _1082_range = _source46.dtor_range; - unmatched46 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } } - if (unmatched46) { + { if (_source46.is_MemberSelect) { RAST._IExpr _1083_underlying = _source46.dtor_obj; Dafny.ISequence _1084_name = _source46.dtor_name; - unmatched46 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } } - if (unmatched46) { + { if (_source46.is_CallType) { - unmatched46 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } } - if (unmatched46) { + { if (_source46.is_Call) { - unmatched46 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(2), RAST.Associativity.create_LeftToRight()); } } - if (unmatched46) { + { if (_source46.is_TypeAscription) { RAST._IExpr _1085_left = _source46.dtor_left; RAST._IType _1086_tpe = _source46.dtor_tpe; - unmatched46 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(10), RAST.Associativity.create_LeftToRight()); } } - if (unmatched46) { + { if (_source46.is_BinaryOp) { Dafny.ISequence _1087_op2 = _source46.dtor_op2; RAST._IExpr _1088_left = _source46.dtor_left; RAST._IExpr _1089_right = _source46.dtor_right; DAST.Format._IBinaryOpFormat _1090_format = _source46.dtor_format2; - unmatched46 = false; Dafny.ISequence _source48 = _1087_op2; - bool unmatched48 = true; - if (unmatched48) { - bool disjunctiveMatch5 = false; + { + bool disjunctiveMatch4 = false; if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("*"))) { - disjunctiveMatch5 = true; + disjunctiveMatch4 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("/"))) { - disjunctiveMatch5 = true; + disjunctiveMatch4 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("%"))) { - disjunctiveMatch5 = true; + disjunctiveMatch4 = true; } - if (disjunctiveMatch5) { - unmatched48 = false; + if (disjunctiveMatch4) { return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(20), RAST.Associativity.create_LeftToRight()); } } - if (unmatched48) { - bool disjunctiveMatch6 = false; + { + bool disjunctiveMatch5 = false; if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("+"))) { - disjunctiveMatch6 = true; + disjunctiveMatch5 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("-"))) { - disjunctiveMatch6 = true; + disjunctiveMatch5 = true; } - if (disjunctiveMatch6) { - unmatched48 = false; + if (disjunctiveMatch5) { return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(30), RAST.Associativity.create_LeftToRight()); } } - if (unmatched48) { - bool disjunctiveMatch7 = false; + { + bool disjunctiveMatch6 = false; if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("<<"))) { - disjunctiveMatch7 = true; + disjunctiveMatch6 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString(">>"))) { - disjunctiveMatch7 = true; + disjunctiveMatch6 = true; } - if (disjunctiveMatch7) { - unmatched48 = false; + if (disjunctiveMatch6) { return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(40), RAST.Associativity.create_LeftToRight()); } } - if (unmatched48) { + { if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("&"))) { - unmatched48 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(50), RAST.Associativity.create_LeftToRight()); } } - if (unmatched48) { + { if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("^"))) { - unmatched48 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(60), RAST.Associativity.create_LeftToRight()); } } - if (unmatched48) { + { if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("|"))) { - unmatched48 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(70), RAST.Associativity.create_LeftToRight()); } } - if (unmatched48) { - bool disjunctiveMatch8 = false; + { + bool disjunctiveMatch7 = false; if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("=="))) { - disjunctiveMatch8 = true; + disjunctiveMatch7 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("!="))) { - disjunctiveMatch8 = true; + disjunctiveMatch7 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("<"))) { - disjunctiveMatch8 = true; + disjunctiveMatch7 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString(">"))) { - disjunctiveMatch8 = true; + disjunctiveMatch7 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("<="))) { - disjunctiveMatch8 = true; + disjunctiveMatch7 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString(">="))) { - disjunctiveMatch8 = true; + disjunctiveMatch7 = true; } - if (disjunctiveMatch8) { - unmatched48 = false; + if (disjunctiveMatch7) { return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(80), RAST.Associativity.create_RequiresParentheses()); } } - if (unmatched48) { + { if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("&&"))) { - unmatched48 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(90), RAST.Associativity.create_LeftToRight()); } } - if (unmatched48) { + { if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("||"))) { - unmatched48 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(100), RAST.Associativity.create_LeftToRight()); } } - if (unmatched48) { - bool disjunctiveMatch9 = false; + { + bool disjunctiveMatch8 = false; if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString(".."))) { - disjunctiveMatch9 = true; + disjunctiveMatch8 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("..="))) { - disjunctiveMatch9 = true; + disjunctiveMatch8 = true; } - if (disjunctiveMatch9) { - unmatched48 = false; + if (disjunctiveMatch8) { return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RequiresParentheses()); } } - if (unmatched48) { - bool disjunctiveMatch10 = false; + { + bool disjunctiveMatch9 = false; if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("+="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("-="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("*="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("/="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("%="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("&="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("|="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("^="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString("<<="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } if (object.Equals(_source48, Dafny.Sequence.UnicodeFromString(">>="))) { - disjunctiveMatch10 = true; + disjunctiveMatch9 = true; } - if (disjunctiveMatch10) { - unmatched48 = false; + if (disjunctiveMatch9) { return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(110), RAST.Associativity.create_RightToLeft()); } } - if (unmatched48) { - unmatched48 = false; + { return RAST.PrintingInfo.create_PrecedenceAssociativity(BigInteger.Zero, RAST.Associativity.create_RequiresParentheses()); } - throw new System.Exception("unexpected control point"); } } - if (unmatched46) { + { if (_source46.is_Lambda) { - unmatched46 = false; return RAST.PrintingInfo.create_PrecedenceAssociativity(new BigInteger(300), RAST.Associativity.create_LeftToRight()); } } - if (unmatched46) { - unmatched46 = false; + { return RAST.PrintingInfo.create_UnknownPrecedence(); } - throw new System.Exception("unexpected control point"); } } } public class Expr_RawExpr : Expr { @@ -7341,42 +7053,30 @@ public Std.Wrappers._IOption dtor_body { } } public Dafny.ISequence _ToString(Dafny.ISequence ind) { - var _pat_let_tv132 = ind; - var _pat_let_tv133 = ind; - var _pat_let_tv134 = ind; - var _pat_let_tv135 = ind; return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("fn "), (this).dtor_name), RAST.TypeParamDecl.ToStringMultiple((this).dtor_typeParams, ind)), Dafny.Sequence.UnicodeFromString("(")), RAST.__default.SeqToString((this).dtor_formals, Dafny.Helpers.Id, Func>>>((_1091_ind) => ((System.Func>)((_1092_formal) => { return (_1092_formal)._ToString(_1091_ind); })))(ind), Dafny.Sequence.UnicodeFromString(", "))), Dafny.Sequence.UnicodeFromString(")")), ((System.Func>)(() => { Std.Wrappers._IOption _source49 = (this).dtor_returnType; - bool unmatched49 = true; - if (unmatched49) { + { if (_source49.is_Some) { RAST._IType _1093_t = _source49.dtor_value; - unmatched49 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" -> "), (_1093_t)._ToString(_pat_let_tv132)); + return Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" -> "), (_1093_t)._ToString(ind)); } } - if (unmatched49) { - unmatched49 = false; + { return Dafny.Sequence.UnicodeFromString(""); } - throw new System.Exception("unexpected control point"); }))()), ((((this).dtor_where).Equals(Dafny.Sequence.UnicodeFromString(""))) ? (Dafny.Sequence.UnicodeFromString("")) : (Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString("\n"), ind), RAST.__default.IND), (this).dtor_where)))), ((System.Func>)(() => { Std.Wrappers._IOption _source50 = (this).dtor_body; - bool unmatched50 = true; - if (unmatched50) { + { if (_source50.is_None) { - unmatched50 = false; return Dafny.Sequence.UnicodeFromString(";"); } } - if (unmatched50) { + { RAST._IExpr _1094_body = _source50.dtor_value; - unmatched50 = false; - return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" {\n"), _pat_let_tv133), RAST.__default.IND), (_1094_body)._ToString(Dafny.Sequence.Concat(_pat_let_tv134, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), _pat_let_tv135), Dafny.Sequence.UnicodeFromString("}")); + return Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.Concat(Dafny.Sequence.UnicodeFromString(" {\n"), ind), RAST.__default.IND), (_1094_body)._ToString(Dafny.Sequence.Concat(ind, RAST.__default.IND))), Dafny.Sequence.UnicodeFromString("\n")), ind), Dafny.Sequence.UnicodeFromString("}")); } - throw new System.Exception("unexpected control point"); }))()); } } From 9b46ec42e259e68c42a52b3aae0fc2097181d26a Mon Sep 17 00:00:00 2001 From: Rustan Leino Date: Wed, 10 Jul 2024 09:18:32 -0700 Subject: [PATCH 30/30] chore: Remove dead code leftover from merge --- Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs | 4 ---- .../SinglePassCodeGenerator/SinglePassCodeGenerator.cs | 7 ------- 2 files changed, 11 deletions(-) diff --git a/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs b/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs index 0295e588cf8..856bd85ce5d 100644 --- a/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs +++ b/Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs @@ -2480,10 +2480,6 @@ private string IdName(Declaration decl) { protected override string PrefixForForcedCapitalization => "Go_"; - public override Type ResultTypeAsViewedByFunctionBody(Function f) { - return f.Original.ResultType; - } - protected override string IdMemberName(MemberSelectExpr mse) { return Capitalize(mse.MemberName); } diff --git a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs index b62094ca326..798ccae90ca 100644 --- a/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs +++ b/Source/DafnyCore/Backends/SinglePassCodeGenerator/SinglePassCodeGenerator.cs @@ -2751,18 +2751,11 @@ private void CompileFunction(Function f, IClassWriter cw, bool lookasideBody) { Contract.Assert(enclosingFunction == null); enclosingFunction = f; CompileReturnBody(f.Body, f.OriginalResultTypeWithRenamings(), w, accVar); -#if NEW_ATTEMPT - CompileReturnBody(f.Body, ResultTypeAsViewedByFunctionBody(f), w, accVar); -#endif Contract.Assert(enclosingFunction == f); enclosingFunction = null; } } - public virtual Type ResultTypeAsViewedByFunctionBody(Function f) { - return f.ResultType; - } - public const string STATIC_ARGS_NAME = "args"; private void CompileMethod(Program program, Method m, IClassWriter cw, bool lookasideBody) {