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

Error: undeclared identifier: 'format' when generic calls strformat.fmt #8609

Closed
timotheecour opened this issue Aug 11, 2018 · 1 comment
Closed

Comments

@timotheecour
Copy link
Member

timotheecour commented Aug 11, 2018

t05_fmt_undecl_identifier_format2.nim:

import strformat

proc bar*[T]():string= # ok if non generic
  var a=1
  # result = fmt"{b}" #ok
  result = fmt"{a:#x}" #BUG Error: undeclared identifier: 'format'
import t05_fmt_undecl_identifier_format2
echo bar[int]()

rnim bugs/stdlib/t05_fmt_undecl_identifier_format.nim
nim c --nimcache:/tmp/nim//nimcache/ -o:/tmp/nim//app -r bugs/stdlib/t05_fmt_undecl_identifier_format.nim
/Users/timothee/git_clone/nim/timn/bugs/stdlib/t05_fmt_undecl_identifier_format.nim(5, 6) template/generic instantiation from here
/Users/timothee/git_clone/nim/timn/bugs/stdlib/t05_fmt_undecl_identifier_format2.nim(6, 15) template/generic instantiation from here
/Users/timothee/git_clone/nim/Nim/lib/pure/strformat.nim(278, 5) Error: undeclared identifier: 'format'
format($arg, option, res)

workaround: export strformat.format in t05_fmt_undecl_identifier_format2

@GULPF
Copy link
Member

GULPF commented Aug 11, 2018

Duplicate of #7632

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

No branches or pull requests

2 participants