Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
rahxephon89 committed Nov 8, 2024
1 parent f27dad1 commit e7924fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@

Diagnostics:
error: undeclared receiver function `merge_non_receiver` for type `W`
┌─ tests/checking/receiver/calls_index_errors.move:22:9
22 │ S[account].t.w.merge_non_receiver(w)
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: the function takes `&mut` but `&` was provided
┌─ tests/checking/receiver/calls_index_errors.move:18:9
┌─ tests/checking/receiver/calls_index_errors.move:26:9
18 │ (&S[account].t.w).merge(w)
26 │ (&S[account].t.w).merge(w)
│ ^^^^^^^^^^^^^^^^^

error: the function takes `&mut` but `&` was provided
┌─ tests/checking/receiver/calls_index_errors.move:22:9
┌─ tests/checking/receiver/calls_index_errors.move:30:9
22 │ (&v[0].t.w).merge(w)
30 │ (&v[0].t.w).merge(w)
│ ^^^^^^^^^^^
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ module 0x42::m {
self.x += s.x;
}

fun merge_non_receiver(self1: &mut W, s: W) {
self1.x += s.x;
}

fun foo_non_receiver(account: address, w: W) acquires S {
S[account].t.w.merge_non_receiver(w)
}

fun foo_(account: address, w: W) acquires S {
(&S[account].t.w).merge(w)
}
Expand Down

0 comments on commit e7924fb

Please sign in to comment.