@@ -432,6 +432,80 @@ fn conjugate_mutable_update_in_apply_fail() {
432432 ) ;
433433}
434434
435+ #[ test]
436+ fn conjugate_allowed_mutable_with_invalid_lhs_ignored ( ) {
437+ check (
438+ indoc ! { "
439+ namespace Test {
440+ operation B(i : Int) : Unit is Adj {}
441+ operation A() : Unit {
442+ mutable a = 1;
443+ within {
444+ B(1);
445+ }
446+ apply {
447+ set (a + 1) = 3;
448+ B(2);
449+ }
450+ }
451+ }
452+ " } ,
453+ & expect ! [ [ r#"
454+ Package:
455+ Item 0 [0-234] (Public):
456+ Namespace (Ident 33 [10-14] "Test"): Item 1, Item 2
457+ Item 1 [21-58] (Internal):
458+ Parent: 0
459+ Callable 0 [21-58] (operation):
460+ name: Ident 1 [31-32] "B"
461+ input: Pat 2 [33-40] [Type Int]: Bind: Ident 3 [33-34] "i"
462+ output: Unit
463+ functors: Adj
464+ body: SpecDecl 4 [21-58]: Impl:
465+ Block 5 [56-58]: <empty>
466+ adj: <none>
467+ ctl: <none>
468+ ctl-adj: <none>
469+ Item 2 [63-232] (Internal):
470+ Parent: 0
471+ Callable 6 [63-232] (operation):
472+ name: Ident 7 [73-74] "A"
473+ input: Pat 8 [74-76] [Type Unit]: Unit
474+ output: Unit
475+ functors: empty set
476+ body: SpecDecl 9 [63-232]: Impl:
477+ Block 10 [84-232] [Type Unit]:
478+ Stmt 11 [94-108]: Local (Mutable):
479+ Pat 12 [102-103] [Type Int]: Bind: Ident 13 [102-103] "a"
480+ Expr 14 [106-107] [Type Int]: Lit: Int(1)
481+ Stmt 15 [117-226]: Expr: Expr 51 [0-0] [Type Unit]: Expr Block: Block 44 [0-0] [Type Unit]:
482+ Stmt 45 [0-0]: Expr: Expr 46 [0-0] [Type Unit]: Expr Block: Block 17 [124-153] [Type Unit]:
483+ Stmt 18 [138-143]: Semi: Expr 19 [138-142] [Type Unit]: Call:
484+ Expr 20 [138-139] [Type (Int => Unit is Adj)]: Var: Item 1 (Package 1)
485+ Expr 21 [140-141] [Type Int]: Lit: Int(1)
486+ Stmt 41 [0-0]: Local (Immutable):
487+ Pat 42 [0-0] [Type Unit]: Bind: Ident 40 [0-0] "@apply_res"
488+ Expr 43 [0-0] [Type Unit]: Expr Block: Block 22 [168-226] [Type Unit]:
489+ Stmt 23 [182-198]: Semi: Expr 24 [182-197] [Type Unit]: Assign:
490+ Expr 25 [187-192] [Type Int]: BinOp (Add):
491+ Expr 26 [187-188] [Type Int]: Var: Local 13
492+ Expr 27 [191-192] [Type Int]: Lit: Int(1)
493+ Expr 28 [196-197] [Type Int]: Lit: Int(3)
494+ Stmt 29 [211-216]: Semi: Expr 30 [211-215] [Type Unit]: Call:
495+ Expr 31 [211-212] [Type (Int => Unit is Adj)]: Var: Item 1 (Package 1)
496+ Expr 32 [213-214] [Type Int]: Lit: Int(2)
497+ Stmt 47 [0-0]: Expr: Expr 48 [0-0] [Type Unit]: Expr Block: Block 34 [124-153] [Type Unit]:
498+ Stmt 35 [138-143]: Semi: Expr 36 [138-142] [Type Unit]: Call:
499+ Expr 37 [138-139] [Type (Int => Unit is Adj)]: UnOp (Functor Adj):
500+ Expr 38 [138-139] [Type (Int => Unit is Adj)]: Var: Item 1 (Package 1)
501+ Expr 39 [140-141] [Type Int]: Lit: Int(1)
502+ Stmt 49 [0-0]: Expr: Expr 50 [0-0] [Type Unit]: Var: Local 40
503+ adj: <none>
504+ ctl: <none>
505+ ctl-adj: <none>"# ] ] ,
506+ ) ;
507+ }
508+
435509#[ test]
436510fn conjugate_return_in_apply_fail ( ) {
437511 check (
0 commit comments