aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjoachimschmidt557 <joachim.schmidt557@outlook.com>2021-06-19 17:16:24 +0800
committerjoachimschmidt557 <joachim.schmidt557@outlook.com>2021-08-04 09:27:48 +0200
commit0bef271e75657195145a519199ce12b97db246f4 (patch)
tree34cb8a6378e15d87345ab037ee836a3eacb2950c /src
parentaad4598367b136a06e3569373be7da8febea7f31 (diff)
downloadzig-0bef271e75657195145a519199ce12b97db246f4.tar.gz
zig-0bef271e75657195145a519199ce12b97db246f4.zip
stage2 Sema: Add error notes to unresolvable peer types
Diffstat (limited to 'src')
-rw-r--r--src/Sema.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 753ef8fb9c..6d5480c53d 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -8398,8 +8398,15 @@ fn resolvePeerTypes(
continue;
}
- // TODO error notes pointing out each type
- return sema.mod.fail(&block.base, src, "incompatible types: '{}' and '{}'", .{ chosen_ty, candidate_ty });
+ const msg = msg: {
+ const msg = try sema.mod.errMsg(&block.base, src, "incompatible types: '{}' and '{}'", .{ chosen_ty, candidate_ty });
+ errdefer msg.destroy(sema.gpa);
+ // TODO add error notes
+ // try sema.mod.errNote(&block.base, chosen.src, msg, "type '{}' here", .{chosen_ty});
+ // try sema.mod.errNote(&block.base, candidate.src, msg, "type '{}' here", .{candidate_ty});
+ break :msg msg;
+ };
+ return sema.mod.failWithOwnedErrorMsg(&block.base, msg);
}
return sema.typeOf(chosen);