Open Be-ing opened 2 years ago
Ouch, there are two bugs at hand here. (1) the compiler should not panic but produce an error message that this isn't supported at the moment and (2) we should support this in the future probably :-)
i have an probably related error. i am on latest master ec26714cc0316983fcad25bbca7b29263742240c it is compiling and i got no error message in 60 compiler. code looks like this:
export struct my_curve := {
line: bool,
arc:bool,
cubic: bool,
quadratic: bool,
from_x: float,
....
control-2-y: float,
....
}
property<[my_curve]> array_of_paths : [{ line: true,
arc: false,
cubic: false,
quadratic: false,
from_x: 0,
....
}];
than i try to construct it like this:
for mycurve[i] in array_of_paths:
Path {
stroke: red;
stroke-width: 2px;
MoveTo{
x: mycurve.from_x;
y: mycurve.from_y;
}
if mycurve.line : LineTo {
x: mycurve.to_x;
y: mycurve.to_y;
}
if mycurve.arc : ArcTo {
x: mycurve.to_x;
y: mycurve.to_y;
radius-x: mycurve.control-1-x;
.....
sweep: mycurve.sweep;
}
.....
}
it will always create all sub-path elements -> the if statement is not working. I tryed also directly using propertys for the if statement and used different syntax like if mycurve.arc == true :
always no error but also not working
I can reproduce the panic
Any chance that we are going to be able to use "if" and "for" inside a Path in the next release?
This would be very handy for simple dynamic graphs.
Minimal example:
The error occurs accessing either the key (
i
) or value (sample
). Replacing both the key and the value with numeric literals successfully compiles:The compiler panics on this line at
unwrap
: