114 Commits

Author SHA1 Message Date
jangko
7cb0c31cb2
Remove unused type in test code 2023-12-14 10:36:15 +07:00
jangko
13be296cf0
Remove unused debugging code 2023-12-14 10:09:01 +07:00
Etan Kissling
543b2f3dd0
workaround --mm:orc codegen bug with {.noSideEffect.} (#63)
Inlining `template` that uses `{.noSideEffect.}` without a `block` can
lead to invalid codegen that contains double-frees. Wrap problematic
instances with `block` to prevent issues in `libnimbus_lc` wasm (orc).
2023-10-27 15:12:07 +02:00
Etan Kissling
4bdbc29e54
add {.raises.} annotation to writeValue (#62)
Tag `writeValue` overrides with `{.raises: [IOError].}`.
2023-08-19 12:24:46 +02:00
Etan Kissling
384eb2561e
workaround for NimYAML issue (#61)
Somehow, creating the `FieldType` as a type messes with the macros used
in `NimYAML`. Inline `GetFieldType` to avoid the problem.

https://github.com/status-im/nimbus-eth2/pull/5043#issuecomment-1584219098

```
./nimbus-eth2/tests/consensus_spec/test_fixture_light_client_sync.nim(126, 8) template/generic instantiation of `test` from here
./nimbus-eth2/tests/consensus_spec/test_fixture_light_client_sync.nim(146, 20) template/generic instantiation of `load` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1368, 14) template/generic instantiation of `construct` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1343, 19) template/generic instantiation of `constructChild` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1168, 20) template/generic instantiation of `constructObject` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(927, 25) template/generic instantiation of `constructObjectDefault` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(921, 31) template/generic instantiation of `ensureAllFieldsPresent` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(681, 29) Error: type mismatch: got <NimNode>
but expected one of:
proc none(T: typedesc): Option[T]
  first type mismatch at position: 1
  required type for T: typedesc
  but expression 'nil' is of type: NimNode
proc none[T](): Option[T]
  first type mismatch at position: 1
  extra argument given
template none(O: type Opt; T: type): Opt[T]
  first type mismatch at position: 1
  required type for O: typedesc[Opt]
  but expression 'nil' is of type: NimNode

expression: none(nil)
make: *** [consensus_spec_tests_minimal] Error 1
```
2023-06-16 07:44:39 +02:00
tersec
7e8d46ccf9
make nimble file consistent with test matrix (#60) 2023-06-14 23:21:40 +00:00
Etan Kissling
c23b49910d
avoid implicit synthesis of CaseTransition (#59)
Transitioning the case of a case object without full reinitialization
leads to undefined behaviour. Don't do such transitions implicitly,
and require explicit `readValue` override for such types in those cases.
2023-06-12 21:17:15 +00:00
jangko
f0860e1c25
bump version to 0.2.0 2023-06-05 15:21:09 +07:00
jangko
9f56a0738c
More fix to exception tracking and generic_suite
This fixes required by nim-json-serialization to pass test
with nim devel since we drop support for nim 1.2 and 1.4
2023-06-05 15:18:52 +07:00
jangko
09b131c919
another attempt to reduce compiler warnings 2023-06-05 11:43:19 +07:00
jangko
b7c085fc5c
remove Defect raises from makeFieldReadersTable 2023-06-05 09:01:07 +07:00
jangko
770f2a48ec
remove nim 1.2 and nim 1.4 from ci 2023-06-05 08:59:14 +07:00
jangko
a1c77b859f
remove nimble.lock 2023-06-05 08:58:47 +07:00
jangko
bc46b4c1c1
readFieldIMPL workaround when orc enabled 2023-04-17 09:23:17 +07:00
jangko
845bed4478
remove appveyor and travis scripts
also remove their badges from readme.md
2023-04-14 21:56:02 +07:00
jangko
4959f1f983
fix makeFieldReadersTable crash when orc enabled.
also remove duplicated readFieldIMPL template
see https://github.com/status-im/nim-toml-serialization/issues/62
and https://github.com/status-im/nim-toml-serialization/issues/63
2023-04-14 21:18:23 +07:00
tersec
3c6afa3614
test both refc and ORC in post-1.6 Nim versions (#52) 2023-04-13 23:13:29 +00:00
tersec
2d8883dc7f
Use Nim 2.0 in CI (#51) 2023-04-07 12:39:58 +00:00
jangko
5b7cea55ef
fix nim devel error: 'result' requires explicit initialization 2023-02-08 09:37:34 +07:00
jangko
bddc539012
switch CI to the supported version of ubuntu 2023-02-01 14:11:07 +07:00
jangko
9059409cda
upgrade github actions to v3 2023-02-01 12:01:59 +07:00
jangko
257e2e02eb
nim devel workaround 2023-01-31 08:59:43 +07:00
Jacek Sieka
d77417cba6
Merge pull request #46 from status-im/normalise-nimble
normalise nimble
2022-11-23 17:03:35 +01:00
Jacek Sieka
b5e3f82519
ignore build 2022-11-23 16:30:49 +01:00
Jacek Sieka
508c777332
normalise nimble 2022-11-23 16:23:20 +01:00
Tanguy
60a5bd8ac0
Fix for nim devel (#44) 2022-11-07 16:42:48 +01:00
Zahary Karadjov
493d18b829
Add findFieldIdx 2022-07-14 15:08:22 +03:00
Ivan Yonchovski
9eb8807706
Add setup files (#42) 2022-07-12 21:35:24 +03:00
Zahary Karadjov
1d33fa3ced
Fix the build on Nim 1.6 (which doesn't allow derefencing nil) 2022-06-19 13:04:38 +03:00
jangko
90276771dc
workaround to allow compile time deserialization
with this refactoring, deserialization can be enabled for VM context
see toml-serialization for example
2022-06-19 15:18:55 +07:00
Etan Kissling
d856d6ece5
Update readme for current API
The README file was describing an outdated way of defining serialization
formats. It was updated accordingly to match the current API.

- New format declaration using `setReader` and `setWriter`
  and mandatory `PreferredOutput` type declaration,
  as introduced in f9a1121b8733eb75e624ab59f8d79e707f15f76f.
- Removal of `fileExt` declaration, which was never implemented.
- Removal of format-specific `dontSerialize` pragma
  as well as the `serialize` pragma, which were never implemented.
- Rename `serializedFields` macro to `setSerializedFields`,
  to keep up with 60613bac5db2bd7914d484874201f31b3f318165.
- Remove rename functionality in `setSerializedFields`,
  which was never implemented.
- A couple updated argument lists and typo corrections.
2022-06-19 15:18:41 +07:00
narimiran
971a76e86d move -d:nimRawSetjmp to nim.cfg
Refs https://github.com/status-im/nimbus-build-system/issues/44
2022-06-19 14:59:20 +07:00
Zahary Karadjov
7d64c0d843
FieldTag no longer requires specifying the FieldType 2022-06-18 13:29:32 +03:00
Zahary Karadjov
9631fbd1c8
Better default behavior for SerializationError.formatMsg 2022-03-09 17:15:50 +02:00
Ștefan Talpalaru
37bc0db558
CI: test with multiple Nim versions (#39) 2022-01-06 19:36:22 +01:00
Jacek Sieka
11a8aa64d2 enable --styleCheck:usages 2021-12-07 00:33:04 +02:00
Jacek Sieka
fcd0eadadd clean up imports, unittest2 2021-08-16 15:09:31 +03:00
Ștefan Talpalaru
5213d397f9
CI: refactor Nim compiler caching (#35) 2021-06-03 01:59:50 +02:00
Zahary Karadjov
f9a1121b87
Make the flavors support optional when defining formats
Other changes:

* The format declarations have been broken down in multiple
  parts. This makes it possible to structure the implementation
  libraries in a way such that the format name is accessible even
  when importing only reader or writer modules.

* Flavors lead to more complicated Reader and Writer types.
  Instead of requiring the user to write down long type names
  such as `JsonReader[DefaultFlavor]`, it's now possible to refer
  to the reader and writer type of each format using expressions
  such as `Json.Reader` and `Json.Writer`.

* Fixed a typo (PreferredOutput)
2021-03-19 04:04:14 +02:00
Zahary Karadjov
84ffa54554
Add support for Format flavors 2021-03-18 12:55:50 +02:00
Zahary Karadjov
261de741b7
Revert "Handle record types with when statements"
This reverts commit dfd6e349a62417b7951f17a0afea89a0c11d5ebc.
2021-02-18 23:08:21 +02:00
Zahary Karadjov
32fce5df8d
Revert "Support when statements in records that reuse the same field name in different branches"
This reverts commit 4e2ffe3f6df5b753d7b11fef83cc5ee14f296c1c.
2021-02-18 23:07:52 +02:00
Jacek Sieka
293a987c51 work around broken gc during global init 2021-02-18 22:31:23 +02:00
Zahary Karadjov
4e2ffe3f6d
Support when statements in records that reuse the same field name in different branches 2021-01-06 15:27:28 +02:00
andri lim
217d78a1dc
Merge pull request #31 from status-im/github_action
add github action
2020-12-26 11:35:17 +07:00
jangko
dd115dca5b
add github action 2020-12-24 11:34:38 +07:00
Zahary Karadjov
dfd6e349a6
Handle record types with when statements 2020-12-22 20:24:54 +02:00
jangko
474bdbf49c silence declared but not used warning 2020-08-05 10:08:27 +03:00
Zahary Karadjov
5b11c41731
Handle updates in nim-stew 2020-07-08 00:31:20 +03:00
Zahary Karadjov
e0e51015b7
Handle pragma-annotated field names; Fix #28 2020-06-24 14:08:56 +03:00