mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 16:54:25 +00:00
enum Shape { Circle(float), Rect(float, float), Point }; Shape.Circle(2.0) makes one, match names the values
(Circle(r), _ to ignore), exhaustive like plain enums, printing shows Rect(2, 3.5). Underneath it is a struct (tag +
every variant's values), so copying, freeing, methods and valgrind-cleanliness come with it. Also: stray note files removed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015f73FesGZGYPkmDvUcj6QX
12 lines
178 B
Text
12 lines
178 B
Text
// expect: this match doesn't handle Point
|
|
enum Shape {
|
|
Circle(float)
|
|
Point
|
|
}
|
|
|
|
fn main() {
|
|
s := Shape.Circle(1.0)
|
|
match s {
|
|
Circle(r) -> print(r)
|
|
}
|
|
}
|