🐞️ Bugfix: Statement-level FunctionCall have wrong weighting #193

Closed
opened 2024-05-26 12:59:26 +02:00 by deavmi · 7 comments
Owner

Purpose ✍️

If you have the below code and attempt to typecheck/codegen it:

module basic2;

void k(int.int i, int* p)
{
	
}

int main()
{
	int* arr;
	basic2.k(1, arr);

	return 0;
}

Then you get an error saying that arr is trying to be fereneced prior to arr being declared. The only way this is happening is because the function call is re-ordered to appear first and hence the error makes sense then.

Solution

There is no weighting value for the FunctionCall, set it to 2 in the constructor.

Checklist 🗒️

  • Implemented FunctionCall fix
  • Added unittests
    • Updated Compiler unittests
    • Updated Github CI pipelines
## Purpose ✍️ If you have the below code and attempt to typecheck/codegen it: ```d module basic2; void k(int.int i, int* p) { } int main() { int* arr; basic2.k(1, arr); return 0; } ``` Then you get an error saying that `arr` is trying to be fereneced prior to `arr` being declared. The only way this is happening is because the function call is re-ordered to appear first and hence the error makes sense then. ## Solution ✅ There is no weighting value for the `FunctionCall`, set it to 2 in the constructor. ### Checklist 🗒️ - [x] Implemented `FunctionCall` fix - [x] Added unittests - [x] Updated `Compiler` unittests - [x] Updated Github CI pipelines
deavmi added the
needsfix
parser
labels 2024-05-26 12:59:34 +02:00
deavmi started working 2024-05-26 12:59:43 +02:00
deavmi added this to the Basics milestone 2024-05-26 12:59:49 +02:00
deavmi added this to the Parser project 2024-05-26 12:59:52 +02:00
deavmi self-assigned this 2024-05-26 12:59:55 +02:00
deavmi stopped working 2024-05-26 13:00:33 +02:00
50 seconds
deavmi started working 2024-05-26 13:01:57 +02:00
deavmi changed title from Backport: FunctioNCall standalone werighting to 🐞️ Bugfix: Statement-level FunctionCall have wrong weighting 2024-05-26 13:03:06 +02:00
deavmi added reference bugfix/funccall_stdalone_weighting 2024-05-26 13:03:24 +02:00
deavmi added the due date 2024-05-26 2024-05-26 13:03:32 +02:00
Author
Owner

FunctionCall

  • Set the weighting to 2 such that when this is used as a standalone statement-level call that is stays in its proper place, and doesn't (for example) jump prior to variable declarations
FunctionCall - Set the weighting to `2` such that when this is used as a standalone statement-level call that is stays in its proper place, and doesn't (for example) jump prior to variable declarations
Author
Owner

Compiler (unittests)

  • Added test for simple_func_statement.t

Test cases

  • Added simple_func_statement.t
Compiler (unittests) - Added test for `simple_func_statement.t` Test cases - Added `simple_func_statement.t`
Author
Owner

Pipelines

  • Added test case for simple_func_statement.t
Pipelines - Added test case for `simple_func_statement.t`
Author
Owner

Waiting for Github CI/CD now...

Waiting for Github CI/CD now...
Author
Owner

Waiting for Github CI/CD now...

All done

> Waiting for Github CI/CD now... All done ✅
deavmi stopped working 2024-05-26 13:16:15 +02:00
14 minutes 18 seconds
deavmi added spent time 2024-06-28 16:35:49 +02:00
1 minute
deavmi started working 2024-06-28 16:36:07 +02:00
Author
Owner

Going to get this in now...

Going to get this in now...
Author
Owner

Merged

Merged ✅
deavmi stopped working 2024-06-28 16:39:23 +02:00
3 minutes 16 seconds
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Total Time Spent: 19 minutes 24 seconds
deavmi
19 minutes 24 seconds
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

2024-05-27

Dependencies

No dependencies set.

Reference: tlang/tlang#193
No description provided.