Commit 9c328b4291

Andrew Kelley <andrew@ziglang.org>
2019-01-30 04:28:33
simpler implementation of `&&` and `||` hints
This accomplishes the same goal, but with less changes, so that I can backport copy elision stuff easier.
1 parent 5bf9ffd
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 '*Derp' type, found '*Wat'#}
+      {#code_begin|test_err|expected type '*Derp', found '*Wat'#}
 const Derp = @OpaqueType();
 const Wat = @OpaqueType();
 
src/ir.cpp
@@ -9771,19 +9771,13 @@ 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, ZigTypeId wanted_type) {
+static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) {
     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 %s type, found '%s'", expected_type_str, buf_ptr(&type_value->value.type->name)));
+        ir_add_error(ira, type_value,
+                buf_sprintf("expected type 'type', found '%s'", buf_ptr(&type_value->value.type->name)));
         return ira->codegen->builtin_types.entry_invalid;
     }
 
@@ -9792,16 +9786,35 @@ static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value, ZigTy
         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;
+static ZigType *ir_resolve_error_set_type(IrAnalyze *ira, IrInstruction *op_source, IrInstruction *type_value) {
+    if (type_is_invalid(type_value->value.type))
+        return ira->codegen->builtin_types.entry_invalid;
 
-    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)));
+    if (type_value->value.type->id != ZigTypeIdMetaType) {
+        ErrorMsg *msg = ir_add_error(ira, type_value,
+                buf_sprintf("expected error set type, found '%s'", buf_ptr(&type_value->value.type->name)));
+        add_error_note(ira->codegen, msg, op_source->source_node,
+                buf_sprintf("`||` merges error sets; `or` performs boolean OR"));
         return ira->codegen->builtin_types.entry_invalid;
     }
 
-    return out_type;
+    ConstExprValue *const_val = ir_resolve_const(ira, type_value, UndefBad);
+    if (!const_val)
+        return ira->codegen->builtin_types.entry_invalid;
+
+    assert(const_val->data.x_type != nullptr);
+    ZigType *result_type = const_val->data.x_type;
+    if (result_type->id != ZigTypeIdErrorSet) {
+        ErrorMsg *msg = ir_add_error(ira, type_value,
+                buf_sprintf("expected error set type, found type '%s'", buf_ptr(&result_type->name)));
+        add_error_note(ira->codegen, msg, op_source->source_node,
+                buf_sprintf("`||` merges error sets; `or` performs boolean OR"));
+        return ira->codegen->builtin_types.entry_invalid;
+    }
+    return result_type;
 }
 
 static ZigFn *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) {
@@ -11001,7 +11014,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 '%s' type, found '%s'",
+        buf_sprintf("expected type '%s', 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);
@@ -12229,7 +12242,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 '%s' type, found '%s'",
+            ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'",
                         buf_ptr(&child_type->name),
                         buf_ptr(&op2->value.type->name)));
             return ira->codegen->invalid_instruction;
@@ -12243,7 +12256,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 '%s' type, found '%s'",
+            ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'",
                         buf_ptr(&child_type->name),
                         buf_ptr(&op2->value.type->name)));
             return ira->codegen->invalid_instruction;
@@ -12254,7 +12267,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 '%s' type, found '%s'",
+            ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'",
                         buf_ptr(&child_type->name),
                         buf_ptr(&op2->value.type->name)));
             return ira->codegen->invalid_instruction;
@@ -12268,7 +12281,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 type, found '%s'", buf_ptr(&op2->value.type->name)));
+            buf_sprintf("expected array or C string literal, found '%s'", buf_ptr(&op2->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -12403,19 +12416,11 @@ 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, 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`?")
-                          );
-        }
+    ZigType *op1_type = ir_resolve_error_set_type(ira, &instruction->base, instruction->op1->child);
+    if (type_is_invalid(op1_type))
         return ira->codegen->invalid_instruction;
-    }
 
-    ZigType *op2_type = ir_resolve_type(ira, instruction->op2->child, ZigTypeIdErrorSet);
+    ZigType *op2_type = ir_resolve_error_set_type(ira, &instruction->base, instruction->op2->child);
     if (type_is_invalid(op2_type))
         return ira->codegen->invalid_instruction;
 
@@ -12506,7 +12511,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, ZigTypeIdInvalid);
+        ZigType *proposed_type = ir_resolve_type(ira, var_type);
         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;
@@ -12835,14 +12840,21 @@ static IrInstruction *ir_analyze_instruction_error_union(IrAnalyze *ira,
 {
     Error err;
 
-    ZigType *err_set_type = ir_resolve_type(ira, instruction->err_set->child, ZigTypeIdErrorSet);
+    ZigType *err_set_type = ir_resolve_type(ira, instruction->err_set->child);
     if (type_is_invalid(err_set_type))
         return ira->codegen->invalid_instruction;
 
-    ZigType *payload_type = ir_resolve_type(ira, instruction->payload->child, ZigTypeIdInvalid);
+    ZigType *payload_type = ir_resolve_type(ira, instruction->payload->child);
     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);
@@ -12904,7 +12916,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 type, found '%s'", buf_ptr(&alloc_fn_type->name)));
+                buf_sprintf("expected allocation function, found '%s'", buf_ptr(&alloc_fn_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -13696,7 +13708,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, ZigTypeIdInvalid);
+            ZigType *dest_type = ir_resolve_type(ira, fn_ref);
             if (type_is_invalid(dest_type))
                 return ira->codegen->invalid_instruction;
 
@@ -13821,7 +13833,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, ZigTypeIdInvalid);
+    ZigType *type_entry = ir_resolve_type(ira, value);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
     if ((err = ensure_complete_type(ira->codegen, type_entry)))
@@ -15304,10 +15316,16 @@ 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, ZigTypeIdPointer);
+    ZigType *type_entry = ir_resolve_type(ira, type_value);
     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);
 }
 
@@ -15460,7 +15478,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, ZigTypeIdInvalid);
+    ZigType *child_type = ir_resolve_type(ira, slice_type_instruction->child_type->child);
     if (type_is_invalid(child_type))
         return ira->codegen->invalid_instruction;
 
@@ -15543,7 +15561,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], ZigTypeIdInvalid);
+            return_type = ir_resolve_type(ira, output_types[i]);
             if (type_is_invalid(return_type))
                 return ira->codegen->invalid_instruction;
         }
@@ -15558,7 +15576,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 type, found %s", buf_ptr(&input_value->value.type->name)));
+                buf_sprintf("expected sized integer or sized float, found %s", buf_ptr(&input_value->value.type->name)));
             return ira->codegen->invalid_instruction;
         }
 
@@ -15584,7 +15602,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, ZigTypeIdInvalid);
+    ZigType *child_type = ir_resolve_type(ira, child_type_value);
     if (type_is_invalid(child_type))
         return ira->codegen->invalid_instruction;
     switch (child_type->id) {
@@ -15633,7 +15651,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, ZigTypeIdInvalid);
+        ZigType *payload_type = ir_resolve_type(ira, instruction->payload_type->child);
         if (type_is_invalid(payload_type))
             return ira->codegen->invalid_instruction;
 
@@ -15648,7 +15666,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, ZigTypeIdInvalid);
+    ZigType *type_entry = ir_resolve_type(ira, type_value);
 
     if ((err = ensure_complete_type(ira->codegen, type_entry)))
         return ira->codegen->invalid_instruction;
@@ -16483,7 +16501,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, ZigTypeIdInvalid);
+        ZigType *container_type = ir_resolve_type(ira, container_type_value);
         if (type_is_invalid(container_type))
             return ira->codegen->invalid_instruction;
 
@@ -16599,7 +16617,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, ZigTypeIdInvalid);
+    ZigType *container_type = ir_resolve_type(ira, container_type_value);
     if (type_is_invalid(container_type))
         return ira->codegen->invalid_instruction;
 
@@ -16717,7 +16735,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, ZigTypeIdStruct);
+    ZigType *container_type = ir_resolve_type(ira, type_value);
     if (type_is_invalid(container_type))
         return ira->codegen->invalid_instruction;
 
@@ -16730,6 +16748,12 @@ 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;
 
@@ -16743,7 +16767,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 type, found '%s'", buf_ptr(&field_ptr->value.type->name)));
+                buf_sprintf("expected pointer, found '%s'", buf_ptr(&field_ptr->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -16802,9 +16826,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, ZigTypeIdStruct);
+    ZigType *container_type = ir_resolve_type(ira, type_value);
     if (type_is_invalid(container_type))
         return nullptr;
 
@@ -16816,6 +16840,12 @@ 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,
@@ -17793,7 +17823,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, ZigTypeIdInvalid);
+    ZigType *type_entry = ir_resolve_type(ira, type_value);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
 
@@ -17821,7 +17851,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, ZigTypeIdInvalid);
+    ZigType *type_entry = ir_resolve_type(ira, type_value);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
 
@@ -17856,7 +17886,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, ZigTypeIdInvalid);
+    ZigType *type_entry = ir_resolve_type(ira, type_value);
     if (type_is_invalid(type_entry))
         return ira->codegen->invalid_instruction;
 
@@ -18133,7 +18163,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, ZigTypeIdInvalid);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18186,7 +18216,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, ZigTypeIdInvalid);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18219,7 +18249,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, ZigTypeIdInvalid);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18259,10 +18289,16 @@ 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, ZigTypeIdErrorSet);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
     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;
@@ -18291,7 +18327,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, ZigTypeIdInvalid);
+    ZigType *dest_child_type = ir_resolve_type(ira, instruction->dest_child_type->child);
     if (type_is_invalid(dest_child_type))
         return ira->codegen->invalid_instruction;
 
@@ -18388,7 +18424,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 type, found '%s'", buf_ptr(&target->value.type->name)));
+                buf_sprintf("expected slice, found '%s'", buf_ptr(&target->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -18407,7 +18443,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, ZigTypeIdInvalid);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18425,7 +18461,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, ZigTypeIdInvalid);
+    ZigType *dest_type = ir_resolve_type(ira, instruction->dest_type->child);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -18481,7 +18517,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 type, found '%s'",
+        ir_add_error(ira, instruction->target, buf_sprintf("expected bool, found '%s'",
                     buf_ptr(&target->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
@@ -19062,7 +19098,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, ZigTypeIdInvalid);
+    ZigType *container_type = ir_resolve_type(ira, container);
 
     if ((err = ensure_complete_type(ira->codegen, container_type)))
         return ira->codegen->invalid_instruction;
@@ -19096,7 +19132,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, ZigTypeIdInvalid);
+    ZigType *container_type = ir_resolve_type(ira, container_type_value);
     if (type_is_invalid(container_type))
         return ira->codegen->invalid_instruction;
 
@@ -19139,7 +19175,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, ZigTypeIdInvalid);
+    ZigType *container_type = ir_resolve_type(ira, container_type_value);
     if (type_is_invalid(container_type))
         return ira->codegen->invalid_instruction;
 
@@ -19232,7 +19268,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, ZigTypeIdInvalid);
+    ZigType *type_entry = ir_resolve_type(ira, type_value);
 
     if ((err = type_resolve(ira->codegen, type_entry, ResolveStatusAlignmentKnown)))
         return ira->codegen->invalid_instruction;
@@ -19282,10 +19318,16 @@ 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, ZigTypeIdInt);
+    ZigType *dest_type = ir_resolve_type(ira, type_value);
     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;
@@ -19555,7 +19597,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, ZigTypeIdInvalid);
+            ZigType *param_type = ir_resolve_type(ira, param_type_value);
             switch (type_requires_comptime(ira->codegen, param_type)) {
             case ReqCompTimeYes:
                 if (!calling_convention_allows_zig_types(fn_type_id.cc)) {
@@ -19589,7 +19631,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, ZigTypeIdInvalid);
+    fn_type_id.return_type = ir_resolve_type(ira, return_type_value);
     if (type_is_invalid(fn_type_id.return_type))
         return ira->codegen->invalid_instruction;
     if (fn_type_id.return_type->id == ZigTypeIdOpaque) {
@@ -19605,7 +19647,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, ZigTypeIdInvalid);
+        fn_type_id.async_allocator_type = ir_resolve_type(ira, async_allocator_type_value);
         if (type_is_invalid(fn_type_id.async_allocator_type))
             return ira->codegen->invalid_instruction;
     }
@@ -19913,7 +19955,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 type, found '%s'", buf_ptr(&target_type->name)));
+                buf_sprintf("expected pointer or slice, found '%s'", buf_ptr(&target_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -19959,13 +20001,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 type, found '%s'", buf_ptr(&src_type->name)));
+        ir_add_error(ira, ptr, buf_sprintf("expected pointer, 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 type, found '%s'", buf_ptr(&dest_type->name)));
+                buf_sprintf("expected pointer, found '%s'", buf_ptr(&dest_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -20033,7 +20075,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, ZigTypeIdInvalid);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -20229,7 +20271,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, ZigTypeIdInvalid);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
     if (type_is_invalid(dest_type))
         return ira->codegen->invalid_instruction;
 
@@ -20326,13 +20368,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, ZigTypeIdInvalid);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
     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 type, found '%s'", buf_ptr(&dest_type->name)));
+        ir_add_error(ira, dest_type_value, buf_sprintf("expected pointer, found '%s'", buf_ptr(&dest_type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -20435,7 +20477,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 type, found '%s'", buf_ptr(&target->value.type->name)));
+                buf_sprintf("expected pointer, found '%s'", buf_ptr(&target->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -20466,7 +20508,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, ZigTypeIdInvalid);
+    ZigType *child_type = ir_resolve_type(ira, instruction->child_type->child);
     if (type_is_invalid(child_type))
         return ira->codegen->invalid_instruction;
 
@@ -20565,7 +20607,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, ZigTypeIdFn);
+    ZigType *fn_type = ir_resolve_type(ira, fn_type_inst);
     if (type_is_invalid(fn_type))
         return ira->codegen->invalid_instruction;
 
@@ -20574,6 +20616,11 @@ 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,
@@ -20598,7 +20645,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, ZigTypeIdInvalid);
+    ZigType *enum_type = ir_resolve_type(ira, target_inst);
     if (type_is_invalid(enum_type))
         return ira->codegen->invalid_instruction;
 
@@ -20623,7 +20670,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 type, found '%s'",
+        ir_add_error(ira, target_inst, buf_sprintf("expected enum or union, found '%s'",
             buf_ptr(&enum_type->name)));
         return ira->codegen->invalid_instruction;
     }
@@ -20777,7 +20824,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 type, found '%s'",
+        ir_add_error(ira, &instruction->base, buf_sprintf("expected promise->T, found '%s'",
                     buf_ptr(&coro_handle->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
@@ -20808,7 +20855,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, ZigTypeIdInvalid);
+    ZigType *operand_type = ir_resolve_type(ira, op);
     if (type_is_invalid(operand_type))
         return ira->codegen->builtin_types.entry_invalid;
 
@@ -20938,12 +20985,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, ZigTypeIdInvalid);
+    ZigType *promise_type = ir_resolve_type(ira, instruction->promise_type->child);
     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 type, found '%s'",
+        ir_add_error(ira, &instruction->base, buf_sprintf("expected promise->T, found '%s'",
                     buf_ptr(&promise_type->name)));
         return ira->codegen->invalid_instruction;
     }
@@ -20952,7 +20999,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, ZigTypeIdInvalid);
+    ZigType *promise_result_type = ir_resolve_type(ira, instruction->promise_result_type->child);
     if (type_is_invalid(promise_result_type))
         return ira->codegen->invalid_instruction;
 
@@ -21015,7 +21062,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, ZigTypeIdInvalid);
+    ZigType *float_type = ir_resolve_type(ira, instruction->type->child);
     if (type_is_invalid(float_type))
         return ira->codegen->invalid_instruction;
 
@@ -21082,7 +21129,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, ZigTypeIdInvalid);
+    ZigType *int_type = ir_resolve_type(ira, instruction->type->child);
     if (type_is_invalid(int_type))
         return ira->codegen->invalid_instruction;
 
@@ -21138,7 +21185,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, ZigTypeIdInvalid);
+    ZigType *int_type = ir_resolve_type(ira, instruction->type->child);
     if (type_is_invalid(int_type))
         return ira->codegen->invalid_instruction;
 
@@ -21209,7 +21256,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 type, found '%s'", buf_ptr(&target->value.type->name)));
+            buf_sprintf("expected enum, found type '%s'", buf_ptr(&target->value.type->name)));
         return ira->codegen->invalid_instruction;
     }
 
@@ -21224,10 +21271,16 @@ 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, ZigTypeIdEnum);
+    ZigType *dest_type = ir_resolve_type(ira, dest_type_value);
     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,37 +122,19 @@ static AstNode *ast_parse_container_decl_type(ParseContext *pc);
 static AstNode *ast_parse_byte_align(ParseContext *pc);
 
 ATTRIBUTE_PRINTF(3, 4)
-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, ...) {
+static void 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;
 
-    if (note) {
-      err->notes.append(note);
-    }
-
     print_err_msg(err, pc->err_color);
     exit(EXIT_FAILURE);
 }
@@ -182,7 +164,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_exit(pc, token, NULL, "invalid token: '%s'", buf_ptr(&token_value));
+    ast_error(pc, token, "invalid token: '%s'", buf_ptr(&token_value));
 }
 
 static AstNode *ast_create_node_no_line_info(ParseContext *pc, NodeType type) {
@@ -232,13 +214,8 @@ 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) {
-        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));
-    }
+    if (res->id != id)
+        ast_error(pc, res, "expected token '%s', found '%s'", token_name(id), token_name(res->id));
 
     return res;
 }
@@ -860,7 +837,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_exit(pc, first, NULL, "Function prototype have varargs as a none last paramter.");
+            ast_error(pc, first, "Function prototype have varargs as a none last paramter.");
     }
     return res;
 }
src/tokenizer.cpp
@@ -199,7 +199,6 @@ enum TokenizeState {
     TokenizeStateSawDash,
     TokenizeStateSawMinusPercent,
     TokenizeStateSawAmpersand,
-    TokenizeStateSawAmpersandAmpersand,
     TokenizeStateSawCaret,
     TokenizeStateSawBar,
     TokenizeStateSawBarBar,
@@ -887,15 +886,14 @@ void tokenize(Buf *buf, Tokenization *out) {
                 break;
             case TokenizeStateSawAmpersand:
                 switch (c) {
+                    case '&':
+                        tokenize_error(&t, "`&&` is invalid. Note that `and` is boolean AND.");
+                        break;
                     case '=':
                         set_token_id(&t, t.cur_tok, TokenIdBitAndEq);
                         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);
@@ -903,11 +901,6 @@ 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 '=':
@@ -1478,7 +1471,6 @@ void tokenize(Buf *buf, Tokenization *out) {
         case TokenizeStateSawPlus:
         case TokenizeStateSawDash:
         case TokenizeStateSawAmpersand:
-        case TokenizeStateSawAmpersandAmpersand:
         case TokenizeStateSawCaret:
         case TokenizeStateSawBar:
         case TokenizeStateSawEq:
@@ -1526,7 +1518,6 @@ 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,7 +14,6 @@
 
 enum TokenId {
     TokenIdAmpersand,
-    TokenIdAmpersandAmpersand,
     TokenIdArrow,
     TokenIdAtSign,
     TokenIdBang,
test/compile_errors.zig
@@ -2,33 +2,28 @@ 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;
+        "attempted `&&`",
+        \\export fn entry(a: bool, b: bool) i32 {
+        \\    if (a && b) {
+        \\        return 1234;
+        \\    }
+        \\    return 5678;
         \\}
     ,
-        ".tmp_source.zig:2:9: error: expected ErrorSet type, found 'comptime_int'",
-        ".tmp_source.zig:2:11: note: did you mean to use `or`?",
+        ".tmp_source.zig:2:11: error: `&&` is invalid. Note that `and` is boolean AND.",
     );
 
     cases.add(
-        "Use of || in place of `or` (using booleans)",
-        \\export fn entry() void {
-        \\    if (true || false) return;
+        "attempted `||` on boolean values",
+        \\export fn entry(a: bool, b: bool) i32 {
+        \\    if (a || b) {
+        \\        return 1234;
+        \\    }
+        \\    return 5678;
         \\}
     ,
-        ".tmp_source.zig:2:9: error: expected ErrorSet type, found 'bool'",
-        ".tmp_source.zig:2:14: note: did you mean to use `or`?",
+        ".tmp_source.zig:2:9: error: expected error set type, found 'bool'",
+        ".tmp_source.zig:2:11: note: `||` merges error sets; `or` performs boolean OR",
     );
 
     cases.add(
@@ -98,7 +93,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    do_the_thing(bar);
         \\}
     ,
-        ".tmp_source.zig:4:18: error: expected 'fn(i32) void' type, found 'fn(bool) void",
+        ".tmp_source.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void",
         ".tmp_source.zig:4:18: note: parameter 0: 'bool' cannot cast into 'i32'",
     );
 
@@ -134,7 +129,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 'u8' type, found 'u16'",
+        ".tmp_source.zig:11:20: error: expected type 'u8', found 'u16'",
     );
 
     cases.add(
@@ -154,7 +149,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(y)); }
     ,
-        ".tmp_source.zig:2:14: error: expected 'f32' type, found 'f64'",
+        ".tmp_source.zig:2:14: error: expected type 'f32', found 'f64'",
     );
 
     cases.add(
@@ -202,7 +197,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var ptr2: *c_void = &b;
         \\}
     ,
-        ".tmp_source.zig:5:26: error: expected '*c_void' type, found '**u32'",
+        ".tmp_source.zig:5:26: error: expected type '*c_void', found '**u32'",
     );
 
     cases.add(
@@ -252,7 +247,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    const sliceA: []u8 = &buffer;
         \\}
     ,
-        ".tmp_source.zig:3:27: error: expected '[]u8' type, found '*const [1]u8'",
+        ".tmp_source.zig:3:27: error: expected type '[]u8', found '*const [1]u8'",
     );
 
     cases.add(
@@ -297,9 +292,10 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    const Errors = error{} || 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'",
+        ".tmp_source.zig:2:20: error: expected error set type, found type 'u8'",
+        ".tmp_source.zig:2:23: note: `||` merges error sets; `or` performs boolean OR",
+        ".tmp_source.zig:5:31: error: expected error set type, found type 'u16'",
+        ".tmp_source.zig:5:28: note: `||` merges error sets; `or` performs boolean OR",
     );
 
     cases.add(
@@ -794,7 +790,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
             \\
             \\fn bar(x: *b.Foo) void {}
         ,
-            ".tmp_source.zig:6:10: error: expected '*Foo' type, found '*Foo'",
+            ".tmp_source.zig:6:10: error: expected type '*Foo', 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",
@@ -864,7 +860,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var y = p.*;
         \\}
     ,
-        ".tmp_source.zig:4:23: error: expected '*?*i32' type, found '**i32'",
+        ".tmp_source.zig:4:23: error: expected type '*?*i32', found '**i32'",
     );
 
     cases.add(
@@ -873,7 +869,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    const x: [*]const bool = true;
         \\}
     ,
-        ".tmp_source.zig:2:30: error: expected '[*]const bool' type, found 'bool'",
+        ".tmp_source.zig:2:30: error: expected type '[*]const bool', found 'bool'",
     );
 
     cases.add(
@@ -918,7 +914,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var rule_set = try Foo.init();
         \\}
     ,
-        ".tmp_source.zig:2:13: error: expected 'i32' type, found 'type'",
+        ".tmp_source.zig:2:13: error: expected type 'i32', found 'type'",
     );
 
     cases.add(
@@ -952,7 +948,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return null;
         \\}
     ,
-        ".tmp_source.zig:5:34: error: expected '?NextError!i32' type, found '?OtherError!i32'",
+        ".tmp_source.zig:5:34: error: expected type '?NextError!i32', 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",
@@ -1022,7 +1018,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    @panic(e);
         \\}
     ,
-        ".tmp_source.zig:3:12: error: expected '[]const u8' type, found 'error{Foo}'",
+        ".tmp_source.zig:3:12: error: expected type '[]const u8', found 'error{Foo}'",
     );
 
     cases.add(
@@ -1050,7 +1046,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return error.ShouldBeCompileError;
         \\}
     ,
-        ".tmp_source.zig:6:17: error: expected 'void' type, found 'error{ShouldBeCompileError}'",
+        ".tmp_source.zig:6:17: error: expected type 'void', found 'error{ShouldBeCompileError}'",
     );
 
     cases.add(
@@ -1093,7 +1089,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    a(c);
         \\}
     ,
-        ".tmp_source.zig:8:7: error: expected 'fn(*const u8) void' type, found 'fn(u8) void'",
+        ".tmp_source.zig:8:7: error: expected type 'fn(*const u8) void', found 'fn(u8) void'",
     );
 
     cases.add(
@@ -1175,7 +1171,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\        E.One => {},
         \\    }
         \\}
-    , ".tmp_source.zig:9:10: error: expected 'usize' type, found 'E'");
+    , ".tmp_source.zig:9:10: error: expected type 'usize', found 'E'");
 
     cases.add(
         "range operator in switch used on error set",
@@ -1221,7 +1217,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    const z = i32!i32;
         \\}
     ,
-        ".tmp_source.zig:2:15: error: expected ErrorSet type, found 'i32'",
+        ".tmp_source.zig:2:15: error: expected error set type, found type 'i32'",
     );
 
     cases.add(
@@ -1271,7 +1267,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return error.B;
         \\}
     ,
-        ".tmp_source.zig:3:35: error: expected 'SmallErrorSet!i32' type, found 'anyerror!i32'",
+        ".tmp_source.zig:3:35: error: expected type 'SmallErrorSet!i32', 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",
     );
@@ -1286,7 +1282,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return error.B;
         \\}
     ,
-        ".tmp_source.zig:3:31: error: expected 'SmallErrorSet' type, found 'anyerror'",
+        ".tmp_source.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror'",
         ".tmp_source.zig:3:31: note: cannot cast global error set into smaller set",
     );
 
@@ -1313,7 +1309,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var x: Set2 = set1;
         \\}
     ,
-        ".tmp_source.zig:7:19: error: expected 'Set2' type, found 'Set1'",
+        ".tmp_source.zig:7:19: error: expected type 'Set2', found 'Set1'",
         ".tmp_source.zig:1:23: note: 'error.B' not a member of destination error set",
     );
 
@@ -1853,7 +1849,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\fn a() noreturn {return;}
         \\export fn entry() void { a(); }
     ,
-        ".tmp_source.zig:1:18: error: expected 'noreturn' type, found 'void'",
+        ".tmp_source.zig:1:18: error: expected type 'noreturn', found 'void'",
     );
 
     cases.add(
@@ -1861,7 +1857,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\fn a() i32 {}
         \\export fn entry() void { _ = a(); }
     ,
-        ".tmp_source.zig:1:12: error: expected 'i32' type, found 'void'",
+        ".tmp_source.zig:1:12: error: expected type 'i32', found 'void'",
     );
 
     cases.add(
@@ -1967,7 +1963,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return a;
         \\}
     ,
-        ".tmp_source.zig:3:12: error: expected 'i32' type, found '[*]const u8'",
+        ".tmp_source.zig:3:12: error: expected type 'i32', found '[*]const u8'",
     );
 
     cases.add(
@@ -1976,7 +1972,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    if (0) {}
         \\}
     ,
-        ".tmp_source.zig:2:9: error: expected 'bool' type, found 'comptime_int'",
+        ".tmp_source.zig:2:9: error: expected type 'bool', found 'comptime_int'",
     );
 
     cases.add(
@@ -2071,8 +2067,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    array[bad] = array[bad];
         \\}
     ,
-        ".tmp_source.zig:4:11: error: expected 'usize' type, found 'bool'",
-        ".tmp_source.zig:4:24: error: expected 'usize' type, found 'bool'",
+        ".tmp_source.zig:4:11: error: expected type 'usize', found 'bool'",
+        ".tmp_source.zig:4:24: error: expected type 'usize', found 'bool'",
     );
 
     cases.add(
@@ -2486,7 +2482,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 '*const i32' type, found '*const comptime_int'",
+        ".tmp_source.zig:3:30: error: expected type '*const i32', found '*const comptime_int'",
     );
 
     cases.add(
@@ -2564,7 +2560,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 'fn() void' type, found 'fn() i32'",
+        ".tmp_source.zig:1:27: error: expected type 'fn() void', found 'fn() i32'",
     );
 
     cases.add(
@@ -2576,7 +2572,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(fns)); }
     ,
-        ".tmp_source.zig:1:36: error: expected 'fn(i32) i32' type, found 'extern fn(i32) i32'",
+        ".tmp_source.zig:1:36: error: expected type 'fn(i32) i32', found 'extern fn(i32) i32'",
     );
 
     cases.add(
@@ -2680,7 +2676,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(a)); }
     ,
-        ".tmp_source.zig:1:16: error: expected '*u8' type, found '(null)'",
+        ".tmp_source.zig:1:16: error: expected type '*u8', found '(null)'",
     );
 
     cases.add(
@@ -3320,7 +3316,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\fn something() anyerror!void { }
     ,
-        ".tmp_source.zig:2:5: error: expected 'void' type, found 'anyerror'",
+        ".tmp_source.zig:2:5: error: expected type 'void', found 'anyerror'",
         ".tmp_source.zig:1:15: note: return type declared here",
     );
 
@@ -3499,7 +3495,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    derp.init();
         \\}
     ,
-        ".tmp_source.zig:14:5: error: expected 'i32' type, found 'Foo'",
+        ".tmp_source.zig:14:5: error: expected type 'i32', found 'Foo'",
     );
 
     cases.add(
@@ -3529,7 +3525,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    x.init();
         \\}
     ,
-        ".tmp_source.zig:23:5: error: expected '*Allocator' type, found '*List'",
+        ".tmp_source.zig:23:5: error: expected type '*Allocator', found '*List'",
     );
 
     cases.add(
@@ -3701,7 +3697,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
     ,
-        ".tmp_source.zig:8:26: error: expected '*const u3' type, found '*align(:3:1) const u3'",
+        ".tmp_source.zig:8:26: error: expected type '*const u3', found '*align(:3:1) const u3'",
     );
 
     cases.add(
@@ -3830,7 +3826,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\
         \\export fn entry() usize { return @sizeOf(@typeOf(foo)); }
     ,
-        ".tmp_source.zig:4:19: error: expected '*[]const u8' type, found '*const []const u8'",
+        ".tmp_source.zig:4:19: error: expected type '*[]const u8', found '*const []const u8'",
     );
 
     cases.addCase(x: {
@@ -3862,7 +3858,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    foo(global_array);
         \\}
     ,
-        ".tmp_source.zig:4:9: error: expected '[]i32' type, found '[10]i32'",
+        ".tmp_source.zig:4:9: error: expected type '[]i32', found '[10]i32'",
     );
 
     cases.add(
@@ -3871,7 +3867,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return @ptrCast(usize, a);
         \\}
     ,
-        ".tmp_source.zig:2:21: error: expected Pointer type, found 'usize'",
+        ".tmp_source.zig:2:21: error: expected pointer, found 'usize'",
     );
 
     cases.add(
@@ -3918,7 +3914,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(
@@ -3942,7 +3938,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return @fieldParentPtr(Foo, "a", a);
         \\}
     ,
-        ".tmp_source.zig:5:38: error: expected Pointer type, found 'i32'",
+        ".tmp_source.zig:5:38: error: expected pointer, found 'i32'",
     );
 
     cases.add(
@@ -3983,7 +3979,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(
@@ -4097,7 +4093,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\fn bar() ?i32 { return 1; }
     ,
-        ".tmp_source.zig:2:15: error: expected 'bool' type, found '?i32'",
+        ".tmp_source.zig:2:15: error: expected type 'bool', found '?i32'",
     );
 
     cases.add(
@@ -4107,7 +4103,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\fn bar() anyerror!i32 { return 1; }
     ,
-        ".tmp_source.zig:2:15: error: expected 'bool' type, found 'anyerror!i32'",
+        ".tmp_source.zig:2:15: error: expected type 'bool', found 'anyerror!i32'",
     );
 
     cases.add(
@@ -4368,7 +4364,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return @ptrToInt(x);
         \\}
     ,
-        ".tmp_source.zig:2:22: error: expected Pointer type, found 'i32'",
+        ".tmp_source.zig:2:22: error: expected pointer, found 'i32'",
     );
 
     cases.add(
@@ -4404,7 +4400,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return x << y;
         \\}
     ,
-        ".tmp_source.zig:2:17: error: expected 'u3' type, found 'u8'",
+        ".tmp_source.zig:2:17: error: expected type 'u3', found 'u8'",
     );
 
     cases.add(
@@ -4433,7 +4429,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    x.* += 1;
         \\}
     ,
-        ".tmp_source.zig:8:13: error: expected '*u32' type, found '*align(1) u32'",
+        ".tmp_source.zig:8:13: error: expected type '*u32', found '*align(1) u32'",
     );
 
     cases.add(
@@ -4477,7 +4473,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    @alignCast(4, u32(3));
         \\}
     ,
-        ".tmp_source.zig:2:22: error: expected pointer or slice type, found 'u32'",
+        ".tmp_source.zig:2:22: error: expected pointer or slice, found 'u32'",
     );
 
     cases.add(
@@ -4490,7 +4486,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\fn alignedSmall() align(4) i32 { return 1234; }
     ,
-        ".tmp_source.zig:2:35: error: expected 'fn() align(8) i32' type, found 'fn() align(4) i32'",
+        ".tmp_source.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32'",
     );
 
     cases.add(
@@ -4502,7 +4498,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    return x == 5678;
         \\}
     ,
-        ".tmp_source.zig:4:32: error: expected '*i32' type, found '*align(1) i32'",
+        ".tmp_source.zig:4:32: error: expected type '*i32', found '*align(1) i32'",
     );
 
     cases.add(
@@ -4537,7 +4533,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    bar(@ptrCast(*c_void, &x));
         \\}
     ,
-        ".tmp_source.zig:5:9: error: expected '*Derp' type, found '*c_void'",
+        ".tmp_source.zig:5:9: error: expected type '*Derp', found '*c_void'",
     );
 
     cases.add(
@@ -4583,7 +4579,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 'AtomicOrder' type, found 'u32'",
+        ".tmp_source.zig:3:50: error: expected type 'AtomicOrder', found 'u32'",
     );
 
     cases.add(
@@ -4593,7 +4589,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    @export("entry", entry, u32(1234));
         \\}
     ,
-        ".tmp_source.zig:3:32: error: expected 'GlobalLinkage' type, found 'u32'",
+        ".tmp_source.zig:3:32: error: expected type 'GlobalLinkage', found 'u32'",
     );
 
     cases.add(
@@ -4770,7 +4766,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    _ = @ArgType(i32, 3);
         \\}
     ,
-        ".tmp_source.zig:2:18: error: expected Fn type, found 'i32'",
+        ".tmp_source.zig:2:18: error: expected function, found 'i32'",
     );
 
     cases.add(
@@ -4868,7 +4864,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\}
         \\pub extern fn foo(format: *const u8, ...) void;
     ,
-        ".tmp_source.zig:2:9: error: expected '*const u8' type, found '[5]u8'",
+        ".tmp_source.zig:2:9: error: expected type '*const u8', found '[5]u8'",
     );
 
     cases.add(
@@ -4937,7 +4933,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var x: u2 = Small.Two;
         \\}
     ,
-        ".tmp_source.zig:9:22: error: expected 'u2' type, found 'Small'",
+        ".tmp_source.zig:9:22: error: expected type 'u2', found 'Small'",
     );
 
     cases.add(
@@ -4954,7 +4950,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
         \\    var x = @intToEnum(Small, y);
         \\}
     ,
-        ".tmp_source.zig:10:31: error: expected 'u2' type, found 'u3'",
+        ".tmp_source.zig:10:31: error: expected type 'u2', found 'u3'",
     );
 
     cases.add(
@@ -5351,7 +5347,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 type, found comptime_int",
+        ".tmp_source.zig:2:35: error: expected sized integer or sized float, found comptime_int",
     );
 
     cases.add(
@@ -5360,6 +5356,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 type, found comptime_float",
+        ".tmp_source.zig:2:35: error: expected sized integer or sized float, found comptime_float",
     );
 }