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
fix 23355: invalid template parameter loses error location in some cases (T[UndefinedIdentifier] has no error loc) #14465
Conversation
Thanks for your pull request, @WebFreak001! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#14465" |
a484636
to
6695912
Compare
Types (e.g. TypeAArray) don't have a location attached to them, so instead of trying to use that we instead use the error location from the general template parameters. Co-authored-by: mhh <maxhaton@gmail.com>
// use the first location of template parameters as we | ||
// don't have any other location set anywhere. | ||
// not completely accurate, but better than nothing. | ||
if (inferStart < parameters.dim) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this ever be false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inferStart has a few assignments in a few places in the code where it's assigned to parameters.dim
, would prefer to keep this check because I have not analyzed all the different sources where this function may be called from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be right to have it be an assertion.
Those are set to make [inferStart..end] == [] I think.
Issue is whether there's going to be an assertion failure because it. These functions are the back-rooms of dmd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this whole file really needs a refactoring, there is a lot of code duplication happening here. Would prefer not to add any breaking changes, such as an assert, here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That need for refactoring is why we don't have named args
6695912
to
bbd03ee
Compare
Types (e.g. TypeAArray) don't have a location attached to them, so instead of trying to use that we instead use the error location from the general template parameters. Co-authored-by: mhh <maxhaton@gmail.com> Co-authored-by: mhh <maxhaton@gmail.com>
Types (e.g. TypeAArray) don't have a location attached to them, so instead of trying to use that we instead use the error location from the general template parameters.
@maxhaton
The error message came from here:
dmd/compiler/src/dmd/typesem.d
Line 175 in 58a63ff
which was called from the here changed file.