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

General generic-related error reporting improvements #330

Open
Jacajack opened this issue Nov 21, 2023 · 1 comment
Open

General generic-related error reporting improvements #330

Jacajack opened this issue Nov 21, 2023 · 1 comment
Assignees
Labels
analyzer Related to semantic & design analyzers enhancement New feature or request nice to have Only if we have time

Comments

@Jacajack
Copy link
Owner

Feature description

I know this is probably a big one (but not sure), but it would be nice if the compiler could print values of relevant generic variables when reporting errors. For example in this code:

module X {}

impl X {
	const ubus<4> arr[4];

	for (i in [0:<4]) {
		ubus<(i+2)> x = 0;
		arr[i] = ext(x);
	}
}

We get this moderately helpful error message:

Error: 
  × In assignments, the width of the left-hand side must match the width of the right-hand side
    ╭─[tests/input/ignore/jesus.hirl:45:1]
 45 │         ubus<(i+2)> x = 0;
 46 │         arr[i] = ext(x);
    ·                      ┬
    ·                      ╰── You cannot shrink the width of the signal
 47 │     }
    ╰────
  help: Please make sure that all bonded signals have the same width

Perhaps it would be sufficient to get all generic variables which appear in the expression and print their values. Printing values of iterators in case of nested for loops would be beneficial as well.

@Jacajack Jacajack added enhancement New feature or request analyzer Related to semantic & design analyzers labels Nov 21, 2023
@Jacajack Jacajack changed the title General error reporting improvements General generic-related error reporting improvements Nov 21, 2023
@Jacajack
Copy link
Owner Author

By the way the ext() error could also contain information about the argument and destination widths.

@Jacajack Jacajack added the nice to have Only if we have time label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer Related to semantic & design analyzers enhancement New feature or request nice to have Only if we have time
Projects
None yet
Development

No branches or pull requests

2 participants