How to tell the compiler to ignore this in a type safe way - "operator may trap for inferred type"?

I have above a code snippet that provides this warning. But as you can see in the above check, I’m verifying that transactionHistoryLength is greater that 50, so the offending code section is safe.

Am I doing this wrong? Shouldn’t the compiler be able to infer that this code is actually okay owing to the if check performed

2 Likes

@claudio any thoughts on this?

try:

let temp: Nat = transactionHistoryLength - 50;
1 Like

Thank you. That was it. Specifying the type inline also solved it

I wasn’t even aware you could do something like this