cimplec / sim-c

A dynamically typed high-level front end for C

Home Page:https://cimplec.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Predict type in print

Math-O5 opened this issue · comments

Describe the bug
When print is used inside a function, the type is not defined yet, so it will throw a error.

Steps to Reproduce
in Sim-C:

fun sum(a) {
      print(a)
}
fun sum(a, b) {
      print(a + b)
}

Expected behavior
Process the prediction type in compiler time, because only then the variable will be defined. If not defined yet, then throw an error.

Also fixed a minor bug in var_statement parser, see #487 for details.