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 23295 - explain why scope inference failed #14373

Merged
merged 2 commits into from
Aug 19, 2022

Conversation

dkorpel
Copy link
Contributor

@dkorpel dkorpel commented Aug 16, 2022

Following up #14368

I'm using an associative array instead of an extra field to VarDeclaration to reduce memory. It is annoying that there's no easy way to find the corresponding VarDeclaration of a Parameter, so I'll pass it into checkParamArgumentEscape.

So far it only works for direct @safe errors, and not for a stored AttributeViolation (#13957), which is a future improvement..

@dkorpel dkorpel added the dip1000 memory safety with scope, ref, return label Aug 16, 2022
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @dkorpel! 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

Auto-close Bugzilla Severity Description
23295 enhancement [dip1000] explain why scope inference failed

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#14373"

@dkorpel dkorpel marked this pull request as ready for review August 16, 2022 13:41
@dkorpel
Copy link
Contributor Author

dkorpel commented Aug 16, 2022

@Geod24 We briefly discussed this in London after the foundation meeting.

compiler/src/dmd/escape.d Outdated Show resolved Hide resolved
@dkorpel dkorpel force-pushed the scope-infer-diag branch 2 times, most recently from 54b1278 to 54ac37a Compare August 17, 2022 13:10
}

/// Called by `deinitializeDMD` to deinitialize the escape state.
static void deinitialize()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there really any point in having both these functions? Can't we have just the deinitalize one and skip calling initialize? If not, can't we give it a more generic name like reset ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it consistent with the other aggregates in initDMD and deinitializeDMD.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's now a single reset function

@dkorpel dkorpel force-pushed the scope-infer-diag branch 2 times, most recently from 31e8fd8 to f30e360 Compare August 18, 2022 11:42
@dlang-bot dlang-bot merged commit 9df6746 into dlang:master Aug 19, 2022
@dkorpel dkorpel deleted the scope-infer-diag branch August 19, 2022 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dip1000 memory safety with scope, ref, return Merge:auto-merge Severity:Enhancement
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants