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

Let safety of cartesianProduct.Result.popFront be inferred #7519

Merged
merged 2 commits into from Jun 18, 2020

Conversation

John-Colvin
Copy link
Contributor

I don't believe #7440 was the correct thing to do. @Geod24

@dlang-bot
Copy link
Contributor

dlang-bot commented Jun 6, 2020

Thanks for your pull request and interest in making D better, @John-Colvin! 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
20943 regression std.algorithm.setops.cartesianProduct fails for ranges with @System popFront

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 "stable + phobos#7519"

@PetarKirov
Copy link
Member

Is there a @safe unit test to verify that this can be used from @safe code? If yes, than I'm fine with merging, though I wonder if you hit some problem in practice which prompted you to propose this change.

@Geod24
Copy link
Member

Geod24 commented Jun 8, 2020

Indeed, #7440 was only applying a pre-existing comment, but on second look, that comment was wrong. There are plenty of @safe unittest, but no @system one. Could you add one @John-Colvin ? From what I see, having a @system popFront would do it.

@John-Colvin
Copy link
Contributor Author

Indeed, #7440 was only applying a pre-existing comment, but on second look, that comment was wrong. There are plenty of @safe unittest, but no @system one. Could you add one @John-Colvin ? From what I see, having a @system popFront would do it.

done

Also re-targeted to stable because it's a regression

@Geod24
Copy link
Member

Geod24 commented Jun 17, 2020

Style check failed:


generated/dscanner-9364d6f15f4a610fda49a693dbc18608bfc701bb/dsc --config .dscanner.ini --styleCheck etc std -I.
--
  | std/algorithm/setops.d(557:1)[warn]: A unittest should be annotated with at least @safe or @system
  | std/algorithm/setops.d(566:13)[warn]: Zero-parameter '@property' function should be marked 'const', 'inout', or 'immutable'.
  | std/algorithm/setops.d(571:14)[warn]: Zero-parameter '@property' function should be marked 'const', 'inout', or 'immutable'.


@John-Colvin
Copy link
Contributor Author

Style check failed:


generated/dscanner-9364d6f15f4a610fda49a693dbc18608bfc701bb/dsc --config .dscanner.ini --styleCheck etc std -I.
--
  | std/algorithm/setops.d(557:1)[warn]: A unittest should be annotated with at least @safe or @system
  | std/algorithm/setops.d(566:13)[warn]: Zero-parameter '@property' function should be marked 'const', 'inout', or 'immutable'.
  | std/algorithm/setops.d(571:14)[warn]: Zero-parameter '@property' function should be marked 'const', 'inout', or 'immutable'.

The first one seems fair enough.

The fact that the second 2 apply to unittests is madness, because it means phobos can't test functions like them!

@Geod24
Copy link
Member

Geod24 commented Jun 18, 2020

True, but why would you use @property in the first place ?

@John-Colvin
Copy link
Contributor Author

True, but why would you use @property in the first place ?

That's a reasonable question, but even if we assume one shouldn't use it, it's all over people's code for historical reasons or because of misunderstanding. You can't easily remove it because it affects typeof and __traits(compiles, ...).

@Geod24
Copy link
Member

Geod24 commented Jun 18, 2020

it's all over people's code

Yeah, maybe we should add a check that no new usage is introduced.

You can't easily remove it

Is there any code in Phobos that requires the usage of @property ? I know of the minor difference it introduces, but I'd imagine any reasonable generic utility would not depend on @property. Perhaps I am being too hopeful.

@n8sh
Copy link
Member

n8sh commented Jun 18, 2020

Is there any code in Phobos that requires the usage of @property? I

There was at least some code that didn't work unless front was @property.

@Geod24 Geod24 merged commit b8e90f4 into dlang:stable Jun 18, 2020
@John-Colvin John-Colvin deleted the patch-26 branch June 19, 2020 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants