Commit 5bf9ffdc5b

kristopher tate <kris.tate+github@gmail.com>
2019-01-25 21:10:40
Hint at use of and/or when &&/|| is improperly used (#1886)
1 parent 3bec3b9
doc/langref.html.in
@@ -6024,7 +6024,7 @@ fn add(a: i32, b: i32) i32 {
       This is typically used for type safety when interacting with C code that does not expose struct details.
       Example:
       </p>
-      {#code_begin|test_err|expected type '*Derp', found '*Wat'#}
+      {#code_begin|test_err|expected '*Derp' type, found '*Wat'#}
 const Derp = @OpaqueType();
 const Wat = @OpaqueType();
 
src/ir.cpp
@@ -9771,13 +9771,19 @@ IrInstruction *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node
     return ir_exec_const_result(codegen, analyzed_executable);
 }
 
-static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) {
+static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value, ZigTypeId wanted_type) {
     if (type_is_invalid(type_value->value.type))
         return ira->codegen->builtin_types.entry_invalid;
 
+    const char *expected_type_str = type_id_name(ZigTypeIdMetaType);
+
+    if (wanted_type != ZigTypeIdInvalid) {
+        expected_type_str = type_id_name(wanted_type);
+    }
+
     if (type_value->value.type->id != ZigTypeIdMetaType) {
-        ir_add_error(ira, type_value,
-                buf_sprintf("expected type 'type', found '%s'", buf_ptr(&type_value->value.type->name)));
+        ir_add_error( ira, type_value,
+                buf_sprintf("expected %s type, found '%s'", expected_type_str, buf_ptr(&type_value->value.type->name)));
         return ira->codegen->builtin_types.entry_invalid;
     }
 
@@ -9786,7 +9792,16 @@ static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) {
         return ira->codegen->builtin_types.entry_invalid;
 
     assert(const_val->data.x_type != nullptr);
-    return const_val->data.x_type;
+
+    ZigType *out_type = const_val->data.x_type;
+
+    if (wanted_type != ZigTypeIdInvalid && out_type->id != wanted_type) {
+        ir_add_error(ira, type_value,
+                buf_sprintf( "expected %s type, found '%s'", expected_type_str, buf_ptr(&out_type->name)));
+        return ira->codegen->builtin_types.entry_invalid;
+    }
+
+    return out_type;
 }
 
 static ZigFn *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) {
@@ -10986,7 +11001,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
     }
 
     ErrorMsg *parent_msg = ir_add_error_node(ira, source_instr->source_node,
-        buf_sprintf("expected type '%s', found '%s'",
+        buf_sprintf("expected '%s' type, found '%s'",
             buf_ptr(&wanted_type->name),
             buf_ptr(&actual_type->name)));
     report_recursive_error(ira, source_instr->source_node, &const_cast_result, parent_msg);
@@ -12214,7 +12229,7 @@ static IrInstruction *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *i
     size_t op2_array_end;
     if (op2_type->id == ZigTypeIdArray) {
         if (op2_type->data.array.child_type != child_type) {
-            ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'",
+            ir_add_error(ira, op2, buf_sprintf("expected array of '%s' type, found '%s'",
                         buf_ptr(&child_type->name),
                         buf_ptr(&op2->value.type->name)));
             return ira->codegen->invalid_instruction;
@@ -12228,7 +12243,7 @@ static IrInstruction *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *i
         op2_val->data.x_ptr.data.base_array.is_cstr)
     {
         if (child_type != ira->codegen->builtin_types.entry_u8) {
-            ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'",
+            ir_add_error(ira, op2, buf_sprintf("expected array of '%s' type, found '%s'",
                         buf_ptr(&child_type->name),
                         buf_ptr(&op2->value.type->name)));
             return ira->codegen->invalid_instruction;
@@ -12239,7 +12254,7 @@ static IrInstruction *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *i
     } else if (is_slice(op2_type)) {
         ZigType *ptr_type = op2_type->data.structure.fields[slice_ptr_index].type_entry;
         if (ptr_type->data.pointer.child_type != child_type) {
-            ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'",
+            ir_add_error(ira, op2, buf_sprintf("expected array of '%s' type, found '%s'",
                         buf_ptr(&child_type->name),
                         buf_ptr(&op2->value.type->name)));
             return ira->codegen->invalid_instruction;
@@ -12253,7 +12268,7 @@ static IrInstruction *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *i
         op2_array_end = bigint_as_unsigned(&len_val->data.x_bigint);
     } else {
         ir_add_error(ira, op2,
-            buf_sprintf("expected array or C string literal, found '%s'", buf_ptr(&op2->value.type->name)));
+            buf_sprintf("expected array or C string literal type, found '%s'", buf_ptr(&op2->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -12388,26 +12403,22 @@ static IrInstruction *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp *
 }
 
 static IrInstruction *ir_analyze_merge_error_sets(IrAnalyze *ira, IrInstructionBinOp *instruction) {
-    ZigType *op1_type = ir_resolve_type(ira, instruction->op1->child);
-    if (type_is_invalid(op1_type))
-        return ira->codegen->invalid_instruction;
-
-    if (op1_type->id != ZigTypeIdErrorSet) {
-        ir_add_error(ira, instruction->op1,
-                buf_sprintf("expected error set type, found '%s'", buf_ptr(&op1_type->name)));
+    ZigType *op1_type = ir_resolve_type(ira, instruction->op1->child, ZigTypeIdErrorSet);
+    if (type_is_invalid(op1_type)) {
+        if (ira->codegen->errors.length != 0) {
+            add_error_note( ira->codegen
+                          , ira->codegen->errors.last()
+                          , instruction->base.source_node
+                          , buf_sprintf("did you mean to use `or`?")
+                          );
+        }
         return ira->codegen->invalid_instruction;
     }
 
-    ZigType *op2_type = ir_resolve_type(ira, instruction->op2->child);
+    ZigType *op2_type = ir_resolve_type(ira, instruction->op2->child, ZigTypeIdErrorSet);
     if (type_is_invalid(op2_type))
         return ira->codegen->invalid_instruction;
 
-    if (op2_type->id != ZigTypeIdErrorSet) {
-        ir_add_error(ira, instruction->op2,
-                buf_sprintf("expected error set type, found '%s'", buf_ptr(&op2_type->name)));
-        return ira->codegen->invalid_instruction;
-    }
-
     if (type_is_global_error_set(op1_type) ||
         type_is_global_error_set(op2_type))
     {
@@ -12495,7 +12506,7 @@ static IrInstruction *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruct
     IrInstruction *var_type = nullptr;
     if (decl_var_instruction->var_type != nullptr) {
         var_type = decl_var_instruction->var_type->child;
-        ZigType *proposed_type = ir_resolve_type(ira, var_type);
+        ZigType *proposed_type = ir_resolve_type(ira, var_type, ZigTypeIdInvalid);
         explicit_type = validate_var_type(ira->codegen, var_type->source_node, proposed_type);
         if (type_is_invalid(explicit_type)) {
             var->value->type = ira->codegen->builtin_types.entry_invalid;
@@ -12824,21 +12835,14 @@ static IrInstruction *ir_analyze_instruction_error_union(IrAnalyze *ira,
 {
     Error err;
 
-    ZigType *err_set_type = ir_resolve_type(ira, instruction->err_set->child);
+    ZigType *err_set_type = ir_resolve_type(ira, instruction->err_set->child, ZigTypeIdErrorSet);
     if (type_is_invalid(err_set_type))
         return ira->codegen->invalid_instruction;
 
-    ZigType *payload_type = ir_resolve_type(ira, instruction->payload->child);
+    ZigType *payload_type = ir_resolve_type(ira, instruction->payload->child, ZigTypeIdInvalid);
     if (type_is_invalid(payload_type))
         return ira->codegen->invalid_instruction;
 
-    if (err_set_type->id != ZigTypeIdErrorSet) {
-        ir_add_error(ira, instruction->err_set->child,
-            buf_sprintf("expected error set type, found type '%s'",
-                buf_ptr(&err_set_type->name)));
-        return ira->codegen->invalid_instruction;
-    }
-
     if ((err = type_resolve(ira->codegen, payload_type, ResolveStatusSizeKnown)))
         return ira->codegen->invalid_instruction;
     ZigType *result_type = get_error_union_type(ira->codegen, err_set_type, payload_type);
@@ -12900,7 +12904,7 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCall *c
     ZigType *alloc_fn_type = ptr_to_alloc_fn_type->data.pointer.child_type;
     if (alloc_fn_type->id != ZigTypeIdFn) {
         ir_add_error(ira, &call_instruction->base,
-                buf_sprintf("expected allocation function, found '%s'", buf_ptr(&alloc_fn_type->name)));
+                buf_sprintf("expected allocation function type, found '%s'", buf_ptr(&alloc_fn_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -13692,7 +13696,7 @@ static IrInstruction *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionC
 
     if (is_comptime || instr_is_comptime(fn_ref)) {
         if (fn_ref->value.type->id == ZigTypeIdMetaType) {
-            ZigType *dest_type = ir_resolve_type(ira, fn_ref);
+            ZigType *dest_type = ir_resolve_type(ira, fn_ref, ZigTypeIdInvalid);
             if (type_is_invalid(dest_type))
                 return ira->codegen->invalid_instruction;
 
@@ -13817,7 +13821,7 @@ static Error ir_read_const_ptr(IrAnalyze *ira, CodeGen *codegen, AstNode *source
 static IrInstruction *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op_instruction) {
     Error err;
     IrInstruction *value = un_op_instruction->value->child;
-    ZigType *type_entry = ir_resolve_type(ira, value);
+    ZigType *type_entry = ir_resolve_type(ira, value, ZigTypeIdInvalid);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
     if ((err = ensure_complete_type(ira->codegen, type_entry)))
@@ -15300,16 +15304,10 @@ static IrInstruction *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira,
         IrInstructionPtrTypeChild *ptr_type_child_instruction)
 {
     IrInstruction *type_value = ptr_type_child_instruction->value->child;
-    ZigType *type_entry = ir_resolve_type(ira, type_value);
+    ZigType *type_entry = ir_resolve_type(ira, type_value, ZigTypeIdPointer);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
 
-    if (type_entry->id != ZigTypeIdPointer) {
-        ir_add_error_node(ira, ptr_type_child_instruction->base.source_node,
-                buf_sprintf("expected pointer type, found '%s'", buf_ptr(&type_entry->name)));
-        return ira->codegen->invalid_instruction;
-    }
-
     return ir_const_type(ira, &ptr_type_child_instruction->base, type_entry->data.pointer.child_type);
 }
 
@@ -15462,7 +15460,7 @@ static IrInstruction *ir_analyze_instruction_slice_type(IrAnalyze *ira,
             return ira->codegen->invalid_instruction;
     }
 
-    ZigType *child_type = ir_resolve_type(ira, slice_type_instruction->child_type->child);
+    ZigType *child_type = ir_resolve_type(ira, slice_type_instruction->child_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(child_type))
         return ira->codegen->invalid_instruction;
 
@@ -15545,7 +15543,7 @@ static IrInstruction *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionAs
         AsmOutput *asm_output = asm_expr->output_list.at(i);
         if (asm_output->return_type) {
             output_types[i] = asm_instruction->output_types[i]->child;
-            return_type = ir_resolve_type(ira, output_types[i]);
+            return_type = ir_resolve_type(ira, output_types[i], ZigTypeIdInvalid);
             if (type_is_invalid(return_type))
                 return ira->codegen->invalid_instruction;
         }
@@ -15560,7 +15558,7 @@ static IrInstruction *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionAs
             (input_value->value.type->id == ZigTypeIdComptimeInt ||
             input_value->value.type->id == ZigTypeIdComptimeFloat)) {
             ir_add_error_node(ira, input_value->source_node,
-                buf_sprintf("expected sized integer or sized float, found %s", buf_ptr(&input_value->value.type->name)));
+                buf_sprintf("expected sized integer or sized float type, found %s", buf_ptr(&input_value->value.type->name)));
             return ira->codegen->invalid_instruction;
         }
 
@@ -15586,7 +15584,7 @@ static IrInstruction *ir_analyze_instruction_array_type(IrAnalyze *ira,
         return ira->codegen->invalid_instruction;
 
     IrInstruction *child_type_value = array_type_instruction->child_type->child;
-    ZigType *child_type = ir_resolve_type(ira, child_type_value);
+    ZigType *child_type = ir_resolve_type(ira, child_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(child_type))
         return ira->codegen->invalid_instruction;
     switch (child_type->id) {
@@ -15635,7 +15633,7 @@ static IrInstruction *ir_analyze_instruction_promise_type(IrAnalyze *ira, IrInst
     if (instruction->payload_type == nullptr) {
         promise_type = ira->codegen->builtin_types.entry_promise;
     } else {
-        ZigType *payload_type = ir_resolve_type(ira, instruction->payload_type->child);
+        ZigType *payload_type = ir_resolve_type(ira, instruction->payload_type->child, ZigTypeIdInvalid);
         if (type_is_invalid(payload_type))
             return ira->codegen->invalid_instruction;
 
@@ -15650,7 +15648,7 @@ static IrInstruction *ir_analyze_instruction_size_of(IrAnalyze *ira,
 {
     Error err;
     IrInstruction *type_value = size_of_instruction->type_value->child;
-    ZigType *type_entry = ir_resolve_type(ira, type_value);
+    ZigType *type_entry = ir_resolve_type(ira, type_value, ZigTypeIdInvalid);
 
     if ((err = ensure_complete_type(ira->codegen, type_entry)))
         return ira->codegen->invalid_instruction;
@@ -16485,7 +16483,7 @@ static IrInstruction *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
 
     size_t elem_count = instruction->item_count;
     if (container_type_value->value.type->id == ZigTypeIdMetaType) {
-        ZigType *container_type = ir_resolve_type(ira, container_type_value);
+        ZigType *container_type = ir_resolve_type(ira, container_type_value, ZigTypeIdInvalid);
         if (type_is_invalid(container_type))
             return ira->codegen->invalid_instruction;
 
@@ -16601,7 +16599,7 @@ static IrInstruction *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
 
 static IrInstruction *ir_analyze_instruction_container_init_fields(IrAnalyze *ira, IrInstructionContainerInitFields *instruction) {
     IrInstruction *container_type_value = instruction->container_type->child;
-    ZigType *container_type = ir_resolve_type(ira, container_type_value);
+    ZigType *container_type = ir_resolve_type(ira, container_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(container_type))
         return ira->codegen->invalid_instruction;
 
@@ -16719,7 +16717,7 @@ static IrInstruction *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
 {
     Error err;
     IrInstruction *type_value = instruction->type_value->child;
-    ZigType *container_type = ir_resolve_type(ira, type_value);
+    ZigType *container_type = ir_resolve_type(ira, type_value, ZigTypeIdStruct);
     if (type_is_invalid(container_type))
         return ira->codegen->invalid_instruction;
 
@@ -16732,12 +16730,6 @@ static IrInstruction *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
     if (type_is_invalid(field_ptr->value.type))
         return ira->codegen->invalid_instruction;
 
-    if (container_type->id != ZigTypeIdStruct) {
-        ir_add_error(ira, type_value,
-                buf_sprintf("expected struct type, found '%s'", buf_ptr(&container_type->name)));
-        return ira->codegen->invalid_instruction;
-    }
-
     if ((err = ensure_complete_type(ira->codegen, container_type)))
         return ira->codegen->invalid_instruction;
 
@@ -16751,7 +16743,7 @@ static IrInstruction *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
 
     if (field_ptr->value.type->id != ZigTypeIdPointer) {
         ir_add_error(ira, field_ptr,
-                buf_sprintf("expected pointer, found '%s'", buf_ptr(&field_ptr->value.type->name)));
+                buf_sprintf("expected Pointer type, found '%s'", buf_ptr(&field_ptr->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -16810,9 +16802,9 @@ static IrInstruction *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
 static TypeStructField *validate_byte_offset(IrAnalyze *ira,
         IrInstruction *type_value,
         IrInstruction *field_name_value,
-        size_t *byte_offset) 
+        size_t *byte_offset)
 {
-    ZigType *container_type = ir_resolve_type(ira, type_value);
+    ZigType *container_type = ir_resolve_type(ira, type_value, ZigTypeIdStruct);
     if (type_is_invalid(container_type))
         return nullptr;
 
@@ -16824,12 +16816,6 @@ static TypeStructField *validate_byte_offset(IrAnalyze *ira,
     if (!field_name)
         return nullptr;
 
-    if (container_type->id != ZigTypeIdStruct) {
-        ir_add_error(ira, type_value,
-                buf_sprintf("expected struct type, found '%s'", buf_ptr(&container_type->name)));
-        return nullptr;
-    }
-
     TypeStructField *field = find_struct_type_field(container_type, field_name);
     if (field == nullptr) {
         ir_add_error(ira, field_name_value,
@@ -17807,7 +17793,7 @@ static IrInstruction *ir_analyze_instruction_type_info(IrAnalyze *ira,
 {
     Error err;
     IrInstruction *type_value = instruction->type_value->child;
-    ZigType *type_entry = ir_resolve_type(ira, type_value);
+    ZigType *type_entry = ir_resolve_type(ira, type_value, ZigTypeIdInvalid);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
 
@@ -17835,7 +17821,7 @@ static IrInstruction *ir_analyze_instruction_type_id(IrAnalyze *ira,
         IrInstructionTypeId *instruction)
 {
     IrInstruction *type_value = instruction->type_value->child;
-    ZigType *type_entry = ir_resolve_type(ira, type_value);
+    ZigType *type_entry = ir_resolve_type(ira, type_value, ZigTypeIdInvalid);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
 
@@ -17870,7 +17856,7 @@ static IrInstruction *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ir
 
 static IrInstruction *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstructionTypeName *instruction) {
     IrInstruction *type_value = instruction->type_value->child;
-    ZigType *type_entry = ir_resolve_type(ira, type_value);
+    ZigType *type_entry = ir_resolve_type(ira, type_value, ZigTypeIdInvalid);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
 
@@ -18147,7 +18133,7 @@ static IrInstruction *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstruction
 
 static IrInstruction *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstructionTruncate *instruction) {
     IrInstruction *dest_type_value = instruction->dest_type->child;
-    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18200,7 +18186,7 @@ static IrInstruction *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstruct
 }
 
 static IrInstruction *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstructionIntCast *instruction) {
-    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18233,7 +18219,7 @@ static IrInstruction *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstruct
 }
 
 static IrInstruction *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstructionFloatCast *instruction) {
-    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18273,16 +18259,10 @@ static IrInstruction *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstru
 }
 
 static IrInstruction *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrInstructionErrSetCast *instruction) {
-    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child, ZigTypeIdErrorSet);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
-    if (dest_type->id != ZigTypeIdErrorSet) {
-        ir_add_error(ira, instruction->dest_type,
-                buf_sprintf("expected error set type, found '%s'", buf_ptr(&dest_type->name)));
-        return ira->codegen->invalid_instruction;
-    }
-
     IrInstruction *target = instruction->target->child;
     if (type_is_invalid(target->value.type))
         return ira->codegen->invalid_instruction;
@@ -18311,7 +18291,7 @@ static Error resolve_ptr_align(IrAnalyze *ira, ZigType *ty, uint32_t *result_ali
 static IrInstruction *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstructionFromBytes *instruction) {
     Error err;
 
-    ZigType *dest_child_type = ir_resolve_type(ira, instruction->dest_child_type->child);
+    ZigType *dest_child_type = ir_resolve_type(ira, instruction->dest_child_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(dest_child_type))
         return ira->codegen->invalid_instruction;
 
@@ -18408,7 +18388,7 @@ static IrInstruction *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstruct
 
     if (!is_slice(target->value.type)) {
         ir_add_error(ira, instruction->target,
-                buf_sprintf("expected slice, found '%s'", buf_ptr(&target->value.type->name)));
+                buf_sprintf("expected slice type, found '%s'", buf_ptr(&target->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -18427,7 +18407,7 @@ static IrInstruction *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstruct
 }
 
 static IrInstruction *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrInstructionIntToFloat *instruction) {
-    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18445,7 +18425,7 @@ static IrInstruction *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrInst
 }
 
 static IrInstruction *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrInstructionFloatToInt *instruction) {
-    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18501,7 +18481,7 @@ static IrInstruction *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInstr
         return ira->codegen->invalid_instruction;
 
     if (target->value.type->id != ZigTypeIdBool) {
-        ir_add_error(ira, instruction->target, buf_sprintf("expected bool, found '%s'",
+        ir_add_error(ira, instruction->target, buf_sprintf("expected bool type, found '%s'",
                     buf_ptr(&target->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
@@ -19082,7 +19062,7 @@ static IrInstruction *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInst
     IrInstruction *container = instruction->container->child;
     if (type_is_invalid(container->value.type))
         return ira->codegen->invalid_instruction;
-    ZigType *container_type = ir_resolve_type(ira, container);
+    ZigType *container_type = ir_resolve_type(ira, container, ZigTypeIdInvalid);
 
     if ((err = ensure_complete_type(ira->codegen, container_type)))
         return ira->codegen->invalid_instruction;
@@ -19116,7 +19096,7 @@ static IrInstruction *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInst
 static IrInstruction *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstructionMemberType *instruction) {
     Error err;
     IrInstruction *container_type_value = instruction->container_type->child;
-    ZigType *container_type = ir_resolve_type(ira, container_type_value);
+    ZigType *container_type = ir_resolve_type(ira, container_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(container_type))
         return ira->codegen->invalid_instruction;
 
@@ -19159,7 +19139,7 @@ static IrInstruction *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstr
 static IrInstruction *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstructionMemberName *instruction) {
     Error err;
     IrInstruction *container_type_value = instruction->container_type->child;
-    ZigType *container_type = ir_resolve_type(ira, container_type_value);
+    ZigType *container_type = ir_resolve_type(ira, container_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(container_type))
         return ira->codegen->invalid_instruction;
 
@@ -19252,7 +19232,7 @@ static IrInstruction *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstruct
     IrInstruction *type_value = instruction->type_value->child;
     if (type_is_invalid(type_value->value.type))
         return ira->codegen->invalid_instruction;
-    ZigType *type_entry = ir_resolve_type(ira, type_value);
+    ZigType *type_entry = ir_resolve_type(ira, type_value, ZigTypeIdInvalid);
 
     if ((err = type_resolve(ira->codegen, type_entry, ResolveStatusAlignmentKnown)))
         return ira->codegen->invalid_instruction;
@@ -19302,16 +19282,10 @@ static IrInstruction *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstr
     if (type_is_invalid(type_value->value.type))
         return ira->codegen->invalid_instruction;
 
-    ZigType *dest_type = ir_resolve_type(ira, type_value);
+    ZigType *dest_type = ir_resolve_type(ira, type_value, ZigTypeIdInt);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
-    if (dest_type->id != ZigTypeIdInt) {
-        ir_add_error(ira, type_value,
-            buf_sprintf("expected integer type, found '%s'", buf_ptr(&dest_type->name)));
-        return ira->codegen->invalid_instruction;
-    }
-
     IrInstruction *op1 = instruction->op1->child;
     if (type_is_invalid(op1->value.type))
         return ira->codegen->invalid_instruction;
@@ -19581,7 +19555,7 @@ static IrInstruction *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruct
             IrInstruction *param_type_value = instruction->param_types[fn_type_id.next_param_index]->child;
             if (type_is_invalid(param_type_value->value.type))
                 return ira->codegen->invalid_instruction;
-            ZigType *param_type = ir_resolve_type(ira, param_type_value);
+            ZigType *param_type = ir_resolve_type(ira, param_type_value, ZigTypeIdInvalid);
             switch (type_requires_comptime(ira->codegen, param_type)) {
             case ReqCompTimeYes:
                 if (!calling_convention_allows_zig_types(fn_type_id.cc)) {
@@ -19615,7 +19589,7 @@ static IrInstruction *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruct
     }
 
     IrInstruction *return_type_value = instruction->return_type->child;
-    fn_type_id.return_type = ir_resolve_type(ira, return_type_value);
+    fn_type_id.return_type = ir_resolve_type(ira, return_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(fn_type_id.return_type))
         return ira->codegen->invalid_instruction;
     if (fn_type_id.return_type->id == ZigTypeIdOpaque) {
@@ -19631,7 +19605,7 @@ static IrInstruction *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstruct
             return ira->codegen->invalid_instruction;
         }
         IrInstruction *async_allocator_type_value = instruction->async_allocator_type_value->child;
-        fn_type_id.async_allocator_type = ir_resolve_type(ira, async_allocator_type_value);
+        fn_type_id.async_allocator_type = ir_resolve_type(ira, async_allocator_type_value, ZigTypeIdInvalid);
         if (type_is_invalid(fn_type_id.async_allocator_type))
             return ira->codegen->invalid_instruction;
     }
@@ -19939,7 +19913,7 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3
         result_type = get_slice_type(ira->codegen, result_ptr_type);
     } else {
         ir_add_error(ira, target,
-                buf_sprintf("expected pointer or slice, found '%s'", buf_ptr(&target_type->name)));
+                buf_sprintf("expected pointer or slice type, found '%s'", buf_ptr(&target_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -19985,13 +19959,13 @@ static IrInstruction *ir_analyze_ptr_cast(IrAnalyze *ira, IrInstruction *source_
     // validate src_type and dest_type.
 
     if (get_src_ptr_type(src_type) == nullptr) {
-        ir_add_error(ira, ptr, buf_sprintf("expected pointer, found '%s'", buf_ptr(&src_type->name)));
+        ir_add_error(ira, ptr, buf_sprintf("expected Pointer type, found '%s'", buf_ptr(&src_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
     if (get_src_ptr_type(dest_type) == nullptr) {
         ir_add_error(ira, dest_type_src,
-                buf_sprintf("expected pointer, found '%s'", buf_ptr(&dest_type->name)));
+                buf_sprintf("expected Pointer type, found '%s'", buf_ptr(&dest_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -20059,7 +20033,7 @@ static IrInstruction *ir_analyze_ptr_cast(IrAnalyze *ira, IrInstruction *source_
 
 static IrInstruction *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstructionPtrCast *instruction) {
     IrInstruction *dest_type_value = instruction->dest_type->child;
-    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -20255,7 +20229,7 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou
 static IrInstruction *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstructionBitCast *instruction) {
     Error err;
     IrInstruction *dest_type_value = instruction->dest_type->child;
-    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -20352,13 +20326,13 @@ static IrInstruction *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruct
 static IrInstruction *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstructionIntToPtr *instruction) {
     Error err;
     IrInstruction *dest_type_value = instruction->dest_type->child;
-    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value, ZigTypeIdInvalid);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
     // We explicitly check for the size, so we can use get_src_ptr_type
     if (get_src_ptr_type(dest_type) == nullptr) {
-        ir_add_error(ira, dest_type_value, buf_sprintf("expected pointer, found '%s'", buf_ptr(&dest_type->name)));
+        ir_add_error(ira, dest_type_value, buf_sprintf("expected Pointer type, found '%s'", buf_ptr(&dest_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -20461,7 +20435,7 @@ static IrInstruction *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstru
     // We check size explicitly so we can use get_src_ptr_type here.
     if (get_src_ptr_type(target->value.type) == nullptr) {
         ir_add_error(ira, target,
-                buf_sprintf("expected pointer, found '%s'", buf_ptr(&target->value.type->name)));
+                buf_sprintf("expected Pointer type, found '%s'", buf_ptr(&target->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -20492,7 +20466,7 @@ static IrInstruction *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstru
 
 static IrInstruction *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstructionPtrType *instruction) {
     Error err;
-    ZigType *child_type = ir_resolve_type(ira, instruction->child_type->child);
+    ZigType *child_type = ir_resolve_type(ira, instruction->child_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(child_type))
         return ira->codegen->invalid_instruction;
 
@@ -20591,7 +20565,7 @@ static IrInstruction *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, IrI
 
 static IrInstruction *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstructionArgType *instruction) {
     IrInstruction *fn_type_inst = instruction->fn_type->child;
-    ZigType *fn_type = ir_resolve_type(ira, fn_type_inst);
+    ZigType *fn_type = ir_resolve_type(ira, fn_type_inst, ZigTypeIdFn);
     if (type_is_invalid(fn_type))
         return ira->codegen->invalid_instruction;
 
@@ -20600,11 +20574,6 @@ static IrInstruction *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstruct
     if (!ir_resolve_usize(ira, arg_index_inst, &arg_index))
         return ira->codegen->invalid_instruction;
 
-    if (fn_type->id != ZigTypeIdFn) {
-        ir_add_error(ira, fn_type_inst, buf_sprintf("expected function, found '%s'", buf_ptr(&fn_type->name)));
-        return ira->codegen->invalid_instruction;
-    }
-
     FnTypeId *fn_type_id = &fn_type->data.fn.fn_type_id;
     if (arg_index >= fn_type_id->param_count) {
         ir_add_error(ira, arg_index_inst,
@@ -20629,7 +20598,7 @@ static IrInstruction *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstruct
 static IrInstruction *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstructionTagType *instruction) {
     Error err;
     IrInstruction *target_inst = instruction->target->child;
-    ZigType *enum_type = ir_resolve_type(ira, target_inst);
+    ZigType *enum_type = ir_resolve_type(ira, target_inst, ZigTypeIdInvalid);
     if (type_is_invalid(enum_type))
         return ira->codegen->invalid_instruction;
 
@@ -20654,7 +20623,7 @@ static IrInstruction *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstruct
             return ira->codegen->invalid_instruction;
         }
     } else {
-        ir_add_error(ira, target_inst, buf_sprintf("expected enum or union, found '%s'",
+        ir_add_error(ira, target_inst, buf_sprintf("expected enum or union type, found '%s'",
             buf_ptr(&enum_type->name)));
         return ira->codegen->invalid_instruction;
     }
@@ -20808,7 +20777,7 @@ static IrInstruction *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrInst
     if (coro_handle->value.type->id != ZigTypeIdPromise ||
         coro_handle->value.type->data.promise.result_type == nullptr)
     {
-        ir_add_error(ira, &instruction->base, buf_sprintf("expected promise->T, found '%s'",
+        ir_add_error(ira, &instruction->base, buf_sprintf("expected promise->T type, found '%s'",
                     buf_ptr(&coro_handle->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
@@ -20839,7 +20808,7 @@ static IrInstruction *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira, I
 }
 
 static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op) {
-    ZigType *operand_type = ir_resolve_type(ira, op);
+    ZigType *operand_type = ir_resolve_type(ira, op, ZigTypeIdInvalid);
     if (type_is_invalid(operand_type))
         return ira->codegen->builtin_types.entry_invalid;
 
@@ -20969,12 +20938,12 @@ static IrInstruction *ir_analyze_instruction_atomic_load(IrAnalyze *ira, IrInstr
 }
 
 static IrInstruction *ir_analyze_instruction_promise_result_type(IrAnalyze *ira, IrInstructionPromiseResultType *instruction) {
-    ZigType *promise_type = ir_resolve_type(ira, instruction->promise_type->child);
+    ZigType *promise_type = ir_resolve_type(ira, instruction->promise_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(promise_type))
         return ira->codegen->invalid_instruction;
 
     if (promise_type->id != ZigTypeIdPromise || promise_type->data.promise.result_type == nullptr) {
-        ir_add_error(ira, &instruction->base, buf_sprintf("expected promise->T, found '%s'",
+        ir_add_error(ira, &instruction->base, buf_sprintf("expected promise->T type, found '%s'",
                     buf_ptr(&promise_type->name)));
         return ira->codegen->invalid_instruction;
     }
@@ -20983,7 +20952,7 @@ static IrInstruction *ir_analyze_instruction_promise_result_type(IrAnalyze *ira,
 }
 
 static IrInstruction *ir_analyze_instruction_await_bookkeeping(IrAnalyze *ira, IrInstructionAwaitBookkeeping *instruction) {
-    ZigType *promise_result_type = ir_resolve_type(ira, instruction->promise_result_type->child);
+    ZigType *promise_result_type = ir_resolve_type(ira, instruction->promise_result_type->child, ZigTypeIdInvalid);
     if (type_is_invalid(promise_result_type))
         return ira->codegen->invalid_instruction;
 
@@ -21046,7 +21015,7 @@ static IrInstruction *ir_analyze_instruction_mark_err_ret_trace_ptr(IrAnalyze *i
 }
 
 static IrInstruction *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionSqrt *instruction) {
-    ZigType *float_type = ir_resolve_type(ira, instruction->type->child);
+    ZigType *float_type = ir_resolve_type(ira, instruction->type->child, ZigTypeIdInvalid);
     if (type_is_invalid(float_type))
         return ira->codegen->invalid_instruction;
 
@@ -21113,7 +21082,7 @@ static IrInstruction *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionS
 }
 
 static IrInstruction *ir_analyze_instruction_bswap(IrAnalyze *ira, IrInstructionBswap *instruction) {
-    ZigType *int_type = ir_resolve_type(ira, instruction->type->child);
+    ZigType *int_type = ir_resolve_type(ira, instruction->type->child, ZigTypeIdInvalid);
     if (type_is_invalid(int_type))
         return ira->codegen->invalid_instruction;
 
@@ -21169,7 +21138,7 @@ static IrInstruction *ir_analyze_instruction_bswap(IrAnalyze *ira, IrInstruction
 }
 
 static IrInstruction *ir_analyze_instruction_bit_reverse(IrAnalyze *ira, IrInstructionBitReverse *instruction) {
-    ZigType *int_type = ir_resolve_type(ira, instruction->type->child);
+    ZigType *int_type = ir_resolve_type(ira, instruction->type->child, ZigTypeIdInvalid);
     if (type_is_invalid(int_type))
         return ira->codegen->invalid_instruction;
 
@@ -21240,7 +21209,7 @@ static IrInstruction *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInstr
 
     if (target->value.type->id != ZigTypeIdEnum) {
         ir_add_error(ira, instruction->target,
-            buf_sprintf("expected enum, found type '%s'", buf_ptr(&target->value.type->name)));
+            buf_sprintf("expected enum type, found '%s'", buf_ptr(&target->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -21255,16 +21224,10 @@ static IrInstruction *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInstr
 static IrInstruction *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInstructionIntToEnum *instruction) {
     Error err;
     IrInstruction *dest_type_value = instruction->dest_type->child;
-    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value, ZigTypeIdEnum);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
-    if (dest_type->id != ZigTypeIdEnum) {
-        ir_add_error(ira, instruction->dest_type,
-            buf_sprintf("expected enum, found type '%s'", buf_ptr(&dest_type->name)));
-        return ira->codegen->invalid_instruction;
-    }
-
     if ((err = type_resolve(ira->codegen, dest_type, ResolveStatusZeroBitsKnown)))
         return ira->codegen->invalid_instruction;
 
src/parser.cpp
@@ -122,19 +122,37 @@ static AstNode *ast_parse_container_decl_type(ParseContext *pc);
 static AstNode *ast_parse_byte_align(ParseContext *pc);
 
 ATTRIBUTE_PRINTF(3, 4)
-ATTRIBUTE_NORETURN
-static void ast_error(ParseContext *pc, Token *token, const char *format, ...) {
+static ErrorMsg *ast_error(ParseContext *pc, Token *token, const char *format, ...) {
     va_list ap;
     va_start(ap, format);
     Buf *msg = buf_vprintf(format, ap);
     va_end(ap);
 
+    ErrorMsg *err = err_msg_create_with_line(pc->owner->path, token->start_line, token->start_column,
+            pc->owner->source_code, pc->owner->line_offsets, msg);
+    err->line_start = token->start_line;
+    err->column_start = token->start_column;
+
+    return err;
+}
+
+ATTRIBUTE_PRINTF(4, 5)
+ATTRIBUTE_NORETURN
+static void ast_error_exit(ParseContext *pc, Token *token, ErrorMsg *note, const char *format, ...) {
+    va_list ap;
+    va_start(ap, format);
+    Buf *msg = buf_vprintf(format, ap);
+    va_end(ap);
 
     ErrorMsg *err = err_msg_create_with_line(pc->owner->path, token->start_line, token->start_column,
             pc->owner->source_code, pc->owner->line_offsets, msg);
     err->line_start = token->start_line;
     err->column_start = token->start_column;
 
+    if (note) {
+      err->notes.append(note);
+    }
+
     print_err_msg(err, pc->err_color);
     exit(EXIT_FAILURE);
 }
@@ -164,7 +182,7 @@ static Buf ast_token_str(Buf *input, Token *token) {
 ATTRIBUTE_NORETURN
 static void ast_invalid_token_error(ParseContext *pc, Token *token) {
     Buf token_value = ast_token_str(pc->buf, token);
-    ast_error(pc, token, "invalid token: '%s'", buf_ptr(&token_value));
+    ast_error_exit(pc, token, NULL, "invalid token: '%s'", buf_ptr(&token_value));
 }
 
 static AstNode *ast_create_node_no_line_info(ParseContext *pc, NodeType type) {
@@ -214,8 +232,13 @@ static Token *eat_token_if(ParseContext *pc, TokenId id) {
 
 static Token *expect_token(ParseContext *pc, TokenId id) {
     Token *res = eat_token(pc);
-    if (res->id != id)
-        ast_error(pc, res, "expected token '%s', found '%s'", token_name(id), token_name(res->id));
+    if (res->id != id) {
+        ErrorMsg *note = NULL;
+        if (res->id == TokenIdAmpersandAmpersand) {
+            note = ast_error(pc, res, "did you mean to use `and`?");
+        }
+        ast_error_exit(pc, res, note, "expected token '%s', found '%s'", token_name(id), token_name(res->id));
+    }
 
     return res;
 }
@@ -837,7 +860,7 @@ static AstNode *ast_parse_fn_proto(ParseContext *pc) {
         if (param_decl->data.param_decl.is_var_args)
             res->data.fn_proto.is_var_args = true;
         if (i != params.length - 1 && res->data.fn_proto.is_var_args)
-            ast_error(pc, first, "Function prototype have varargs as a none last paramter.");
+            ast_error_exit(pc, first, NULL, "Function prototype have varargs as a none last paramter.");
     }
     return res;
 }
src/tokenizer.cpp
@@ -199,6 +199,7 @@ enum TokenizeState {
     TokenizeStateSawDash,
     TokenizeStateSawMinusPercent,
     TokenizeStateSawAmpersand,
+    TokenizeStateSawAmpersandAmpersand,
     TokenizeStateSawCaret,
     TokenizeStateSawBar,
     TokenizeStateSawBarBar,
@@ -891,6 +892,10 @@ void tokenize(Buf *buf, Tokenization *out) {
                         end_token(&t);
                         t.state = TokenizeStateStart;
                         break;
+                    case '&':
+                        set_token_id(&t, t.cur_tok, TokenIdAmpersandAmpersand);
+                        t.state = TokenizeStateSawAmpersandAmpersand;
+                        break;
                     default:
                         t.pos -= 1;
                         end_token(&t);
@@ -898,6 +903,11 @@ void tokenize(Buf *buf, Tokenization *out) {
                         continue;
                 }
                 break;
+            case TokenizeStateSawAmpersandAmpersand:
+                t.pos -= 1;
+                end_token(&t);
+                t.state = TokenizeStateStart;
+                continue;
             case TokenizeStateSawCaret:
                 switch (c) {
                     case '=':
@@ -1468,6 +1478,7 @@ void tokenize(Buf *buf, Tokenization *out) {
         case TokenizeStateSawPlus:
         case TokenizeStateSawDash:
         case TokenizeStateSawAmpersand:
+        case TokenizeStateSawAmpersandAmpersand:
         case TokenizeStateSawCaret:
         case TokenizeStateSawBar:
         case TokenizeStateSawEq:
@@ -1515,6 +1526,7 @@ void tokenize(Buf *buf, Tokenization *out) {
 const char * token_name(TokenId id) {
     switch (id) {
         case TokenIdAmpersand: return "&";
+        case TokenIdAmpersandAmpersand: return "&&";
         case TokenIdArrow: return "->";
         case TokenIdAtSign: return "@";
         case TokenIdBang: return "!";
src/tokenizer.hpp
@@ -14,6 +14,7 @@
 
 enum TokenId {
     TokenIdAmpersand,
+    TokenIdAmpersandAmpersand,
     TokenIdArrow,
     TokenIdAtSign,
     TokenIdBang,
test/compile_errors.zig
@@ -1,6 +1,36 @@
 const tests = @import("tests.zig");
 
 pub fn addCases(cases: *tests.CompileErrorContext) void {
+    cases.add(
+        "Use of && in place of `and`",
+        \\export fn entry() void {
+        \\    if (true && false) return;
+        \\}
+    ,
+        ".tmp_source.zig:2:14: error: expected token ')', found '&&'",
+        ".tmp_source.zig:2:14: note: did you mean to use `and`?",
+    );
+
+    cases.add(
+        "Use of || in place of `or` (using comptime_int)",
+        \\export fn entry() void {
+        \\    if (1 || 0) return;
+        \\}
+    ,
+        ".tmp_source.zig:2:9: error: expected ErrorSet type, found 'comptime_int'",
+        ".tmp_source.zig:2:11: note: did you mean to use `or`?",
+    );
+
+    cases.add(
+        "Use of || in place of `or` (using booleans)",
+        \\export fn entry() void {
+        \\    if (true || false) return;
+        \\}
+    ,
+        ".tmp_source.zig:2:9: error: expected ErrorSet type, found 'bool'",
+        ".tmp_source.zig:2:14: note: did you mean to use `or`?",
+    );
+
     cases.add(
         "compile log a pointer to an opaque value",
         \\export fn entry() void {
@@ -68,7 +98,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    do_the_thing(bar);
         \\}
     ,
-        ".tmp_source.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void",
+        ".tmp_source.zig:4:18: error: expected 'fn(i32) void' type, found 'fn(bool) void",
         ".tmp_source.zig:4:18: note: parameter 0: 'bool' cannot cast into 'i32'",
     );
 
@@ -104,7 +134,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
     ,
         ".tmp_source.zig:3:31: error: integer value 300 cannot be implicitly casted to type 'u8'",
         ".tmp_source.zig:7:22: error: integer value 300 cannot be implicitly casted to type 'u8'",
-        ".tmp_source.zig:11:20: error: expected type 'u8', found 'u16'",
+        ".tmp_source.zig:11:20: error: expected 'u8' type, found 'u16'",
     );
 
     cases.add(
@@ -124,7 +154,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(y)); }
     ,
-        ".tmp_source.zig:2:14: error: expected type 'f32', found 'f64'",
+        ".tmp_source.zig:2:14: error: expected 'f32' type, found 'f64'",
     );
 
     cases.add(
@@ -172,7 +202,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var ptr2: *c_void = &b;
         \\}
     ,
-        ".tmp_source.zig:5:26: error: expected type '*c_void', found '**u32'",
+        ".tmp_source.zig:5:26: error: expected '*c_void' type, found '**u32'",
     );
 
     cases.add(
@@ -222,7 +252,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    const sliceA: []u8 = &buffer;
         \\}
     ,
-        ".tmp_source.zig:3:27: error: expected type '[]u8', found '*const [1]u8'",
+        ".tmp_source.zig:3:27: error: expected '[]u8' type, found '*const [1]u8'",
     );
 
     cases.add(
@@ -267,8 +297,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    const Errors = error{} || u16;
         \\}
     ,
-        ".tmp_source.zig:2:20: error: expected error set type, found 'u8'",
-        ".tmp_source.zig:5:31: error: expected error set type, found 'u16'",
+        ".tmp_source.zig:2:20: error: expected ErrorSet type, found 'u8'",
+        ".tmp_source.zig:2:23: note: did you mean to use `or`?",
+        ".tmp_source.zig:5:31: error: expected ErrorSet type, found 'u16'",
     );
 
     cases.add(
@@ -763,7 +794,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
             \\
             \\fn bar(x: *b.Foo) void {}
         ,
-            ".tmp_source.zig:6:10: error: expected type '*Foo', found '*Foo'",
+            ".tmp_source.zig:6:10: error: expected '*Foo' type, found '*Foo'",
             ".tmp_source.zig:6:10: note: pointer type child 'Foo' cannot cast into pointer type child 'Foo'",
             "a.zig:1:17: note: Foo declared here",
             "b.zig:1:17: note: Foo declared here",
@@ -833,7 +864,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var y = p.*;
         \\}
     ,
-        ".tmp_source.zig:4:23: error: expected type '*?*i32', found '**i32'",
+        ".tmp_source.zig:4:23: error: expected '*?*i32' type, found '**i32'",
     );
 
     cases.add(
@@ -842,7 +873,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    const x: [*]const bool = true;
         \\}
     ,
-        ".tmp_source.zig:2:30: error: expected type '[*]const bool', found 'bool'",
+        ".tmp_source.zig:2:30: error: expected '[*]const bool' type, found 'bool'",
     );
 
     cases.add(
@@ -887,7 +918,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var rule_set = try Foo.init();
         \\}
     ,
-        ".tmp_source.zig:2:13: error: expected type 'i32', found 'type'",
+        ".tmp_source.zig:2:13: error: expected 'i32' type, found 'type'",
     );
 
     cases.add(
@@ -921,7 +952,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return null;
         \\}
     ,
-        ".tmp_source.zig:5:34: error: expected type '?NextError!i32', found '?OtherError!i32'",
+        ".tmp_source.zig:5:34: error: expected '?NextError!i32' type, found '?OtherError!i32'",
         ".tmp_source.zig:5:34: note: optional type child 'OtherError!i32' cannot cast into optional type child 'NextError!i32'",
         ".tmp_source.zig:5:34: note: error set 'OtherError' cannot cast into error set 'NextError'",
         ".tmp_source.zig:2:26: note: 'error.OutOfMemory' not a member of destination error set",
@@ -991,7 +1022,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    @panic(e);
         \\}
     ,
-        ".tmp_source.zig:3:12: error: expected type '[]const u8', found 'error{Foo}'",
+        ".tmp_source.zig:3:12: error: expected '[]const u8' type, found 'error{Foo}'",
     );
 
     cases.add(
@@ -1019,7 +1050,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return error.ShouldBeCompileError;
         \\}
     ,
-        ".tmp_source.zig:6:17: error: expected type 'void', found 'error{ShouldBeCompileError}'",
+        ".tmp_source.zig:6:17: error: expected 'void' type, found 'error{ShouldBeCompileError}'",
     );
 
     cases.add(
@@ -1062,7 +1093,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    a(c);
         \\}
     ,
-        ".tmp_source.zig:8:7: error: expected type 'fn(*const u8) void', found 'fn(u8) void'",
+        ".tmp_source.zig:8:7: error: expected 'fn(*const u8) void' type, found 'fn(u8) void'",
     );
 
     cases.add(
@@ -1144,7 +1175,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\        E.One => {},
         \\    }
         \\}
-    , ".tmp_source.zig:9:10: error: expected type 'usize', found 'E'");
+    , ".tmp_source.zig:9:10: error: expected 'usize' type, found 'E'");
 
     cases.add(
         "range operator in switch used on error set",
@@ -1190,7 +1221,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    const z = i32!i32;
         \\}
     ,
-        ".tmp_source.zig:2:15: error: expected error set type, found type 'i32'",
+        ".tmp_source.zig:2:15: error: expected ErrorSet type, found 'i32'",
     );
 
     cases.add(
@@ -1240,7 +1271,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return error.B;
         \\}
     ,
-        ".tmp_source.zig:3:35: error: expected type 'SmallErrorSet!i32', found 'anyerror!i32'",
+        ".tmp_source.zig:3:35: error: expected 'SmallErrorSet!i32' type, found 'anyerror!i32'",
         ".tmp_source.zig:3:35: note: error set 'anyerror' cannot cast into error set 'SmallErrorSet'",
         ".tmp_source.zig:3:35: note: cannot cast global error set into smaller set",
     );
@@ -1255,7 +1286,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return error.B;
         \\}
     ,
-        ".tmp_source.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror'",
+        ".tmp_source.zig:3:31: error: expected 'SmallErrorSet' type, found 'anyerror'",
         ".tmp_source.zig:3:31: note: cannot cast global error set into smaller set",
     );
 
@@ -1282,7 +1313,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var x: Set2 = set1;
         \\}
     ,
-        ".tmp_source.zig:7:19: error: expected type 'Set2', found 'Set1'",
+        ".tmp_source.zig:7:19: error: expected 'Set2' type, found 'Set1'",
         ".tmp_source.zig:1:23: note: 'error.B' not a member of destination error set",
     );
 
@@ -1822,7 +1853,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\fn a() noreturn {return;}
         \\export fn entry() void { a(); }
     ,
-        ".tmp_source.zig:1:18: error: expected type 'noreturn', found 'void'",
+        ".tmp_source.zig:1:18: error: expected 'noreturn' type, found 'void'",
     );
 
     cases.add(
@@ -1830,7 +1861,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\fn a() i32 {}
         \\export fn entry() void { _ = a(); }
     ,
-        ".tmp_source.zig:1:12: error: expected type 'i32', found 'void'",
+        ".tmp_source.zig:1:12: error: expected 'i32' type, found 'void'",
     );
 
     cases.add(
@@ -1936,7 +1967,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return a;
         \\}
     ,
-        ".tmp_source.zig:3:12: error: expected type 'i32', found '[*]const u8'",
+        ".tmp_source.zig:3:12: error: expected 'i32' type, found '[*]const u8'",
     );
 
     cases.add(
@@ -1945,7 +1976,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    if (0) {}
         \\}
     ,
-        ".tmp_source.zig:2:9: error: expected type 'bool', found 'comptime_int'",
+        ".tmp_source.zig:2:9: error: expected 'bool' type, found 'comptime_int'",
     );
 
     cases.add(
@@ -2040,8 +2071,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    array[bad] = array[bad];
         \\}
     ,
-        ".tmp_source.zig:4:11: error: expected type 'usize', found 'bool'",
-        ".tmp_source.zig:4:24: error: expected type 'usize', found 'bool'",
+        ".tmp_source.zig:4:11: error: expected 'usize' type, found 'bool'",
+        ".tmp_source.zig:4:24: error: expected 'usize' type, found 'bool'",
     );
 
     cases.add(
@@ -2455,7 +2486,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\fn foo() *const i32 { return y; }
         \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
     ,
-        ".tmp_source.zig:3:30: error: expected type '*const i32', found '*const comptime_int'",
+        ".tmp_source.zig:3:30: error: expected '*const i32' type, found '*const comptime_int'",
     );
 
     cases.add(
@@ -2533,7 +2564,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\fn c() i32 {return 2;}
         \\export fn entry() usize { return @sizeOf(@typeOf(fns)); }
     ,
-        ".tmp_source.zig:1:27: error: expected type 'fn() void', found 'fn() i32'",
+        ".tmp_source.zig:1:27: error: expected 'fn() void' type, found 'fn() i32'",
     );
 
     cases.add(
@@ -2545,7 +2576,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(fns)); }
     ,
-        ".tmp_source.zig:1:36: error: expected type 'fn(i32) i32', found 'extern fn(i32) i32'",
+        ".tmp_source.zig:1:36: error: expected 'fn(i32) i32' type, found 'extern fn(i32) i32'",
     );
 
     cases.add(
@@ -2649,7 +2680,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(a)); }
     ,
-        ".tmp_source.zig:1:16: error: expected type '*u8', found '(null)'",
+        ".tmp_source.zig:1:16: error: expected '*u8' type, found '(null)'",
     );
 
     cases.add(
@@ -3289,7 +3320,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\fn something() anyerror!void { }
     ,
-        ".tmp_source.zig:2:5: error: expected type 'void', found 'anyerror'",
+        ".tmp_source.zig:2:5: error: expected 'void' type, found 'anyerror'",
         ".tmp_source.zig:1:15: note: return type declared here",
     );
 
@@ -3468,7 +3499,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    derp.init();
         \\}
     ,
-        ".tmp_source.zig:14:5: error: expected type 'i32', found 'Foo'",
+        ".tmp_source.zig:14:5: error: expected 'i32' type, found 'Foo'",
     );
 
     cases.add(
@@ -3498,7 +3529,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    x.init();
         \\}
     ,
-        ".tmp_source.zig:23:5: error: expected type '*Allocator', found '*List'",
+        ".tmp_source.zig:23:5: error: expected '*Allocator' type, found '*List'",
     );
 
     cases.add(
@@ -3670,7 +3701,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
     ,
-        ".tmp_source.zig:8:26: error: expected type '*const u3', found '*align(:3:1) const u3'",
+        ".tmp_source.zig:8:26: error: expected '*const u3' type, found '*align(:3:1) const u3'",
     );
 
     cases.add(
@@ -3799,7 +3830,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
     ,
-        ".tmp_source.zig:4:19: error: expected type '*[]const u8', found '*const []const u8'",
+        ".tmp_source.zig:4:19: error: expected '*[]const u8' type, found '*const []const u8'",
     );
 
     cases.addCase(x: {
@@ -3831,7 +3862,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    foo(global_array);
         \\}
     ,
-        ".tmp_source.zig:4:9: error: expected type '[]i32', found '[10]i32'",
+        ".tmp_source.zig:4:9: error: expected '[]i32' type, found '[10]i32'",
     );
 
     cases.add(
@@ -3840,7 +3871,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return @ptrCast(usize, a);
         \\}
     ,
-        ".tmp_source.zig:2:21: error: expected pointer, found 'usize'",
+        ".tmp_source.zig:2:21: error: expected Pointer type, found 'usize'",
     );
 
     cases.add(
@@ -3887,7 +3918,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return @fieldParentPtr(Foo, "a", a);
         \\}
     ,
-        ".tmp_source.zig:3:28: error: expected struct type, found 'i32'",
+        ".tmp_source.zig:3:28: error: expected Struct type, found 'i32'",
     );
 
     cases.add(
@@ -3911,7 +3942,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return @fieldParentPtr(Foo, "a", a);
         \\}
     ,
-        ".tmp_source.zig:5:38: error: expected pointer, found 'i32'",
+        ".tmp_source.zig:5:38: error: expected Pointer type, found 'i32'",
     );
 
     cases.add(
@@ -3952,7 +3983,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return @byteOffsetOf(Foo, "a",);
         \\}
     ,
-        ".tmp_source.zig:3:26: error: expected struct type, found 'i32'",
+        ".tmp_source.zig:3:26: error: expected Struct type, found 'i32'",
     );
 
     cases.add(
@@ -4066,7 +4097,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\fn bar() ?i32 { return 1; }
     ,
-        ".tmp_source.zig:2:15: error: expected type 'bool', found '?i32'",
+        ".tmp_source.zig:2:15: error: expected 'bool' type, found '?i32'",
     );
 
     cases.add(
@@ -4076,7 +4107,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\fn bar() anyerror!i32 { return 1; }
     ,
-        ".tmp_source.zig:2:15: error: expected type 'bool', found 'anyerror!i32'",
+        ".tmp_source.zig:2:15: error: expected 'bool' type, found 'anyerror!i32'",
     );
 
     cases.add(
@@ -4337,7 +4368,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return @ptrToInt(x);
         \\}
     ,
-        ".tmp_source.zig:2:22: error: expected pointer, found 'i32'",
+        ".tmp_source.zig:2:22: error: expected Pointer type, found 'i32'",
     );
 
     cases.add(
@@ -4373,7 +4404,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return x << y;
         \\}
     ,
-        ".tmp_source.zig:2:17: error: expected type 'u3', found 'u8'",
+        ".tmp_source.zig:2:17: error: expected 'u3' type, found 'u8'",
     );
 
     cases.add(
@@ -4402,7 +4433,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    x.* += 1;
         \\}
     ,
-        ".tmp_source.zig:8:13: error: expected type '*u32', found '*align(1) u32'",
+        ".tmp_source.zig:8:13: error: expected '*u32' type, found '*align(1) u32'",
     );
 
     cases.add(
@@ -4446,7 +4477,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    @alignCast(4, u32(3));
         \\}
     ,
-        ".tmp_source.zig:2:22: error: expected pointer or slice, found 'u32'",
+        ".tmp_source.zig:2:22: error: expected pointer or slice type, found 'u32'",
     );
 
     cases.add(
@@ -4459,7 +4490,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\fn alignedSmall() align(4) i32 { return 1234; }
     ,
-        ".tmp_source.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32'",
+        ".tmp_source.zig:2:35: error: expected 'fn() align(8) i32' type, found 'fn() align(4) i32'",
     );
 
     cases.add(
@@ -4471,7 +4502,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return x == 5678;
         \\}
     ,
-        ".tmp_source.zig:4:32: error: expected type '*i32', found '*align(1) i32'",
+        ".tmp_source.zig:4:32: error: expected '*i32' type, found '*align(1) i32'",
     );
 
     cases.add(
@@ -4506,7 +4537,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    bar(@ptrCast(*c_void, &x));
         \\}
     ,
-        ".tmp_source.zig:5:9: error: expected type '*Derp', found '*c_void'",
+        ".tmp_source.zig:5:9: error: expected '*Derp' type, found '*c_void'",
     );
 
     cases.add(
@@ -4552,7 +4583,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    while (!@cmpxchgWeak(i32, &x, 1234, 5678, u32(1234), u32(1234))) {}
         \\}
     ,
-        ".tmp_source.zig:3:50: error: expected type 'AtomicOrder', found 'u32'",
+        ".tmp_source.zig:3:50: error: expected 'AtomicOrder' type, found 'u32'",
     );
 
     cases.add(
@@ -4562,7 +4593,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    @export("entry", entry, u32(1234));
         \\}
     ,
-        ".tmp_source.zig:3:32: error: expected type 'GlobalLinkage', found 'u32'",
+        ".tmp_source.zig:3:32: error: expected 'GlobalLinkage' type, found 'u32'",
     );
 
     cases.add(
@@ -4739,7 +4770,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    _ = @ArgType(i32, 3);
         \\}
     ,
-        ".tmp_source.zig:2:18: error: expected function, found 'i32'",
+        ".tmp_source.zig:2:18: error: expected Fn type, found 'i32'",
     );
 
     cases.add(
@@ -4837,7 +4868,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\pub extern fn foo(format: *const u8, ...) void;
     ,
-        ".tmp_source.zig:2:9: error: expected type '*const u8', found '[5]u8'",
+        ".tmp_source.zig:2:9: error: expected '*const u8' type, found '[5]u8'",
     );
 
     cases.add(
@@ -4906,7 +4937,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var x: u2 = Small.Two;
         \\}
     ,
-        ".tmp_source.zig:9:22: error: expected type 'u2', found 'Small'",
+        ".tmp_source.zig:9:22: error: expected 'u2' type, found 'Small'",
     );
 
     cases.add(
@@ -4923,7 +4954,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var x = @intToEnum(Small, y);
         \\}
     ,
-        ".tmp_source.zig:10:31: error: expected type 'u2', found 'u3'",
+        ".tmp_source.zig:10:31: error: expected 'u2' type, found 'u3'",
     );
 
     cases.add(
@@ -5320,7 +5351,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    asm volatile ("" : : [bar]"r"(3) : "");
         \\}
     ,
-        ".tmp_source.zig:2:35: error: expected sized integer or sized float, found comptime_int",
+        ".tmp_source.zig:2:35: error: expected sized integer or sized float type, found comptime_int",
     );
 
     cases.add(
@@ -5329,6 +5360,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    asm volatile ("" : : [bar]"r"(3.17) : "");
         \\}
     ,
-        ".tmp_source.zig:2:35: error: expected sized integer or sized float, found comptime_float",
+        ".tmp_source.zig:2:35: error: expected sized integer or sized float type, found comptime_float",
     );
 }