google / google/gapid

Short-circuit evaluation does not work with subroutines

Open
#2,018 0 comments 0 reactions 0 assignees View on GitHub
GAPIL P3 triaged
Dominant language
Go
Stars
2.2k
Forks
329
PR merge metrics
No merged PRs in 30d

Description

The gapil resolver moves subroutine calls out of expressions so that aborts can be handled.
However, this breaks short-circuit evaluation. Consider:

```
x := y && SubWithSideEffect()
```

This will be transformed to:

```
tmp := SubWithSideEffect()
// logic to check SubWithSideEffect did not abort
x := y && tmp
```

This is very tricky to fix with the current template codegen, but far easier to solve with the new compiler.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.