Description:
I'm encountering an issue with the Sui Move plugin in WebStorm when working with a mutable reference in my code. Specifically, the plugin incorrectly reports an error on a dereference operation in the following line:
The error message shown by the plugin is:
Invalid dereference. Expected '&_' but found '<unknown>'
However, the code is valid and compiles without any issues. The dereference operation is expected to work as intended. Below is the full code snippet for context:
module playground::dereference {
use sui::table::{Self, Table};
public struct Counter has key {
id: UID,
entries: Table<address, u64>
}
public fun new_counter(ctx: &mut TxContext): Counter {
Counter {
id: object::new(ctx),
entries: table::new(ctx),
}
}
public fun increment_counter(counter: &mut Counter, sender: address) {
if (!counter.entries.contains(sender)) {
counter.entries.add(sender, 0);
};
let value = counter.entries.borrow_mut(sender);
// it explicitly requires the type of the value to be dereferenced
// let value: &mut u64 = counter.entries.borrow_mut(sender);
*value = *value + 1;
}
}
As shown, the line *value = *value + 1; is where the plugin throws the error, but it works perfectly when compiled.
Expected Behavior:
The plugin should recognize the dereference operation as valid and not throw an error.
Environment:
WebStorm version: 2024.2.1 RC
Sui Move Plugin version: 1.6.0.242
Description:
I'm encountering an issue with the Sui Move plugin in WebStorm when working with a mutable reference in my code. Specifically, the plugin incorrectly reports an error on a dereference operation in the following line:
The error message shown by the plugin is:
However, the code is valid and compiles without any issues. The dereference operation is expected to work as intended. Below is the full code snippet for context:
As shown, the line *value = *value + 1; is where the plugin throws the error, but it works perfectly when compiled.
Expected Behavior:
The plugin should recognize the dereference operation as valid and not throw an error.
Environment:
WebStorm version: 2024.2.1 RC
Sui Move Plugin version: 1.6.0.242