Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapIt still can't be used with openArray even after #8543, #8567: fails during bootstrap #8577

Closed
timotheecour opened this issue Aug 8, 2018 · 1 comment · Fixed by #8584

Comments

@timotheecour
Copy link
Member

timotheecour commented Aug 8, 2018

@LemonBoy I was trying to revive my old PR #8272 now that #8543 was merged (Make mapIt work on openArray's #8543) however that PR fails: it was actually kinda confusing since it all works locally (ie when using an already bootstrapped compiler), but the problem is in bootstrap phase:

to reproduce:

git clone https://github.com/nim-lang/Nim
cd Nim
git fetch origin pull/8272/head:pr_quoteShellCommand
git checkout pr_quoteShellCommand
sh build_all.sh # (the new install script I added a few commits ago; irrelevant to this bug though)
/private/tmp/d36/Nim/lib/pure/ospaths.nim(635, 18) template/generic instantiation from here
/private/tmp/d36/Nim/lib/pure/collections/sequtils.nim(680, 14) Error: invalid type: 'openarray[string]' for let

for posterity: this is what I was adding and that was failing during bootstrap

proc quoteShellCommand*(args: openArray[string]): string =
    ## Concatenates and quotes shell arguments `args`
    runnableExamples:
      when defined(posix):
        assert quoteShellCommand(["aaa", "", "c d"]) == "aaa '' 'c d'"
      when defined(windows):
        assert quoteShellCommand(["aaa", "", "c d"]) == "aaa \"\" \"c d\""
    # can't use `map` pending https://github.com/nim-lang/Nim/issues/8303
    result = args.mapIt(quoteShell(it)).join(" ")

links

This was referenced Aug 8, 2018
@timotheecour timotheecour changed the title mapIt still can't be used with openArray even after #8543: fails during bootstrap mapIt still can't be used with openArray even after #8543, #8567: fails during bootstrap Aug 8, 2018
LemonBoy added a commit to LemonBoy/Nim that referenced this issue Aug 8, 2018
Simplify the checks in order not to break the bootstrap and possibly
cover more cases that were previously ignored.

Fixes nim-lang#8577
@LemonBoy
Copy link
Contributor

LemonBoy commented Aug 8, 2018

Uh, that was expected and worked around in sequtils. I've made another PR that should hopefully solve all our problems and give mapIt (and me :) some deserved rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants