zetzit / zz

πŸΊπŸ™ ZetZ a zymbolic verifier and tranzpiler to bare metal C
MIT License
1.6k stars 52 forks source link

Mixing callsite assign and callsite source #126

Open jwerle opened 3 years ago

jwerle commented 3 years ago

Consider the following hypothetical assert function that mixes callsite_source and callsite assign syntax:

fn assert(
  bool assertion,
  char* callsite_source<file> unsafe file,
  char* callsite_source<function> unsafe scope,
  usize callsite_source<line> line,
  char *message = 0
) {
 ...
}

The compiler will yield the following compilation error:

[ERROR] call argument count mismatch
  --> /home/werle/repos/zzmodules/runtime-assert/tests/pass.zz:10:3
   |
10 |   assert(true);␊
   |   ^----^
   |
   = function '::runtime_assert::assert' is defined over 5 arguments, but you passed 4

when the message argument is not defined. Is this intended? The compiler will succeed in compilation when the message argument is given.

aep commented 3 years ago

yeah mixing them is broken. I don't really want to fix it tho, because callsite_source needs to be replaced entirely with a callsite assign macro call,

i.e. something like

  char* file  = @source(file)