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 23928 - improve error msg: scope variable s assigned to non… #15249

Merged
merged 1 commit into from May 19, 2023

Conversation

WalterBright
Copy link
Member

…-scope parameter this calling abc

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
23928 enhancement improve error msg: scope variable s assigned to non-scope parameter this calling abc

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

@dlang-bot dlang-bot merged commit bd2bdae into dlang:master May 19, 2023
43 of 44 checks passed
@@ -9,7 +9,7 @@ fail_compilation/test20245.d(27): Error: cannot take address of `scope` variable
fail_compilation/test20245.d(33): Error: reference to local variable `x` assigned to non-scope parameter `ptr` calling `escape`
fail_compilation/test20245.d(34): Error: copying `&x` into allocated memory escapes a reference to parameter `x`
fail_compilation/test20245.d(50): Error: reference to local variable `price` assigned to non-scope `this.minPrice`
fail_compilation/test20245.d(69): Error: reference to local variable `this` assigned to non-scope parameter `msg` calling `this`
fail_compilation/test20245.d(69): Error: reference to local variable `this` calling non-scope member function `this.this()`
Copy link
Member

Choose a reason for hiding this comment

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

This message is hard to understand as it makes no mention of types involved.

Perhaps something like this:

Suggested change
fail_compilation/test20245.d(69): Error: reference to local variable `this` calling non-scope member function `this.this()`
fail_compilation/test20245.d(69): Error: reference to member variable `DontDoThis.content` calling non-scope member function `Exception.this()`

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good suggestion, but the PR has been pulled. File a bugzilla for it?

Copy link
Member

Choose a reason for hiding this comment

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

@WalterBright WalterBright deleted the fix23928 branch May 19, 2023 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants