google / wuffs

Wrangling Untrusted File Formats Safely
Other
4.07k stars 129 forks source link

internal error: temporary variable count out of sync #14

Closed mvdan closed 2 years ago

mvdan commented 6 years ago

Stumbled upon this internal error when changing some code. Small reproducer:

$ cat decode.wuffs
packageid "zstd"

pub struct decoder?(
)

pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
        return in.src.skip32?(n:3)
}
$ wuffs-c gen -package_name zstd decode.wuffs
internal error: temporary variable count out of sync

I soon figured out that I should do in.src.skip32?(n:3); return instead, but I guess that an internal error should never happen in any case.

nigeltao commented 6 years ago

Yeah, internal errors shouldn't happen.

In any case, a future revision of the language will probably require adding "try" or "retry" to any foo? calls (note the ?), and those will probably prevent you from combining with "return".

Stay tuned.