Beef icon indicating copy to clipboard operation
Beef copied to clipboard

Codegen crash creating Result with void payload casted from non-void

Open EinScott opened this issue 2 years ago • 0 comments

Through an unfortunate series of events I ended up with this code (i really meant to call TryWrite, and assumed the cast in the payload was just due to some different int types...):

Stream s = scope MemoryStream(15);
uint8[14] data = .();
if (s.Write(data) case .Ok((void)data.Count)) // Compiler says this is fine (i had just "(.)" but it's the same)
NOP!();

Codegen is not a fan of this. Compiling crashes.

EinScott avatar Jan 01 '23 12:01 EinScott