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

Library errors with devel after stricteffects enabled #56

Closed
pietroppeter opened this issue Oct 31, 2022 · 1 comment
Closed

Library errors with devel after stricteffects enabled #56

pietroppeter opened this issue Oct 31, 2022 · 1 comment

Comments

@pietroppeter
Copy link
Contributor

compiling the first readme example with current devel throws an error.

example file:

import toml_serialization

let rawToml = """
[server]
  name = "TOML Server"
  port = 8005
"""
var x = Toml.decode(rawToml, string, "server.name")
assert x == "TOML Server"

error reported:

C:\Users\ppeterlongo\.nimble\pkgs\toml_serialization-0.2.3\toml_serialization\types.nim(172, 25) template/generic instantiation of `==` from here
C:\Users\ppeterlongo\.choosenim\toolchains\nim-#devel\lib\system\comparisons.nim(309, 6) Error: '==' can have side effects
sideEffect` '=='
>> C:\Users\ppeterlongo\.nimble\pkgs\toml_serialization-0.2.3\toml_serialization\types.nim(144, 6) Hint: '==' called by '=='

see also nim-lang/Nim#20697

it seems adding a noSideEffects annotation to == should fix this. I will check if that is indeed the case and come back with a PR.

@pietroppeter
Copy link
Contributor Author

the reported error is indeed fixed by annotation all == with noSideEffects, a new error pops out:

C:\Users\ppeterlongo\Documents\toml_serialization\toml_serialization.nim(112, 15) template/generic instantiation of `readValue` from here
C:\Users\ppeterlongo\.nimble\pkgs\serialization-0.1.0\serialization.nim(29, 9) template/generic instantiation of `readValue` from here
C:\Users\ppeterlongo\Documents\toml_serialization\toml_serialization\reader.nim(416, 29) template/generic instantiation from here
C:\Users\ppeterlongo\Documents\toml_serialization\toml_serialization\reader.nim(430, 15) Error: parseValue(r.lex, value) can raise an unlisted exception: Exception

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

1 participant