libsass
libsass copied to clipboard
map-remove() should reject a combination of positional and named keys
In LibSass, map-remove((c: d, e: f), c, $key: e)
currently returns the empty map. It should fail, since the $key
parameter is being passed by both position and name.
Hi!
I'm trying to fullfill this spec (https://github.com/sass/sass-spec/blob/master/spec/core_functions/map/remove.hrx#L155) in https://github.com/scssphp/scssphp/ but as map-remove signature is
map-remove($map, $key...)
this spec is in conflict with
https://github.com/sass/sass-spec/blob/master/spec/non_conformant/scss-tests/091_test_function_var_and_splat_args_pass_through_keywords.hrx and https://github.com/sass/sass-spec/blob/master/spec/non_conformant/scss-tests/072_test_mixin_var_and_splat_args_pass_through_keywords.hrx
that are in both case passing a positionnal argument #1
and a named argument $a
I have the feeling that fullfilling all 3 specs needs to accept named and positionnal if only one argument in the function definition, which seems a bit inconsistant
@Cerdic the trick is that the implementation actually achieves that through an overloaded function rather than single signature: https://github.com/sass/dart-sass/blob/3d39f22cbff8097c212dd90a507c22dd808c3f19/lib/src/functions/map.dart#L110-L118
So this is indeed something that cannot be achieved for userland functions (which cannot have overloads)