aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-08-05 17:46:42 +0100
committergingerBill <bill@gingerbill.org>2021-08-05 17:46:42 +0100
commit0d257c61cd28e1df7ea372e4f386483db2bf75d1 (patch)
tree16e33e209eee289936cb33c29b9907ee1d6bef6f /examples
parentdd8fa1d690db5a6a42a300c1a09b821806ea39e8 (diff)
Disallow `using` on an enum declaration.
Diffstat (limited to 'examples')
-rw-r--r--examples/demo/demo.odin24
1 files changed, 7 insertions, 17 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin
index d5dc1e6c7..5ad32c604 100644
--- a/examples/demo/demo.odin
+++ b/examples/demo/demo.odin
@@ -778,16 +778,6 @@ using_statement :: proc() {
// Note: using’d fields can still be referred by name.
}
- { // using on an enum declaration
-
- using Foo :: enum {A, B, C};
-
- f0 := A;
- f1 := B;
- f2 := C;
- fmt.println(f0, f1, f2);
- fmt.println(len(Foo));
- }
}
@@ -1337,7 +1327,7 @@ bit_set_type :: proc() {
fmt.println("\n# bit_set type");
{
- using Day :: enum {
+ Day :: enum {
Sunday,
Monday,
Tuesday,
@@ -1348,20 +1338,20 @@ bit_set_type :: proc() {
};
Days :: distinct bit_set[Day];
- WEEKEND :: Days{Sunday, Saturday};
+ WEEKEND :: Days{.Sunday, .Saturday};
d: Days;
- d = {Sunday, Monday};
+ d = {.Sunday, .Monday};
e := d + WEEKEND;
- e += {Monday};
+ e += {.Monday};
fmt.println(d, e);
- ok := Saturday in e; // `in` is only allowed for `map` and `bit_set` types
+ ok := .Saturday in e; // `in` is only allowed for `map` and `bit_set` types
fmt.println(ok);
- if Saturday in e {
+ if .Saturday in e {
fmt.println("Saturday in", e);
}
- X :: Saturday in WEEKEND; // Constant evaluation
+ X :: .Saturday in WEEKEND; // Constant evaluation
fmt.println(X);
fmt.println("Cardinality:", card(e));
}