Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dip1000.mak
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ aa[std.net.curl]=-dip1000 # TODO have a look into open https://github.com/dlang/
aa[std.net.isemail]=-dip1000

aa[std.range.interfaces]=-dip1000
aa[std.range.package]=-dip25 # reference to local variable a / b assigned to non-scope parameter _param_1 / _param_2 calling std.range.chooseAmong!(RefAccessRange, RefAccessRange).chooseAmong
aa[std.range.package]=-dip1000
aa[std.range.primitives]=-dip1000

aa[std.regex.package]=-dip1000
Expand Down
22 changes: 11 additions & 11 deletions std/range/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -1713,25 +1713,25 @@ if (Ranges.length >= 2
assert(c[0] == 42);
}

@safe nothrow pure @nogc unittest
@safe nothrow pure /*@nogc*/ unittest
{
static struct RefAccessRange
{
int[] r;
ref front() @property { return r[0]; }
ref back() @property { return r[$ - 1]; }
scope ref front() @property { return r[0]; }
scope ref back() @property { return r[$ - 1]; }
void popFront() { r = r[1 .. $]; }
void popBack() { r = r[0 .. $ - 1]; }
auto empty() @property { return r.empty; }
ref opIndex(size_t i) { return r[i]; }
scope ref opIndex(size_t i) { return r[i]; }
auto length() @property { return r.length; }
alias opDollar = length;
auto save() { return this; }
}
static assert(isRandomAccessRange!RefAccessRange);
static assert(isRandomAccessRange!RefAccessRange);
int[4] a = [4, 3, 2, 1];
int[2] b = [6, 5];
int[] a = [4, 3, 2, 1];
int[] b = [6, 5];
auto c = chooseAmong(0, RefAccessRange(a[]), RefAccessRange(b[]));
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. [] is done here to create a slice of the static array (it's not needed for dynamic arrays, they are already slices)
  2. It feels like things like this here should be possible with DIP1000 :/

However, I looked at this problem myself two days ago and I couldn't find a better solution either.
So I think version(DIP1000) {} else at the top of the unittest might be better, because then we know that this still needs a look at, but aren't blocked by it.
What do you or others think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. I tried both, a and a[] etc. and they both work; don't know why I added superfluous [] again, probably to be minimally invasive, expecting a change back to static arrays

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, in order not to lose the @nogc and static array testing, "version(DIP1000) {} else" will be better, but I'll wait for a go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe https://github.com/D-Programming-Deimos/openssl needs an update to openssl 1.0.2g? That's what I have on my Kubuntu system since the day before yesterday

Copy link
Contributor

Choose a reason for hiding this comment

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

How is this related? (and most likely - I think the Deimos packages aren't super-actively maintained)

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 relates to my reasoning why continuous-integration/jenkins/pr-merge might have failed:
...
Fetching openssl 1.1.6+1.0.1g (getting selected version)...
Package diet-ng can be upgraded from 1.4.3 to 1.4.5.
Package taggedalgebraic can be upgraded from 0.10.8 to 0.10.11.
Package stdx-allocator can be upgraded from 2.77.0 to 2.77.1.
Package vibe-d can be upgraded from 0.8.3-alpha.3 to 0.8.3.
Package memutils can be upgraded from 0.4.9 to 0.4.10.
Package vibe-core can be upgraded from 1.4.0-alpha.1 to 1.4.0.
Package eventcore can be upgraded from 0.8.27 to 0.8.34.
Use "dub upgrade" to perform those changes.
Non-optional dependency openssl of botan not found in dependency tree!?.
script returned exit code 2

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh that's an old Dub bug, see e.g.

dlang/dub#1180
dlang/dub#1112
dlang/dub#986

Unfortunately Jenkins with all the projects it tests is quite "vulnerable" to random failures.
OTOH it has caught tons of regressions, so nothing is for free :/

Anyhow I restarted the job.
BTW feel free to ping me on Slack or the people in #phobos when you run into this again.


void refFunc(ref int a, int target) { assert(a == target); }
Expand Down Expand Up @@ -5052,21 +5052,21 @@ nothrow pure @system unittest
assert(z2.front == tuple(0,1));
}

@nogc nothrow pure @safe unittest
/*@nogc*/ nothrow pure @safe unittest
{
// Test zip's `back` and `length` with non-equal ranges.
static struct NonSliceableRandomAccess
{
private int[] a;
@property ref front()
@property scope ref front()
{
return a.front;
}
@property ref back()
@property scope ref back()
{
return a.back;
}
ref opIndex(size_t i)
scope ref opIndex(size_t i)
{
return a[i];
}
Expand Down Expand Up @@ -5107,7 +5107,7 @@ nothrow pure @system unittest
static assert(!hasSlicing!NonSliceableRandomAccess);
static foreach (iteration; 0 .. 2)
{{
int[5] data = [101, 102, 103, 201, 202];
int[] data = [101, 102, 103, 201, 202];
static if (iteration == 0)
{
auto r1 = NonSliceableRandomAccess(data[0 .. 3]);
Expand Down