-
Notifications
You must be signed in to change notification settings - Fork 207
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 pack expansion for array elements #230
Fix pack expansion for array elements #230
Conversation
48a43aa
to
281bb68
Compare
Added call for reviewers on cdt-dev. If none are forthcoming we'll need a plan-B (me learning this area?) |
Well I can try to share what I have learned of CDT if you need help.. Evaluating stuff does not look particularly hard in CDT but there is a lot of code - fortunately most implementations are quite similar in structure, and there are lots of tests too. |
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.
LGTM.
There might be another way implementing this. Instead of adding the new class EvalPackAccess
you could add another case to EvalCompositeAccess::getType
:
@Override
public IType getType() {
IType type = getParent().getType();
type = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
if (type instanceof IArrayType) {
IArrayType arrayType = (IArrayType) type;
return arrayType.getType();
}
...
Add case for detecting packs:
@Override
public IType getType() {
IType type = getParent().getType();
type = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
if (parent instanceof EvalBinding parentBinding && parentBinding.getBinding() instanceof ICPPSpecialization spec
&& spec.getSpecializedBinding() instanceof IVariable v
&& v.getType() instanceof ICPPParameterPackType) {
return type;
} else if (type instanceof IArrayType) {
IArrayType arrayType = (IArrayType) type;
return arrayType.getType();
}
...
I'm not sure what's the better solution, yours involves more changes but might be more solid because it doesn't need the additional detection logic.
...e.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalPackAccess.java
Outdated
Show resolved
Hide resolved
When parameter pack contains array type the EvalCompositeAccess.getType() will attempt to return type of array element. Fix this by providing EvalPackAccess which returns pack elements as is.
281bb68
to
58116bd
Compare
Yes to my mind |
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 have kicked off the build, assuming it all goes well this looks good to go.
Once your first PR gets merged, future PRs will run the build automatically.
Pretty sure failing test is unrelated. I'll need to check that it is in he to do list when I get back to my desk. |
The failing test is:
with this output;
which doesn't appear in any of my previous marked releng labelled issues. I have kicked off the build fresh. |
Note this failure is the same as in PR #255 and we were not able reproduce it locally yet https://github.com/eclipse-cdt/cdt/pull/255/checks?check_run_id=10773221361 |
Thanks - I have created the issue for the flaky test, #259 |
When parameter pack contains array type the
EvalCompositeAccess.getType()
will attempt to return type of array element.Fix this by providing
EvalPackAccess
which returns pack elements as is.