Open veranovus opened 1 year ago
@medvednikov what should be approach to fix this one? checker error? automatic cloning?
@felipensp a checker error and allow modifying it, like Go does.
I don't think we should do cloning here. What do you think @spytheman
Describe the bug
You can mutate an immutable array if you access it trough a mutable slice, its a fairly simple bug to reproduce.
Code:
Expected Behavior
This code either should not have worked at all or slice should've copied array data and changed that.
Current Behavior
Data of the immutable array changes.
Reproduction Steps
Code Example:
Possible Solution
I dunno, compiler should check it? Maybe? No Idea
Additional Information/Context
No response
V version
V 0.3.3 b7b6c23
Environment details (OS name and version, etc.)
OS: macos, macOS, 13.2, 22D49 Processor: 8 cpus, 64bit, little endian, Apple M1 CC version: Apple clang version 14.0.0 (clang-1400.0.29.202)