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

Fix Issue 17548 - [REG2.072.0] Forward reference error with scope function parameters #6934

Closed
wants to merge 5 commits into from

Conversation

JohanEngelen
Copy link
Contributor

This PR

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @JohanEngelen! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Fix Bugzilla Description
17548 [REG2.072.0] Forward reference error with scope function parameters

@WalterBright
Copy link
Member

renames Module.semantic*, such that it is clear that it is not accidental that Dsymbol.semantic* are not overridden (this was the original intent of #6001).

What's the problem with overriding it? It looks strange to have two different semantic2() functions.

@JohanEngelen
Copy link
Contributor Author

What's the problem with overriding it? It looks strange to have two different semantic2() functions.

Indeed. Before #6001, there were two different (but identically named) semantic* functions for a Module. #6001 tried to resolve it by making the Module.semantic* override Dsymbol's. But that apparently broke things. So I reverted that. But now with the revert, a different test (compilable/ice10598.d) breaks...
The frontend code is so opaque that I cannot make any judgement on what the correct code should be.

@Syniurge
Copy link
Contributor

Thanks for looking into it Johan. This fixes my particular case, but Module.doSemanticPass() can still be hit at the wrong time with the same outcome if we add an import in S2:

struct S2 {
    // void bar(int arg = .fwdref1.cnst) {}
    S1 s;
    import fwdref2;
}

Importing itself is contrived, but it could be importing a fwdref3 module that imports fwdref2 and it would be the same.

@JohanEngelen
Copy link
Contributor Author

Note: I just wanted to unbreak things that got broken by my PR. Now it looks like there is a bigger problem lurking, which does need a proper fix, rather than a revert of #6001. :(
Because I am currently not actively working on figuring out what's wrong (and probably won't be any time soon), shall I close this PR?

@Syniurge
Copy link
Contributor

Still helped :)

Now it looks like there is a bigger problem lurking, which does need a proper fix

Always that feeling with that kind of issue.

I pushed a tentative one line fix but fearing it may miss the bigger picture I wanted to see other analysis/suggestions.

@MartinNowak
Copy link
Member

MartinNowak commented Jul 9, 2017

Any idea what caused the regression? Looks a bit like Module.semantic(Scope *) now gets used as Dsymbol.semantic(sc) somewhere, because of the apparent reentrant semantic calls. Before #6001 this just resolved to Package.semantic(Scope*) which doesn't do much.
We might want to add an early return to reentrant Module.semantic* calls, e.g. here.
The Module.semantic* methods already prevent reentrant runs.

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