Removed NullLiteral to Null

This commit is contained in:
Jimmi HC 2018-06-05 11:30:01 +02:00
parent 02cb220faf
commit 236c680f6b
6 changed files with 68 additions and 68 deletions

View File

@ -4896,7 +4896,7 @@ pub const TypeId = enum {
ComptimeFloat,
ComptimeInt,
UndefinedLiteral,
NullLiteral,
Null,
Nullable,
ErrorUnion,
Error,
@ -4930,7 +4930,7 @@ pub const TypeInfo = union(TypeId) {
ComptimeFloat: void,
ComptimeInt: void,
UndefinedLiteral: void,
NullLiteral: void,
Null: void,
Nullable: Nullable,
ErrorUnion: ErrorUnion,
ErrorSet: ErrorSet,
@ -5688,7 +5688,7 @@ pub const TypeId = enum {
ComptimeFloat,
ComptimeInt,
UndefinedLiteral,
NullLiteral,
Null,
Nullable,
ErrorUnion,
ErrorSet,

View File

@ -1162,7 +1162,7 @@ enum TypeTableEntryId {
TypeTableEntryIdComptimeFloat,
TypeTableEntryIdComptimeInt,
TypeTableEntryIdUndefLit,
TypeTableEntryIdNullLit,
TypeTableEntryIdNull,
TypeTableEntryIdMaybe,
TypeTableEntryIdErrorUnion,
TypeTableEntryIdErrorSet,

View File

@ -235,7 +235,7 @@ bool type_is_complete(TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@ -271,7 +271,7 @@ bool type_has_zero_bits_known(TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@ -1336,7 +1336,7 @@ static bool type_allowed_in_packed_struct(TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
case TypeTableEntryIdNamespace:
@ -1377,7 +1377,7 @@ static bool type_allowed_in_extern(CodeGen *g, TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
case TypeTableEntryIdNamespace:
@ -1512,7 +1512,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c
return g->builtin_types.entry_invalid;
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdOpaque:
add_node_error(g, param_node->data.param_decl.type,
@ -1600,7 +1600,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c
zig_unreachable();
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdOpaque:
add_node_error(g, fn_proto->return_type,
@ -3338,7 +3338,7 @@ TypeTableEntry *validate_var_type(CodeGen *g, AstNode *source_node, TypeTableEnt
return g->builtin_types.entry_invalid;
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdBlock:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdOpaque:
@ -3485,7 +3485,7 @@ static void resolve_decl_var(CodeGen *g, TldVar *tld_var) {
{
add_node_error(g, source_node, buf_sprintf("unable to infer variable type"));
implicit_type = g->builtin_types.entry_invalid;
} else if (implicit_type->id == TypeTableEntryIdNullLit) {
} else if (implicit_type->id == TypeTableEntryIdNull) {
add_node_error(g, source_node, buf_sprintf("unable to infer variable type"));
implicit_type = g->builtin_types.entry_invalid;
} else if (implicit_type->id == TypeTableEntryIdMetaType && !is_const) {
@ -3733,7 +3733,7 @@ static bool is_container(TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@ -3782,7 +3782,7 @@ void resolve_container_type(CodeGen *g, TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@ -4286,7 +4286,7 @@ bool handle_is_ptr(TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
case TypeTableEntryIdBoundFn:
@ -4674,7 +4674,7 @@ static uint32_t hash_const_val(ConstExprValue *const_val) {
return 223048345;
case TypeTableEntryIdUndefLit:
return 162837799;
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
return 844854567;
case TypeTableEntryIdArray:
// TODO better hashing algorithm
@ -4757,7 +4757,7 @@ static bool can_mutate_comptime_var_state(ConstExprValue *value) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBoundFn:
case TypeTableEntryIdFn:
@ -4822,7 +4822,7 @@ static bool return_type_is_cacheable(TypeTableEntry *return_type) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBoundFn:
case TypeTableEntryIdFn:
@ -4933,7 +4933,7 @@ bool type_requires_comptime(TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMetaType:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
@ -5412,7 +5412,7 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
return true;
case TypeTableEntryIdUndefLit:
zig_panic("TODO");
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
zig_panic("TODO");
case TypeTableEntryIdMaybe:
if (a->data.x_maybe == nullptr || b->data.x_maybe == nullptr) {
@ -5646,7 +5646,7 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
buf_appendf(buf, "}");
return;
}
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
{
buf_appendf(buf, "null");
return;
@ -5764,7 +5764,7 @@ uint32_t type_id_hash(TypeId x) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorSet:
case TypeTableEntryIdEnum:
@ -5810,7 +5810,7 @@ bool type_id_eql(TypeId a, TypeId b) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdPromise:
case TypeTableEntryIdErrorSet:
@ -5932,7 +5932,7 @@ static const TypeTableEntryId all_type_ids[] = {
TypeTableEntryIdComptimeFloat,
TypeTableEntryIdComptimeInt,
TypeTableEntryIdUndefLit,
TypeTableEntryIdNullLit,
TypeTableEntryIdNull,
TypeTableEntryIdMaybe,
TypeTableEntryIdErrorUnion,
TypeTableEntryIdErrorSet,
@ -5986,7 +5986,7 @@ size_t type_id_index(TypeTableEntry *entry) {
return 10;
case TypeTableEntryIdUndefLit:
return 11;
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
return 12;
case TypeTableEntryIdMaybe:
return 13;
@ -6044,8 +6044,8 @@ const char *type_id_name(TypeTableEntryId id) {
return "ComptimeInt";
case TypeTableEntryIdUndefLit:
return "UndefinedLiteral";
case TypeTableEntryIdNullLit:
return "NullLiteral";
case TypeTableEntryIdNull:
return "Null";
case TypeTableEntryIdMaybe:
return "Nullable";
case TypeTableEntryIdErrorUnion:

View File

@ -4919,7 +4919,7 @@ static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, Con
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
case TypeTableEntryIdNamespace:
@ -5365,7 +5365,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
case TypeTableEntryIdBoundFn:
@ -6032,7 +6032,7 @@ static void define_builtin_types(CodeGen *g) {
g->builtin_types.entry_undef = entry;
}
{
TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdNullLit);
TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdNull);
buf_init_from_str(&entry->name, "(null)");
entry->zero_bits = true;
g->builtin_types.entry_null = entry;
@ -6500,7 +6500,7 @@ static void define_builtin_compile_vars(CodeGen *g) {
" ComptimeFloat: void,\n"
" ComptimeInt: void,\n"
" UndefinedLiteral: void,\n"
" NullLiteral: void,\n"
" Null: void,\n"
" Nullable: Nullable,\n"
" ErrorUnion: ErrorUnion,\n"
" ErrorSet: ErrorSet,\n"
@ -7075,7 +7075,7 @@ static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, TypeTableEntry
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
case TypeTableEntryIdBoundFn:
@ -7260,7 +7260,7 @@ static void get_c_type(CodeGen *g, GenH *gen_h, TypeTableEntry *type_entry, Buf
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdPromise:
zig_unreachable();
@ -7413,7 +7413,7 @@ static void gen_h_file(CodeGen *g) {
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdArray:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
case TypeTableEntryIdNamespace:

View File

@ -7960,7 +7960,7 @@ static ImplicitCastMatchResult ir_types_match_with_implicit_cast(IrAnalyze *ira,
// implicit conversion from null literal to maybe type
if (expected_type->id == TypeTableEntryIdMaybe &&
actual_type->id == TypeTableEntryIdNullLit)
actual_type->id == TypeTableEntryIdNull)
{
return ImplicitCastMatchResultYes;
}
@ -8190,7 +8190,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
}
}
bool any_are_null = (prev_inst->value.type->id == TypeTableEntryIdNullLit);
bool any_are_null = (prev_inst->value.type->id == TypeTableEntryIdNull);
bool convert_to_const_slice = false;
for (size_t i = 1; i < instruction_count; i += 1) {
IrInstruction *cur_inst = instructions[i];
@ -8469,12 +8469,12 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
}
}
if (prev_type->id == TypeTableEntryIdNullLit) {
if (prev_type->id == TypeTableEntryIdNull) {
prev_inst = cur_inst;
continue;
}
if (cur_type->id == TypeTableEntryIdNullLit) {
if (cur_type->id == TypeTableEntryIdNull) {
any_are_null = true;
continue;
}
@ -8677,7 +8677,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
ir_add_error_node(ira, source_node,
buf_sprintf("unable to make error union out of number literal"));
return ira->codegen->builtin_types.entry_invalid;
} else if (prev_inst->value.type->id == TypeTableEntryIdNullLit) {
} else if (prev_inst->value.type->id == TypeTableEntryIdNull) {
ir_add_error_node(ira, source_node,
buf_sprintf("unable to make error union out of null literal"));
return ira->codegen->builtin_types.entry_invalid;
@ -8685,7 +8685,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
return get_error_union_type(ira->codegen, err_set_type, prev_inst->value.type);
}
}
} else if (any_are_null && prev_inst->value.type->id != TypeTableEntryIdNullLit) {
} else if (any_are_null && prev_inst->value.type->id != TypeTableEntryIdNull) {
if (prev_inst->value.type->id == TypeTableEntryIdComptimeInt ||
prev_inst->value.type->id == TypeTableEntryIdComptimeFloat)
{
@ -10004,7 +10004,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
// explicit cast from null literal to maybe type
if (wanted_type->id == TypeTableEntryIdMaybe &&
actual_type->id == TypeTableEntryIdNullLit)
actual_type->id == TypeTableEntryIdNull)
{
return ir_analyze_null_to_maybe(ira, source_instr, value, wanted_type);
}
@ -10061,7 +10061,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
{
TypeTableEntry *wanted_child_type = wanted_type->data.error_union.payload_type->data.maybe.child_type;
if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node).id == ConstCastResultIdOk ||
actual_type->id == TypeTableEntryIdNullLit ||
actual_type->id == TypeTableEntryIdNull ||
actual_type->id == TypeTableEntryIdComptimeInt ||
actual_type->id == TypeTableEntryIdComptimeFloat)
{
@ -10627,19 +10627,19 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp
IrBinOp op_id = bin_op_instruction->op_id;
bool is_equality_cmp = (op_id == IrBinOpCmpEq || op_id == IrBinOpCmpNotEq);
if (is_equality_cmp &&
((op1->value.type->id == TypeTableEntryIdNullLit && op2->value.type->id == TypeTableEntryIdMaybe) ||
(op2->value.type->id == TypeTableEntryIdNullLit && op1->value.type->id == TypeTableEntryIdMaybe) ||
(op1->value.type->id == TypeTableEntryIdNullLit && op2->value.type->id == TypeTableEntryIdNullLit)))
((op1->value.type->id == TypeTableEntryIdNull && op2->value.type->id == TypeTableEntryIdMaybe) ||
(op2->value.type->id == TypeTableEntryIdNull && op1->value.type->id == TypeTableEntryIdMaybe) ||
(op1->value.type->id == TypeTableEntryIdNull && op2->value.type->id == TypeTableEntryIdNull)))
{
if (op1->value.type->id == TypeTableEntryIdNullLit && op2->value.type->id == TypeTableEntryIdNullLit) {
if (op1->value.type->id == TypeTableEntryIdNull && op2->value.type->id == TypeTableEntryIdNull) {
ConstExprValue *out_val = ir_build_const_from(ira, &bin_op_instruction->base);
out_val->data.x_bool = (op_id == IrBinOpCmpEq);
return ira->codegen->builtin_types.entry_bool;
}
IrInstruction *maybe_op;
if (op1->value.type->id == TypeTableEntryIdNullLit) {
if (op1->value.type->id == TypeTableEntryIdNull) {
maybe_op = op2;
} else if (op2->value.type->id == TypeTableEntryIdNullLit) {
} else if (op2->value.type->id == TypeTableEntryIdNull) {
maybe_op = op1;
} else {
zig_unreachable();
@ -10796,7 +10796,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp
case TypeTableEntryIdArray:
case TypeTableEntryIdStruct:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdUnion:
@ -11645,7 +11645,7 @@ static VarClassRequired get_var_class_required(TypeTableEntry *type_entry) {
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdBlock:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdOpaque:
case TypeTableEntryIdMetaType:
case TypeTableEntryIdNamespace:
@ -11913,7 +11913,7 @@ static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructi
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@ -11937,7 +11937,7 @@ static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructi
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@ -12901,7 +12901,7 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@ -13152,7 +13152,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP
if (resolved_type->id == TypeTableEntryIdComptimeFloat ||
resolved_type->id == TypeTableEntryIdComptimeInt ||
resolved_type->id == TypeTableEntryIdNullLit ||
resolved_type->id == TypeTableEntryIdNull ||
resolved_type->id == TypeTableEntryIdUndefLit)
{
ir_add_error_node(ira, phi_instruction->base.source_node,
@ -14216,7 +14216,7 @@ static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructi
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
case TypeTableEntryIdBoundFn:
@ -14480,7 +14480,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira,
zig_unreachable();
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdBlock:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdOpaque:
@ -14588,7 +14588,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
zig_unreachable();
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdBlock:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdOpaque:
@ -14657,7 +14657,7 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira,
zig_unreachable();
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdBlock:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
@ -14713,7 +14713,7 @@ static TypeTableEntry *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrIn
ir_build_test_nonnull_from(&ira->new_irb, &instruction->base, value);
return ira->codegen->builtin_types.entry_bool;
} else if (type_entry->id == TypeTableEntryIdNullLit) {
} else if (type_entry->id == TypeTableEntryIdNull) {
ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
out_val->data.x_bool = false;
return ira->codegen->builtin_types.entry_bool;
@ -15100,7 +15100,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira,
case TypeTableEntryIdArray:
case TypeTableEntryIdStruct:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdBlock:
case TypeTableEntryIdBoundFn:
@ -15621,7 +15621,7 @@ static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@ -16283,7 +16283,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
case TypeTableEntryIdArgTuple:
@ -17879,7 +17879,7 @@ static TypeTableEntry *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstruc
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
case TypeTableEntryIdBoundFn:
@ -18613,7 +18613,7 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdPromise:
zig_unreachable();
case TypeTableEntryIdVoid:
@ -18680,7 +18680,7 @@ static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
case TypeTableEntryIdPromise:
zig_unreachable();
case TypeTableEntryIdVoid:
@ -18761,7 +18761,7 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
ir_add_error(ira, dest_type_value,
buf_sprintf("unable to @bitCast from type '%s'", buf_ptr(&src_type->name)));
return ira->codegen->builtin_types.entry_invalid;
@ -18787,7 +18787,7 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit:
case TypeTableEntryIdNull:
ir_add_error(ira, dest_type_value,
buf_sprintf("unable to @bitCast to type '%s'", buf_ptr(&dest_type->name)));
return ira->codegen->builtin_types.entry_invalid;

View File

@ -504,7 +504,7 @@ test "@typeId" {
assert(@typeId(@typeOf(1)) == Tid.ComptimeInt);
assert(@typeId(@typeOf(1.0)) == Tid.ComptimeFloat);
assert(@typeId(@typeOf(undefined)) == Tid.UndefinedLiteral);
assert(@typeId(@typeOf(null)) == Tid.NullLiteral);
assert(@typeId(@typeOf(null)) == Tid.Null);
assert(@typeId(?i32) == Tid.Nullable);
assert(@typeId(error!i32) == Tid.ErrorUnion);
assert(@typeId(error) == Tid.ErrorSet);