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
times.parse
causes incorrect proveInit warning
#9901
Comments
I think The reason you get the warning is that |
but |
@GULPF A solution would be to store the month internally as 0-11 and add/subtract 1 in each function of the public API (same for day). Or maybe |
maybe as a workaround for false positives of
|
It fixes this particular issue, but every other non-zero type will still give warnings. This issue isn't only for type T = range[1..2]
import tables
var t = initTable[int, T]()
# lib/pure/collections/tables.nim(325, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]
var s = (1.T)..(2.T)
# lib/system.nim(325, 3) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit] Non-zero types are generally badly supported in the language. No idea how realistic it is, but I sometimes which that these types would be initialized to their lowest value instead of 0. |
@timotheecour Well, proveinit could be disabled just around this line. So we would still have proveInit active while initializing the actual objects that end up in the result @GULPF Right - but maybe a quicker win would be to push/pop proveInit:off around some lines in initTable as well |
* close nim-lang#9901 add testcase * follow advice
Example
Current Output
Compiler warnings:
Expected Output
I'm new to Nim, so I was not expecting this code to output a warning. Quick question to IRC yielded a suggestion that this was likely a bug in
times
orseqUtils
, so here I am.If the warning is not a bug, then may I suggest clearer warning, or suggestion of solution? The current compiler output has me thoroughly confused.
Possible Solution
Well, the solution I am using at the moment is ignore the warning. As discussed above, my solution would be either to fix whatever is causing the warning, or if the warning should stay, make it be easier to understand.
Additional Information
The text was updated successfully, but these errors were encountered: