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
import strtabs
fails with Error: '[]=' can have side effects
when strictFuncs
is active
#15142
Comments
I found a few other errors:
After removing the
After removing Edit: I tried to attach my script (created with Edit 2: I uploaded the script to https://pastebin.com/BZVYpTQ3 . |
These don't seem to make sense for the purpose of the procs and lead to errors when the `--experimental:strictFuncs` feature is enabled. See also nim-lang#15142
@sschwarzer is this fixed by #15143 ? |
Yes, and a similar bug in the As mentioned, my script (linked above) tells me about more problems in module imports, but I don't know if the pragmas there are wrong or the compiler. Therefore I didn't make any changes to these other modules ( Note that if you fix one of the modules, you may see errors with other modules that were originally imported. For example, |
Well this is not very actionable. Please create PRs that remove the |
I have made the following commits: devel...sschwarzer:strictfuncs_errors2 With these commits, my script (linked above) no longer reports side effect errors with Should I create a single pull request, one per file or something else? Please let me know. |
Single pull request suffices. However, it looks like most of these indicate "strictFuncs" bugs, not stdlib problems. |
Indeed I was wondering if just the side effect analysis for If the annotations are correct - once the side effect analysis is improved - wouldn't it be better not to apply the pull request and instead fix the side effect analysis for It may be that I misunderstood something; in this case please clarify. :-) |
Yes, exactly. |
Ok, what do we do with this ticket now? Strictly speaking, the wrong annotations (in However, it might still be worth to act on this ticket by adding test cases to Nim to be triggered by the faulty Anyway, make up your mind and feel free to close this ticket if you want. :-) By the way, welcome back! :-) |
I'm leaving this open since I'm working on a fix. |
Fixed as far as I can tell. |
These don't seem to make sense for the purpose of the procs and lead to errors when the `--experimental:strictFuncs` feature is enabled. See also nim-lang#15142
If the
--experimental:strictFuncs
option is used, an import ofstrtabs
causes a compile time error.Example
Current Output
Expected Output
The above snippet should compile without error.
Possible Solution
The proc referenced by the compiler is
Note the
noSideEffect
pragma, which doesn't seem to make sense since the point of the proc is to modify the table. So thenoSideEffect
pragma should be removed. (I wonder why it was added to begin with.)Additional Information
The text was updated successfully, but these errors were encountered: