diff --git a/core/odin/parser/parser.odin b/core/odin/parser/parser.odin index dc7c7b759..69f42b8ec 100644 --- a/core/odin/parser/parser.odin +++ b/core/odin/parser/parser.odin @@ -2595,7 +2595,6 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr { tok := expect_token(p, .Union) poly_params: ^ast.Field_List align: ^ast.Expr - is_maybe: bool is_no_nil: bool is_shared_nil: bool @@ -2620,10 +2619,7 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr { } align = parse_expr(p, true) case "maybe": - if is_maybe { - error(p, tag.pos, "duplicate union tag '#%s'", tag.text) - } - is_maybe = true + error(p, tag.pos, "#%s functionality has now been merged with standard 'union' functionality", tag.text) case "no_nil": if is_no_nil { error(p, tag.pos, "duplicate union tag '#%s'", tag.text) @@ -2640,19 +2636,12 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr { } p.expr_level = prev_level - if is_no_nil && is_maybe { - error(p, p.curr_tok.pos, "#maybe and #no_nil cannot be applied together") - } if is_no_nil && is_shared_nil { error(p, p.curr_tok.pos, "#shared_nil and #no_nil cannot be applied together") } - if is_shared_nil && is_maybe { - error(p, p.curr_tok.pos, "#maybe and #shared_nil cannot be applied together") - } union_kind := ast.Union_Type_Kind.Normal switch { - case is_maybe: union_kind = .maybe case is_no_nil: union_kind = .no_nil case is_shared_nil: union_kind = .shared_nil } diff --git a/src/check_type.cpp b/src/check_type.cpp index dea523599..5d37ff208 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -695,11 +695,6 @@ void check_union_type(CheckerContext *ctx, Type *union_type, Ast *node, Arrayalign, "A union with #no_nil must have at least 2 variants"); } break; - case UnionType_maybe: - if (variants.count != 1) { - error(ut->align, "A union with #maybe must have at 1 variant, got %lld", cast(long long)variants.count); - } - break; } if (ut->align != nullptr) { diff --git a/src/docs_format.cpp b/src/docs_format.cpp index ee32d0e05..b1c3c87e7 100644 --- a/src/docs_format.cpp +++ b/src/docs_format.cpp @@ -98,7 +98,6 @@ enum OdinDocTypeFlag_Struct : u32 { enum OdinDocTypeFlag_Union : u32 { OdinDocTypeFlag_Union_polymorphic = 1<<0, OdinDocTypeFlag_Union_no_nil = 1<<1, - OdinDocTypeFlag_Union_maybe = 1<<2, OdinDocTypeFlag_Union_shared_nil = 1<<3, }; diff --git a/src/parser.cpp b/src/parser.cpp index 934b5afcd..ac3acef8a 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -2548,21 +2548,15 @@ Ast *parse_operand(AstFile *f, bool lhs) { syntax_error(tag, "Invalid union tag '#%.*s'", LIT(tag.string)); } } - if (no_nil && maybe) { - syntax_error(f->curr_token, "#maybe and #no_nil cannot be applied together"); - } + if (no_nil && shared_nil) { syntax_error(f->curr_token, "#shared_nil and #no_nil cannot be applied together"); } - if (shared_nil && maybe) { - syntax_error(f->curr_token, "#maybe and #shared_nil cannot be applied together"); - } - if (maybe) { - union_kind = UnionType_maybe; syntax_error(f->curr_token, "#maybe functionality has now been merged with standard 'union' functionality"); - } else if (no_nil) { + } + if (no_nil) { union_kind = UnionType_no_nil; } else if (shared_nil) { union_kind = UnionType_shared_nil; diff --git a/src/parser.hpp b/src/parser.hpp index 862ef0f77..156991e24 100644 --- a/src/parser.hpp +++ b/src/parser.hpp @@ -339,7 +339,6 @@ char const *inline_asm_dialect_strings[InlineAsmDialect_COUNT] = { enum UnionTypeKind : u8 { UnionType_Normal = 0, - UnionType_maybe = 1, // removed UnionType_no_nil = 2, UnionType_shared_nil = 3, };