Allow let to not have value when using importc (#14258)
* Allow let to not have value when using importc
This allows a let statement with the `{.importc.}` pragma to not be
initialised with a value. This allows us to declare C constants as Nim
lets without putting the value in the Nim code (which can lead to
errors, and requires us to go looking for the value). Fixes #14253
* Proper fix and documentation + changelog entry
* Improve testcase with one from timotheecour
* Add test to verify it working with macros
This commit is contained in:
parent
82f008158c
commit
9acbf99efb
5 changed files with 52 additions and 5 deletions
8
tests/let/timportc2.nim
Normal file
8
tests/let/timportc2.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
discard """
|
||||
errormsg: "'let' symbol requires an initialization"
|
||||
line: "7"
|
||||
"""
|
||||
|
||||
# Test that this still works when not annotated with importc
|
||||
let test: cint
|
||||
echo test
|
||||
Loading…
Add table
Add a link
Reference in a new issue