Closed i582 closed 1 year ago
I don't think nil
should be an assignable value, in unsafe or not.
Where exactly will be the usage of unsafe
then? I think this still has to be made clear.
If you're allowed to assign nil
, then it should only be allowed in an unsafe
block.
The problem here is that the code is assigning nil
to a string field, and that's wrong regardless of unsafe or not. A string can never be nil
in V. It is either empty, or has a valid string, but never nil
since it should still have the string struct, just with empty fields.
I am working on this then.
It should not be allowed for the same reason on any type of struct... arrays, strings, etc.
Describe the bug
Code: https://vosca.dev/p/a0a13d5e07
Expected Behavior
Checker error
Current Behavior
Output:
Everything works well with GCC, however we ran into a problem compiling
v-analyzer
on Windows and Linux as TCC was unable to compile code with such assignment:Thank you @Ekopalypse for help with debug!
Reproduction Steps
Run code above
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.3.4 fc4c431.45f16a2
Environment details (OS name and version, etc.)