From 3f301a065c438f53d39599e67d9f3ef8337398f4 Mon Sep 17 00:00:00 2001 From: jmh530 Date: Sun, 18 Jan 2026 21:28:33 -0500 Subject: [PATCH 1/2] Enhance UTs related to lightScope and labels --- source/mir/ndslice/slice.d | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/source/mir/ndslice/slice.d b/source/mir/ndslice/slice.d index f47180aa..01ddb3c5 100644 --- a/source/mir/ndslice/slice.d +++ b/source/mir/ndslice/slice.d @@ -4170,7 +4170,26 @@ unittest // For compilation of immutable lightScope overload with auto return type inference alias R = typeof(x.lightScope); // Ensure `R` is a Slice - static assert(is(T : Slice!(Iterator, 2, Contiguous), Iterator)); + static assert(is(R : Slice!(Iterator, 2, Contiguous), Iterator)); // Ensure staticMap working properly static assert(is(R.Labels[0] == staticMap!(LightImmutableOfLightConstOf, int*)[0])); } + +// Additional test for fix on issue #470 +@safe pure nothrow @nogc +version(mir_ndslice_test) +unittest +{ + import mir.ndslice.slice: LightImmutableOfLightConstOf, Slice, Contiguous; + import std.meta: staticMap; + // Make `x` immutable with label to ensure trigger of staticMap with immutable lightScope overload + alias T = Slice!(int*, 2, Contiguous, int*, long*); + immutable T x = T.init; + // For compilation of immutable lightScope overload with auto return type inference + alias R = typeof(x.lightScope); + // Ensure `R` is a Slice + static assert(is(R : Slice!(Iterator, 2, Contiguous), Iterator)); + // Ensure staticMap working properly + static assert(is(R.Labels[0] == staticMap!(LightImmutableOfLightConstOf, int*, long*)[0])); + static assert(is(R.Labels[1] == staticMap!(LightImmutableOfLightConstOf, int*, long*)[1])); +} From f523cff25d9fecd945eaba6fdeb5c1b9d255531f Mon Sep 17 00:00:00 2001 From: jmh530 Date: Sun, 18 Jan 2026 22:14:24 -0500 Subject: [PATCH 2/2] Replace tabs with spaces --- source/mir/ndslice/slice.d | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/source/mir/ndslice/slice.d b/source/mir/ndslice/slice.d index 01ddb3c5..fa8f9e75 100644 --- a/source/mir/ndslice/slice.d +++ b/source/mir/ndslice/slice.d @@ -4163,16 +4163,16 @@ version(mir_ndslice_test) unittest { import mir.ndslice.slice: LightImmutableOfLightConstOf, Slice, Contiguous; - import std.meta: staticMap; - // Make `x` immutable with label to ensure trigger of staticMap with immutable lightScope overload - alias T = Slice!(int*, 2, Contiguous, int*); - immutable T x = T.init; - // For compilation of immutable lightScope overload with auto return type inference - alias R = typeof(x.lightScope); - // Ensure `R` is a Slice - static assert(is(R : Slice!(Iterator, 2, Contiguous), Iterator)); - // Ensure staticMap working properly - static assert(is(R.Labels[0] == staticMap!(LightImmutableOfLightConstOf, int*)[0])); + import std.meta: staticMap; + // Make `x` immutable with label to ensure trigger of staticMap with immutable lightScope overload + alias T = Slice!(int*, 2, Contiguous, int*); + immutable T x = T.init; + // For compilation of immutable lightScope overload with auto return type inference + alias R = typeof(x.lightScope); + // Ensure `R` is a Slice + static assert(is(R : Slice!(Iterator, 2, Contiguous), Iterator)); + // Ensure staticMap working properly + static assert(is(R.Labels[0] == staticMap!(LightImmutableOfLightConstOf, int*)[0])); } // Additional test for fix on issue #470 @@ -4181,15 +4181,15 @@ version(mir_ndslice_test) unittest { import mir.ndslice.slice: LightImmutableOfLightConstOf, Slice, Contiguous; - import std.meta: staticMap; - // Make `x` immutable with label to ensure trigger of staticMap with immutable lightScope overload - alias T = Slice!(int*, 2, Contiguous, int*, long*); - immutable T x = T.init; - // For compilation of immutable lightScope overload with auto return type inference - alias R = typeof(x.lightScope); - // Ensure `R` is a Slice - static assert(is(R : Slice!(Iterator, 2, Contiguous), Iterator)); - // Ensure staticMap working properly - static assert(is(R.Labels[0] == staticMap!(LightImmutableOfLightConstOf, int*, long*)[0])); - static assert(is(R.Labels[1] == staticMap!(LightImmutableOfLightConstOf, int*, long*)[1])); + import std.meta: staticMap; + // Make `x` immutable with label to ensure trigger of staticMap with immutable lightScope overload + alias T = Slice!(int*, 2, Contiguous, int*, long*); + immutable T x = T.init; + // For compilation of immutable lightScope overload with auto return type inference + alias R = typeof(x.lightScope); + // Ensure `R` is a Slice + static assert(is(R : Slice!(Iterator, 2, Contiguous), Iterator)); + // Ensure staticMap working properly + static assert(is(R.Labels[0] == staticMap!(LightImmutableOfLightConstOf, int*, long*)[0])); + static assert(is(R.Labels[1] == staticMap!(LightImmutableOfLightConstOf, int*, long*)[1])); }