This repository was archived by the owner on May 4, 2024. It is now read-only.
[Bug]assert! can't recognize the user-defined fun return type Β #1046
Open
Description
π Bug
To reproduce
Code snippet to reproduce
public fun contains<Value: drop,store>(
set: &SimpleSet<Value>,
value: Value,
): bool {
let len = vector::length(&set.data);
let i = 0;
while(i < len){
let v = vector::borrow(&set.data, i);
if (v == &value){
return true
};
i = i + 1;
};
false
}
#[test]
public fun add_remove_many(){
let set = create<u64>();
assert!(length(&set) == 0,0);
assert!(contains(&set, 11),1);
// add(&mut set, 11);
// assert!(length(&set) == 1,2);
// assert!(contains_v(&set, 11),3);
// assert!(*at(&set, 0) == 11,4);
// add(&mut set, 12);
// add(&mut set, 13);
// add(&mut set, 14);
// add(&mut set, 15);
}
Stack trace/error message
assert!(contains(&set, 11),1);
β ^^^^^^^^^^^^^^^^^^ Could not infer this type. Try adding an annotation
Expected Behavior
i can't understand why it can't infer type
System information
Please complete the following information:
Additional context
Add any other context about the problem here.