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

Move newScope methods from dclass.d to newScope visitor in dsymbolsem.d #17038

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dchidindu5
Copy link
Contributor

@dchidindu5 dchidindu5 commented Oct 29, 2024

OPEN SOURCE CONTRIBUTOR

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @dchidindu5! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#17038"

@thewilsonator
Copy link
Contributor

Try rebasing on the most recent master, those failures don't immediately seem to be related.

@dchidindu5
Copy link
Contributor Author

@thewilsonator
I rebased and still failing


override void visit(ClassDeclaration cld)
{
auto sc2 = cld.newScope(sc);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you have translated super.newScope here properly. Should be (cast(AggregateDeclaration)cld).newScope(sc);


override void visit(InterfaceDeclaration ifd)
{
auto sc2 = ifd.newScope(sc);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same but `cast(ClassDeclaration)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, Let me work on them

@@ -234,6 +234,7 @@ void test_visitors()
ClassDeclaration *cd = ClassDeclaration::create(loc, Identifier::idPool("TypeInfo"), NULL, NULL, true);
assert(cd->isClassDeclaration() == cd);
assert(cd->vtblOffset() == 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assert failing means that

if (isCOMinterface() || isCPPinterface())
    return 0;
return 1;

is returning the wrong value.
Both of those methods should return false for classes (i.e. only for interfaces should they possibly return true). I'm not really sure why that is happening. You might want to check what the actual return value is. If it is 0 or if it is some other value (which would indicate a corrupt vtable on the C++ side).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is odd that is only happens with G++/MSVC(???) as the C++ compiler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay i'd look at the actual return value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thewilsonator I'm a bit lost here, how do I figure that out??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printf("cd->vtblOffset() = %d\n", cd->vtblOffset());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants