[BUG] Function redefinition does not throw error
frankhart2018 opened this issue · 3 comments
frankhart2018 commented
Describe the bug
When a function is redefined, then instead of throwing error, it compiles successfully. But the type of parameters of first remains not_known, while the redefinition gets the dtype for params.
Steps to Reproduce
Consider the following simC code:-
fun sum(a, b) {
return a + b;
}
fun sum(c, d) {
return c - d;
}
MAIN
var res = sum(1, 2)
var res1 = sum(2, 1)
END_MAIN
This is the C code generated:-
int sum(not_known a, not_known b) {
return a + b;
}
int sum(int c, int d) {
return c - d;
}
int main() {
int res = sum(1, 2);
int res1 = sum(2, 1);
return 0;
}
Expected behavior
It should throw an error:-
[Line 5] Error: Function sum redefined
diivi commented
Could this issue be assigned to me?
frankhart2018 commented
Sure @diivi. Assigning this to you.
diivi commented
can you guide me as to where the code related to storing all functions/ something related to this issue is written? could not find a solution in the readme docs @frankhart2018