Commit a8146ade2a
Changed files (6)
doc/langref.html.in
@@ -4895,7 +4895,7 @@ pub const TypeId = enum {
Struct,
ComptimeFloat,
ComptimeInt,
- UndefinedLiteral,
+ Undefined,
Null,
Nullable,
ErrorUnion,
@@ -4929,7 +4929,7 @@ pub const TypeInfo = union(TypeId) {
Struct: Struct,
ComptimeFloat: void,
ComptimeInt: void,
- UndefinedLiteral: void,
+ Undefined: void,
Null: void,
Nullable: Nullable,
ErrorUnion: ErrorUnion,
@@ -5687,7 +5687,7 @@ pub const TypeId = enum {
Struct,
ComptimeFloat,
ComptimeInt,
- UndefinedLiteral,
+ Undefined,
Null,
Nullable,
ErrorUnion,
@@ -5715,7 +5715,7 @@ pub const TypeInfo = union(TypeId) {
Struct: Struct,
ComptimeFloat: void,
ComptimeInt: void,
- UndefinedLiteral: void,
+ Undefined: void,
Null: void,
Nullable: Nullable,
ErrorUnion: ErrorUnion,
src/all_types.hpp
@@ -1161,7 +1161,7 @@ enum TypeTableEntryId {
TypeTableEntryIdStruct,
TypeTableEntryIdComptimeFloat,
TypeTableEntryIdComptimeInt,
- TypeTableEntryIdUndefLit,
+ TypeTableEntryIdUndefined,
TypeTableEntryIdNull,
TypeTableEntryIdMaybe,
TypeTableEntryIdErrorUnion,
src/analyze.cpp
@@ -234,7 +234,7 @@ bool type_is_complete(TypeTableEntry *type_entry) {
case TypeTableEntryIdArray:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -270,7 +270,7 @@ bool type_has_zero_bits_known(TypeTableEntry *type_entry) {
case TypeTableEntryIdArray:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -1335,7 +1335,7 @@ static bool type_allowed_in_packed_struct(TypeTableEntry *type_entry) {
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@@ -1376,7 +1376,7 @@ static bool type_allowed_in_extern(CodeGen *g, TypeTableEntry *type_entry) {
case TypeTableEntryIdMetaType:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@@ -1511,7 +1511,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c
case TypeTableEntryIdInvalid:
return g->builtin_types.entry_invalid;
case TypeTableEntryIdUnreachable:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdOpaque:
@@ -1599,7 +1599,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c
case TypeTableEntryIdInvalid:
zig_unreachable();
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdOpaque:
@@ -3337,7 +3337,7 @@ TypeTableEntry *validate_var_type(CodeGen *g, AstNode *source_node, TypeTableEnt
case TypeTableEntryIdInvalid:
return g->builtin_types.entry_invalid;
case TypeTableEntryIdUnreachable:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdBlock:
case TypeTableEntryIdArgTuple:
@@ -3732,7 +3732,7 @@ static bool is_container(TypeTableEntry *type_entry) {
case TypeTableEntryIdArray:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -3781,7 +3781,7 @@ void resolve_container_type(CodeGen *g, TypeTableEntry *type_entry) {
case TypeTableEntryIdArray:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -4285,7 +4285,7 @@ bool handle_is_ptr(TypeTableEntry *type_entry) {
case TypeTableEntryIdMetaType:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
@@ -4672,7 +4672,7 @@ static uint32_t hash_const_val(ConstExprValue *const_val) {
case TypeTableEntryIdPromise:
// TODO better hashing algorithm
return 223048345;
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
return 162837799;
case TypeTableEntryIdNull:
return 844854567;
@@ -4756,7 +4756,7 @@ static bool can_mutate_comptime_var_state(ConstExprValue *value) {
case TypeTableEntryIdFloat:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBoundFn:
@@ -4821,7 +4821,7 @@ static bool return_type_is_cacheable(TypeTableEntry *return_type) {
case TypeTableEntryIdFloat:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBoundFn:
@@ -4932,7 +4932,7 @@ bool type_requires_comptime(TypeTableEntry *type_entry) {
zig_unreachable();
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMetaType:
case TypeTableEntryIdNamespace:
@@ -5410,7 +5410,7 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
return false;
}
return true;
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
zig_panic("TODO");
case TypeTableEntryIdNull:
zig_panic("TODO");
@@ -5651,7 +5651,7 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
buf_appendf(buf, "null");
return;
}
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
{
buf_appendf(buf, "undefined");
return;
@@ -5763,7 +5763,7 @@ uint32_t type_id_hash(TypeId x) {
case TypeTableEntryIdStruct:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorSet:
@@ -5809,7 +5809,7 @@ bool type_id_eql(TypeId a, TypeId b) {
case TypeTableEntryIdStruct:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdPromise:
@@ -5931,7 +5931,7 @@ static const TypeTableEntryId all_type_ids[] = {
TypeTableEntryIdStruct,
TypeTableEntryIdComptimeFloat,
TypeTableEntryIdComptimeInt,
- TypeTableEntryIdUndefLit,
+ TypeTableEntryIdUndefined,
TypeTableEntryIdNull,
TypeTableEntryIdMaybe,
TypeTableEntryIdErrorUnion,
@@ -5984,7 +5984,7 @@ size_t type_id_index(TypeTableEntry *entry) {
return 9;
case TypeTableEntryIdComptimeInt:
return 10;
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
return 11;
case TypeTableEntryIdNull:
return 12;
@@ -6042,8 +6042,8 @@ const char *type_id_name(TypeTableEntryId id) {
return "ComptimeFloat";
case TypeTableEntryIdComptimeInt:
return "ComptimeInt";
- case TypeTableEntryIdUndefLit:
- return "UndefinedLiteral";
+ case TypeTableEntryIdUndefined:
+ return "Undefined";
case TypeTableEntryIdNull:
return "Null";
case TypeTableEntryIdMaybe:
src/codegen.cpp
@@ -4918,7 +4918,7 @@ static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, Con
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
@@ -5364,7 +5364,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
@@ -6026,7 +6026,7 @@ static void define_builtin_types(CodeGen *g) {
g->primitive_type_table.put(&entry->name, entry);
}
{
- TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdUndefLit);
+ TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdUndefined);
buf_init_from_str(&entry->name, "(undefined)");
entry->zero_bits = true;
g->builtin_types.entry_undef = entry;
@@ -6499,7 +6499,7 @@ static void define_builtin_compile_vars(CodeGen *g) {
" Struct: Struct,\n"
" ComptimeFloat: void,\n"
" ComptimeInt: void,\n"
- " UndefinedLiteral: void,\n"
+ " Undefined: void,\n"
" Null: void,\n"
" Nullable: Nullable,\n"
" ErrorUnion: ErrorUnion,\n"
@@ -7074,7 +7074,7 @@ static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, TypeTableEntry
case TypeTableEntryIdMetaType:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
@@ -7259,7 +7259,7 @@ static void get_c_type(CodeGen *g, GenH *gen_h, TypeTableEntry *type_entry, Buf
case TypeTableEntryIdBlock:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdArgTuple:
case TypeTableEntryIdPromise:
@@ -7412,7 +7412,7 @@ static void gen_h_file(CodeGen *g) {
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
case TypeTableEntryIdArray:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdErrorSet:
src/ir.cpp
@@ -8142,7 +8142,7 @@ static ImplicitCastMatchResult ir_types_match_with_implicit_cast(IrAnalyze *ira,
}
// implicit undefined literal to anything
- if (actual_type->id == TypeTableEntryIdUndefLit) {
+ if (actual_type->id == TypeTableEntryIdUndefined) {
return ImplicitCastMatchResultYes;
}
@@ -8546,11 +8546,11 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
continue;
}
- if (cur_type->id == TypeTableEntryIdUndefLit) {
+ if (cur_type->id == TypeTableEntryIdUndefined) {
continue;
}
- if (prev_type->id == TypeTableEntryIdUndefLit) {
+ if (prev_type->id == TypeTableEntryIdUndefined) {
prev_inst = cur_inst;
continue;
}
@@ -10230,7 +10230,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
// explicit cast from undefined to anything
- if (actual_type->id == TypeTableEntryIdUndefLit) {
+ if (actual_type->id == TypeTableEntryIdUndefined) {
return ir_analyze_undefined_to_anything(ira, source_instr, value, wanted_type);
}
@@ -10795,7 +10795,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdArray:
case TypeTableEntryIdStruct:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -11643,7 +11643,7 @@ static VarClassRequired get_var_class_required(TypeTableEntry *type_entry) {
return VarClassRequiredAny;
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdBlock:
case TypeTableEntryIdNull:
case TypeTableEntryIdOpaque:
@@ -11912,7 +11912,7 @@ static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructi
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -11936,7 +11936,7 @@ static TypeTableEntry *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructi
case TypeTableEntryIdArray:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -12900,7 +12900,7 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op
case TypeTableEntryIdStruct:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -13153,7 +13153,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP
if (resolved_type->id == TypeTableEntryIdComptimeFloat ||
resolved_type->id == TypeTableEntryIdComptimeInt ||
resolved_type->id == TypeTableEntryIdNull ||
- resolved_type->id == TypeTableEntryIdUndefLit)
+ resolved_type->id == TypeTableEntryIdUndefined)
{
ir_add_error_node(ira, phi_instruction->base.source_node,
buf_sprintf("unable to infer expression type"));
@@ -14215,7 +14215,7 @@ static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructi
zig_unreachable(); // handled above
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
@@ -14479,7 +14479,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira,
case TypeTableEntryIdInvalid: // handled above
zig_unreachable();
case TypeTableEntryIdUnreachable:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdBlock:
case TypeTableEntryIdArgTuple:
@@ -14587,7 +14587,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
case TypeTableEntryIdInvalid: // handled above
zig_unreachable();
case TypeTableEntryIdUnreachable:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdBlock:
case TypeTableEntryIdArgTuple:
@@ -14656,7 +14656,7 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira,
case TypeTableEntryIdInvalid: // handled above
zig_unreachable();
case TypeTableEntryIdUnreachable:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdBlock:
case TypeTableEntryIdComptimeFloat:
@@ -15099,7 +15099,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira,
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdArray:
case TypeTableEntryIdStruct:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdBlock:
@@ -15620,7 +15620,7 @@ static TypeTableEntry *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_
case TypeTableEntryIdStruct:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
@@ -16282,7 +16282,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
@@ -17878,7 +17878,7 @@ static TypeTableEntry *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstruc
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdNamespace:
case TypeTableEntryIdBlock:
@@ -18612,7 +18612,7 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdPromise:
zig_unreachable();
@@ -18679,7 +18679,7 @@ static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
case TypeTableEntryIdPromise:
zig_unreachable();
@@ -18760,7 +18760,7 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
ir_add_error(ira, dest_type_value,
buf_sprintf("unable to @bitCast from type '%s'", buf_ptr(&src_type->name)));
@@ -18786,7 +18786,7 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc
case TypeTableEntryIdUnreachable:
case TypeTableEntryIdComptimeFloat:
case TypeTableEntryIdComptimeInt:
- case TypeTableEntryIdUndefLit:
+ case TypeTableEntryIdUndefined:
case TypeTableEntryIdNull:
ir_add_error(ira, dest_type_value,
buf_sprintf("unable to @bitCast to type '%s'", buf_ptr(&dest_type->name)));
test/cases/misc.zig
@@ -503,7 +503,7 @@ test "@typeId" {
assert(@typeId(AStruct) == Tid.Struct);
assert(@typeId(@typeOf(1)) == Tid.ComptimeInt);
assert(@typeId(@typeOf(1.0)) == Tid.ComptimeFloat);
- assert(@typeId(@typeOf(undefined)) == Tid.UndefinedLiteral);
+ assert(@typeId(@typeOf(undefined)) == Tid.Undefined);
assert(@typeId(@typeOf(null)) == Tid.Null);
assert(@typeId(?i32) == Tid.Nullable);
assert(@typeId(error!i32) == Tid.ErrorUnion);