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
|
|
@ -122,11 +122,11 @@
|
|||
deallocShared(x.val)
|
||||
x.val = nil
|
||||
```
|
||||
|
||||
- getImpl() on enum type symbols now returns field syms instead of idents. This helps
|
||||
with writing typed macros. Old behavior for backwards compatiblity can be restored
|
||||
with command line switch `--useVersion:1.0`.
|
||||
|
||||
- ``let`` statements can now be used without a value if declared with
|
||||
``importc``/``importcpp``/``importjs``/``importobjc``.
|
||||
- The keyword `from` is now usable as an operator.
|
||||
- Exceptions inheriting from `system.Defect` are no longer tracked with
|
||||
the `.raises: []` exception tracking mechanism. This is more consistent with the
|
||||
|
|
@ -152,7 +152,6 @@ proc mydiv(a, b): int {.raises: [].} =
|
|||
The reason for this is that `DivByZeroDefect` inherits from `Defect` and
|
||||
with `--panics:on` `Defects` become unrecoverable errors.
|
||||
|
||||
|
||||
## Compiler changes
|
||||
|
||||
- Specific warnings can now be turned into errors via `--warningAsError[X]:on|off`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue