Commit 5436f6b
authored
Remove warnings from mutable function arguments (#1606)
### What
Add test coverage for contract functions that use mutable function
arguments. Create new test_mutability contract with a calc function that
accepts a mutable parameter, demonstrating that the SDK macros correctly
handle mut keywords in contract implementations. Remove warnings that
the test coverage surfaced.
### Why
The SDK's contract macros already support mutable function parameters,
which are is a Rust pattern. This test ensures the macro expansion
correctly preserves mutability modifiers and validates the generated
code compiles and executes correctly. The test surfaced that warnings
are generated in this case, and the warnings shouldn't be as the user is
writing valid code and the warnings are coming from the generated code.
Close #16051 parent 0a1c1c0 commit 5436f6b
File tree
10 files changed
+772
-4
lines changed- soroban-sdk-macros/src
- soroban-sdk
- src/tests
- test_snapshots/tests/contract_fn
- tests-expanded
- tests/mutability
- src
- test_snapshots/test
10 files changed
+772
-4
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
51 | 71 | | |
52 | 72 | | |
53 | 73 | | |
| |||
70 | 90 | | |
71 | 91 | | |
72 | 92 | | |
73 | | - | |
| 93 | + | |
74 | 94 | | |
75 | 95 | | |
76 | 96 | | |
77 | 97 | | |
78 | 98 | | |
79 | | - | |
| 99 | + | |
80 | 100 | | |
81 | 101 | | |
82 | 102 | | |
| |||
90 | 110 | | |
91 | 111 | | |
92 | 112 | | |
| 113 | + | |
| 114 | + | |
93 | 115 | | |
94 | 116 | | |
95 | 117 | | |
96 | 118 | | |
97 | 119 | | |
98 | | - | |
| 120 | + | |
99 | 121 | | |
100 | 122 | | |
101 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| |||
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments