diff options
| author | gingerBill <bill@gingerbill.org> | 2022-08-01 15:38:50 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-08-01 15:38:50 +0100 |
| commit | 5168cf03a9c321de464c2709a37607ea9c1edbe8 (patch) | |
| tree | bae885c2465ac59973a57f3046ecb20f0242d089 /src | |
| parent | b886ae6515440da18dec7292c43e09835170a632 (diff) | |
Remove dead `#maybe` code
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_type.cpp | 5 | ||||
| -rw-r--r-- | src/docs_format.cpp | 1 | ||||
| -rw-r--r-- | src/parser.cpp | 12 | ||||
| -rw-r--r-- | src/parser.hpp | 1 |
4 files changed, 3 insertions, 16 deletions
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, Array<Op error(ut->align, "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, }; |