-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
map
shouldn't care whether proc arg is cdecl
#8303
Comments
so the root problem is that proc map*[T, S](s: openArray[T], op: proc (x: T): S ): seq[S] =
newSeq(result, s.len)
for i in 0 ..< s.len:
result[i] = op(s[i]) However this works if we use instead: proc map3*[Fun, T](s: openArray[T], op: Fun ): auto =
result = newSeq[type(op(s[0]))](s.len)
for i in 0 ..< s.len:
result[i] = op(s[i]) |
Error: type mismatch
triggered on travis/appveyor but not locallyError: type mismatch
triggered on travis/appveyor but not locally; caused by map
overly restrictive
Error: type mismatch
triggered on travis/appveyor but not locally; caused by map
overly restrictivemap
shouldn't care whether proc arg is cdecl
map
shouldn't care whether proc arg is cdeclmap
shouldn't care whether proc arg is cdecl
@Araq can sigmatch ignore {.cdecl.}, assuming it's only used for name mangling of a declaration? |
Oh no, |
I was misled by this comment: # since we'll be loading the dynlib symbols dynamically, we must use
# a calling convention that doesn't introduce custom name mangling
# cdecl is the default - the user can override this explicitly but the manual indeed says:
|
reduced from a mysterious error I was seeing here https://travis-ci.org/nim-lang/Nim/jobs/402492005 for this PR: #8272
The code that caused it:
it worked if I wrote instead:
After further investigating and reducing the error it boils down to:
map
somehow can't be used with a proc that's marked as{.rtl.}
(or, after reducing further from the definition of rtl in system/inclrtl, if it's marked as{. exportc: "nimrtl_$1", dynlib .}
)Isn't that a bug?
it makes things work locally but fail on travis/appveyor.
(or fail locally when run with
nim c -o:app --define:createNimRtl --app:lib test.nim
instead ofnim c -o:app --app:lib test.nim
(when something uses {.rtl.}))(or fail when using
nim c -o:app bugs/t50_app_lib_map.nim
when something uses{. exportc: "nimrtl_$1", dynlib .}
)[EDIT] workaround in some cases see https://github.com/nim-lang/Nim/issue_comments#issuecomment-411508903
The text was updated successfully, but these errors were encountered: