From d4dd3911235a0169c2cdbd90687f5a00ff47a68f Mon Sep 17 00:00:00 2001 From: Inkrementator <70717315+Inkrementator@users.noreply.github.com> Date: Tue, 18 Feb 2025 23:42:13 +0100 Subject: [PATCH] Remove obsolete workaround (#10641) For resolved bugzilla issue 15777 --- std/algorithm/iteration.d | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/std/algorithm/iteration.d b/std/algorithm/iteration.d index 8a3add3b7..f8e1c05b6 100644 --- a/std/algorithm/iteration.d +++ b/std/algorithm/iteration.d @@ -446,35 +446,21 @@ if (fun.length >= 1) auto map(Range)(Range r) if (isInputRange!(Unqual!Range)) { - import std.meta : AliasSeq, staticMap; + import std.meta : staticMap; + import std.functional : adjoin; alias RE = ElementType!(Range); - static if (fun.length > 1) + + alias _funs = staticMap!(unaryFun, fun); + alias _fun = adjoin!_funs; + + // Once https://issues.dlang.org/show_bug.cgi?id=5710 is fixed + // accross all compilers (as of 2020-04, it wasn't fixed in LDC and GDC), + // this validation loop can be moved into a template. + foreach (f; _funs) { - import std.functional : adjoin; - import std.meta : staticIndexOf; - - alias _funs = staticMap!(unaryFun, fun); - alias _fun = adjoin!_funs; - - // Once https://issues.dlang.org/show_bug.cgi?id=5710 is fixed - // accross all compilers (as of 2020-04, it wasn't fixed in LDC and GDC), - // this validation loop can be moved into a template. - foreach (f; _funs) - { - static assert(!is(typeof(f(RE.init)) == void), + static assert(!is(typeof(f(RE.init)) == void), "Mapping function(s) must not return void: " ~ _funs.stringof); - } - } - else - { - alias _fun = unaryFun!fun; - alias _funs = AliasSeq!(_fun); - - // Do the validation separately for single parameters due to - // https://issues.dlang.org/show_bug.cgi?id=15777. - static assert(!is(typeof(_fun(RE.init)) == void), - "Mapping function(s) must not return void: " ~ _funs.stringof); } return MapResult!(_fun, Range)(r);