aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Bug][move-compiler-v2] redundant and misspelled signer parameter error

Open brmataptos opened this issue 9 months ago • 1 comments

b# 🐛 Bug

&mut signer parameter to a view function yields 2 errors, leading to potential confusion. The second one is also misspelled ("paramter") making us look pkind of bad.

These both are generated in aptos-move/framework/src/extended_checks.rs and apply to the test in aptos-move/e2e-move-tests/src/tests/attributes.rs:

error: type `&mut signer` is not supported as a parameter type
  ┌─ /var/folders/hx/_s_6fyh529bgmvl6z4m8m9fm0000gn/T/.tmpRYTHVQ/sources/m.move:4:17
  │
4 │             fun view(_:&mut signer,value: u64): u64 { value }
  │                 ^^^^

error: view function cannot use the & signer paremter
  ┌─ /var/folders/hx/_s_6fyh529bgmvl6z4m8m9fm0000gn/T/.tmpRYTHVQ/sources/m.move:4:17
  │
4 │             fun view(_:&mut signer,value: u64): u64 { value }
  │                 ^^^^

test tests::attributes::test_view_attribute_with_mut_ref_signer - should panic ... ok

To reproduce:

UB=1 MOVE_COMPILER_V2=true cargo test -p e2e-move-tests -- test_view_attribute_with_mut_ref_signer

This also occurs without compiler-v2, so priority reduced.

brmataptos avatar May 10 '24 18:05 brmataptos

Note that the entire phrase cannot use the & signer paremter is problematic in multiple ways. Better would be & signer is not supported as a parameter type to a view function.

brmataptos avatar May 10 '24 18:05 brmataptos