Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try-catch does not restore state changes if a throw occurs inside function with non-trivial branching #1226

Open
anton-trunov opened this issue Dec 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working or isn't right func-bug
Milestone

Comments

@anton-trunov
Copy link
Member

anton-trunov commented Dec 22, 2024

fun throwWithElseIf(op: Int) {
  if (op == 1) { return }
  else if (op == 2) { return }
  else { throw(1042) }
}

contract Repro {
  get fun throwInFun(): Bool {
    let x = 10;
    try {
      x = 20;
      throwWithElseIf(42);
    } catch(_) { 
      return x == 10;
    }
  }
}

Fixed in FunC v0.4.6: https://github.com/ton-blockchain/ton/releases/tag/func-0.4.6

@anton-trunov anton-trunov added bug Something isn't working or isn't right func-bug labels Dec 22, 2024
@anton-trunov anton-trunov added this to the v1.6.0 milestone Dec 22, 2024
@anton-trunov anton-trunov self-assigned this Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or isn't right func-bug
Projects
None yet
Development

No branches or pull requests

1 participant