mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
$defined(x[0] = val) causes an error instead of returning false when a type does not have []= defined #2454
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
fn int main(String[] args)
|
||||
{
|
||||
MyArray a = {{1, 4, 3, 6, 5}};
|
||||
$assert(!$defined(a[0] = 2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct MyArray
|
||||
{
|
||||
int[] val;
|
||||
}
|
||||
|
||||
fn int MyArray.get(self, usz idx) @operator([]) => self.val[idx];
|
||||
fn usz MyArray.len(self) @operator(len) => self.val.len;
|
||||
Reference in New Issue
Block a user