Skip to content

Commit c316ed2

Browse files
authored
workaround D dips bugs (#207)
* fix small string * workaround dlang dips bugs
1 parent 52c6ef1 commit c316ed2

File tree

8 files changed

+36
-26
lines changed

8 files changed

+36
-26
lines changed

source/mir/algorithm/iteration.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,13 +503,13 @@ scope const:
503503
Сount bits until set bit count is reached. Works with ndslices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation).
504504
Returns: bit count if set bit count is reached or `-1` otherwise.
505505
+/
506-
sizediff_t nBitsToCount(Field, I)(scope Slice!(FieldIterator!(BitField!(Field, I))) bitSlice, size_t count)
506+
sizediff_t nBitsToCount(Field, I)(Slice!(FieldIterator!(BitField!(Field, I))) bitSlice, size_t count)
507507
{
508508
return BitSliceAccelerator!(Field, I)(bitSlice).nBitsToCount(count);
509509
}
510510

511511
///ditto
512-
sizediff_t nBitsToCount(Field, I)(scope Slice!(RetroIterator!(FieldIterator!(BitField!(Field, I)))) bitSlice, size_t count)
512+
sizediff_t nBitsToCount(Field, I)(Slice!(RetroIterator!(FieldIterator!(BitField!(Field, I)))) bitSlice, size_t count)
513513
{
514514
import mir.ndslice.topology: retro;
515515
return BitSliceAccelerator!(Field, I)(bitSlice.retro).retroNBitsToCount(count);
@@ -1071,7 +1071,7 @@ template eachUploPair(alias fun, bool includeDiagonal = false)
10711071
Params:
10721072
matrix = Square matrix.
10731073
+/
1074-
auto eachUploPair(Iterator, SliceKind kind)(scope Slice!(Iterator, 2, kind) matrix)
1074+
auto eachUploPair(Iterator, SliceKind kind)(Slice!(Iterator, 2, kind) matrix)
10751075
in
10761076
{
10771077
assert(matrix.length!0 == matrix.length!1, "matrix must be square.");

source/mir/interpolate/constant.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ template constant(T, size_t N = 1, FirstGridIterator = immutable(T)*, NextGridIt
8282
+/
8383
Constant!(T, N, GridIterators) constant(yIterator, SliceKind ykind)(
8484
GridVectors grid,
85-
scope Slice!(yIterator, 1, ykind) values
85+
Slice!(yIterator, 1, ykind) values
8686
) pure @trusted
8787
{
8888
static if (__VERSION__ >= 2085) import core.lifetime: move; else import std.algorithm.mutation: move;

source/mir/interpolate/linear.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ template linear(T, size_t N = 1, FirstGridIterator = immutable(T)*, NextGridIter
5858
+/
5959
Linear!(T, N, GridIterators) linear(yIterator, SliceKind ykind)(
6060
GridVectors grid,
61-
scope Slice!(yIterator, N, ykind) values,
61+
Slice!(yIterator, N, ykind) values,
6262
) pure @trusted
6363
{
6464
static if (__VERSION__ >= 2085) import core.lifetime: move; else import std.algorithm.mutation: move;

source/mir/interpolate/pchip.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ template pchip(T, size_t N = 1, FirstGridIterator = immutable(T)*, NextGridItera
4646
+/
4747
@fmamath Spline!(T, N, GridIterators) pchip(yIterator, SliceKind ykind)(
4848
GridVectors grid,
49-
scope Slice!(yIterator, N, ykind) values) @safe
49+
Slice!(yIterator, N, ykind) values) @safe
5050
{
5151
static if (__VERSION__ >= 2085) import core.lifetime: move; else import std.algorithm.mutation: move;
5252
auto ret = Spline!T(grid);
@@ -133,9 +133,9 @@ Constraints:
133133
`points`, `values`, and `slopes` must have the same length >= 3
134134
+/
135135
void pchipSlopes(IG, IV, IS, SliceKind gkind, SliceKind vkind, SliceKind skind)(
136-
scope Slice!(IG, 1, gkind) points,
137-
scope Slice!(IV, 1, vkind) values,
138-
scope Slice!(IS, 1, skind) slopes) @trusted
136+
Slice!(IG, 1, gkind) points,
137+
Slice!(IV, 1, vkind) values,
138+
Slice!(IS, 1, skind) slopes) @trusted
139139
{
140140
if (points.length < 3)
141141
assert(0);

source/mir/interpolate/polynomial.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Lagrange!(T, maxDerivative) lagrange(uint maxDerivative = 0, T, X)(scope const T
7676

7777
/// ditto
7878
Lagrange!(Unqual!(Slice!(YIterator, 1, ykind).DeepElement), maxDerivative)
79-
lagrange(uint maxDerivative = 0, XIterator, SliceKind xkind, YIterator, SliceKind ykind)(scope Slice!(XIterator, 1, xkind) x, scope Slice!(YIterator, 1, ykind) y) @trusted
79+
lagrange(uint maxDerivative = 0, XIterator, SliceKind xkind, YIterator, SliceKind ykind)(Slice!(XIterator, 1, xkind) x, Slice!(YIterator, 1, ykind) y) @trusted
8080
if (maxDerivative < 16)
8181
{
8282
alias T = Unqual!(Slice!(YIterator, 1, ykind).DeepElement);
@@ -188,7 +188,7 @@ scope const:
188188
const idx = tuple[0];
189189
const grid = _grid[].sliced;
190190
const inversedBarycentricWeights = _inversedBarycentricWeights[].sliced;
191-
scope Slice!(const(T)*)[derivative + 1] values;
191+
Slice!(const(T)*)[derivative + 1] values;
192192
foreach (i; Iota!(derivative + 1))
193193
values[i] = _normalizedValues[i][].sliced;
194194
const T[2] pd = [
@@ -252,7 +252,7 @@ scope const:
252252
+/
253253
pragma(inline, false)
254254
@nogc
255-
RCArray!(immutable T) inversedBarycentricWeights(T)(scope Slice!(const(T)*) x)
255+
RCArray!(immutable T) inversedBarycentricWeights(T)(Slice!(const(T)*) x)
256256
if (isFloatingPoint!T)
257257
{
258258
const n = x.length;

source/mir/interpolate/spline.d

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ template spline(T, size_t N = 1, FirstGridIterator = immutable(T)*, NextGridIter
348348
+/
349349
Spline!(T, N, GridIterators) spline(yIterator, SliceKind ykind)(
350350
GridVectors grid,
351-
scope Slice!(yIterator, N, ykind) values,
351+
Slice!(yIterator, N, ykind) values,
352352
SplineBoundaryType typeOfBoundaries = SplineBoundaryType.notAKnot,
353353
in T valueOfBoundaryConditions = 0,
354354
)
@@ -367,7 +367,7 @@ template spline(T, size_t N = 1, FirstGridIterator = immutable(T)*, NextGridIter
367367
+/
368368
Spline!(T, N, GridIterators) spline(yIterator, SliceKind ykind)(
369369
GridVectors grid,
370-
scope Slice!(yIterator, N, ykind) values,
370+
Slice!(yIterator, N, ykind) values,
371371
SplineBoundaryCondition!T boundaries,
372372
)
373373
{
@@ -386,7 +386,7 @@ template spline(T, size_t N = 1, FirstGridIterator = immutable(T)*, NextGridIter
386386
+/
387387
Spline!(T, N, GridIterators) spline(yIterator, SliceKind ykind)(
388388
GridVectors grid,
389-
scope Slice!(yIterator, N, ykind) values,
389+
Slice!(yIterator, N, ykind) values,
390390
SplineBoundaryCondition!T rBoundary,
391391
SplineBoundaryCondition!T lBoundary,
392392
)
@@ -492,7 +492,7 @@ struct Spline(F, size_t N = 1, FirstGridIterator = immutable(F)*, NextGridIterat
492492
Assigns function values to the internal memory.
493493
$(RED For internal use.)
494494
+/
495-
void _values(SliceKind kind, Iterator)(scope Slice!(Iterator, N, kind) values) scope @property @trusted
495+
void _values(SliceKind kind, Iterator)(Slice!(Iterator, N, kind) values) scope @property @trusted
496496
{
497497
assert(values.shape == _data.shape, "'values' should have the same shape as the .gridShape");
498498
pickDataSubslice(_data, 0)[] = values;
@@ -772,10 +772,10 @@ Constraints:
772772
`temp` must have length greater or equal to points less minus one.
773773
+/
774774
void splineSlopes(F, T, IP, IV, IS, SliceKind gkind, SliceKind vkind, SliceKind skind)(
775-
scope Slice!(IP, 1, gkind) points,
776-
scope Slice!(IV, 1, vkind) values,
777-
scope Slice!(IS, 1, skind) slopes,
778-
scope Slice!(T*) temp,
775+
Slice!(IP, 1, gkind) points,
776+
Slice!(IV, 1, vkind) values,
777+
Slice!(IS, 1, skind) slopes,
778+
Slice!(T*) temp,
779779
SplineBoundaryCondition!F lbc,
780780
SplineBoundaryCondition!F rbc,
781781
) @trusted

source/mir/ndslice/slice.d

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,7 @@ public:
25182518
static if (isMutable!DeepElement)
25192519
{
25202520
private void opIndexOpAssignImplSlice(string op, RIterator, size_t RN, SliceKind rkind)
2521-
(scope Slice!(RIterator, RN, rkind) value) scope
2521+
(Slice!(RIterator, RN, rkind) value) scope
25222522
{
25232523
static if (N > 1 && RN == N && kind == Contiguous && rkind == Contiguous)
25242524
{
@@ -2574,7 +2574,7 @@ public:
25742574
Assignment of a value of `Slice` type to a $(B fully defined slice).
25752575
+/
25762576
void opIndexAssign(RIterator, size_t RN, SliceKind rkind, Slices...)
2577-
(scope Slice!(RIterator, RN, rkind) value, Slices slices) scope return
2577+
(Slice!(RIterator, RN, rkind) value, Slices slices) scope return
25782578
if (isFullPureSlice!Slices || isIndexedSlice!Slices)
25792579
{
25802580
auto sl = this.lightScope.opIndex(slices);
@@ -3464,8 +3464,8 @@ private bool _checkAssignLengths(
34643464
size_t LN, size_t RN,
34653465
SliceKind lkind, SliceKind rkind,
34663466
)
3467-
(scope Slice!(LIterator, LN, lkind) ls,
3468-
scope Slice!(RIterator, RN, rkind) rs)
3467+
(Slice!(LIterator, LN, lkind) ls,
3468+
Slice!(RIterator, RN, rkind) rs)
34693469
{
34703470
static if (isInstanceOf!(SliceIterator, LIterator))
34713471
{
@@ -3792,3 +3792,13 @@ version(mir_test) pure nothrow unittest
37923792
Slice!(LightImmutableOf!(double*), 2, Universal) immvalues = (cast(immutable)df).values;
37933793
assert(immvalues[0][0] == 5);
37943794
}
3795+
3796+
version(mir_test) @safe unittest
3797+
{
3798+
import mir.ndslice.allocation;
3799+
auto a = rcslice!double([2, 3], 0);
3800+
auto b = rcslice!double([2, 3], 0);
3801+
a[1, 2] = 3;
3802+
b[] = a;
3803+
assert(a == b);
3804+
}

source/mir/ndslice/sorting.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ template transitionIndex(alias test = "a < b")
486486
v = value to test with. It is passed to second argument.
487487
+/
488488
size_t transitionIndex(Iterator, SliceKind kind, V)
489-
(auto ref scope Slice!(Iterator, 1, kind) slice, auto ref scope const V v)
489+
(auto ref Slice!(Iterator, 1, kind) slice, auto ref scope const V v)
490490
{
491491
size_t first = 0, count = slice.length;
492492
while (count > 0)
@@ -551,7 +551,7 @@ Params:
551551
r = The slice/array to index.
552552
Returns: Index slice/array.
553553
+/
554-
Slice!(I*) makeIndex(I = size_t, alias less = "a < b", Iterator, SliceKind kind)(scope Slice!(Iterator, 1, kind) r)
554+
Slice!(I*) makeIndex(I = size_t, alias less = "a < b", Iterator, SliceKind kind)(Slice!(Iterator, 1, kind) r)
555555
{
556556
import mir.functional: naryFun;
557557
import mir.ndslice.allocation: slice;

0 commit comments

Comments
 (0)