dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Fix issue 21243 - Allow lambdas to return auto ref

Open pbackus opened this issue 3 years ago • 8 comments

Spec PR: https://github.com/dlang/dlang.org/pull/3410

pbackus avatar Sep 19 '22 02:09 pbackus

Thanks for your pull request and interest in making D better, @pbackus! 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
21243 enhancement Allow lambdas to return auto ref

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

dlang-bot avatar Sep 19 '22 02:09 dlang-bot

coverage diff is not 100%, please add a test to fix that.

ghost avatar Sep 20 '22 14:09 ghost

@SixthDot Because of the way the calling code uses lookahead, the line in question (error message under case TOK.auto_: in parseFunctionLiteral) is currently unreachable. I left it in as a defensive measure, so that parseFunctionLiteral will behave sensibly even if the calling code changes. If reviewers prefer, I can change the line to an assert(0); instead of an error message.

pbackus avatar Sep 20 '22 15:09 pbackus

Auto-tester failure is a segfault in this static destructor that occurs non-deterministically when running std.concurrency's test suite. Probably a race between the main thread writing to the __gshared variable scheduler and test threads reading from it in their static destructors. Almost certainly unrelated to this PR.

pbackus avatar Sep 20 '22 16:09 pbackus

Is this, https://github.com/dlang/phobos/pull/8579, the fix you to that race conditions?

ljmf00 avatar Sep 20 '22 21:09 ljmf00

@ljmf00 Yes.

pbackus avatar Sep 20 '22 21:09 pbackus

Force-pushed to re-run now that the race condition has (hopefully) been fixed.

pbackus avatar Sep 21 '22 11:09 pbackus

Buildkite is having availability issues; force-pushed to re-run again.

pbackus avatar Sep 21 '22 14:09 pbackus