Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Function redefinition does not throw error #481

Open
frankhart2018 opened this issue Jan 26, 2021 · 3 comments
Open

[BUG] Function redefinition does not throw error #481

frankhart2018 opened this issue Jan 26, 2021 · 3 comments
Assignees
Labels
bug Something isn't working easy Easy problem

Comments

@frankhart2018
Copy link
Member

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
@frankhart2018 frankhart2018 added bug Something isn't working easy Easy problem SWoC 2021 labels Jan 26, 2021
@diivi
Copy link

diivi commented Oct 1, 2021

Could this issue be assigned to me?

@frankhart2018
Copy link
Member Author

Sure @diivi. Assigning this to you.

@diivi
Copy link

diivi commented Oct 1, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easy Easy problem
Projects
None yet
Development

No branches or pull requests

2 participants