From 1cfcb62fa11e2f57fb982500c7df810826988dfc Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 30 Jan 2016 12:03:16 -0800 Subject: 2617 - better error messages When we stash a value, mu does several levels of work for us: a) First it inserts instructions above the stash to convert the value to text using to-text-line. b) to-text-line calls to-text. Both are shape-shifting, so multiple levels of specialization happen. To give a good error message, we track the 'stack' of current specializations at the time of the error, and also check if the offending instruction at the top-most level looks like it was inserted while rewriting stash instructions. Manual example (since booleans can't be stashed at the moment): x:boolean <- copy 1/true stash x --- 011load.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '011load.cc') diff --git a/011load.cc b/011load.cc index 2c99bfff..dd1f9369 100644 --- a/011load.cc +++ b/011load.cc @@ -75,8 +75,10 @@ void slurp_body(istream& in, recipe& result) { while (next_instruction(in, &curr)) { // End Rewrite Instruction(curr, recipe result) trace(9992, "load") << "after rewriting: " << curr.to_string() << end(); - if (!curr.is_clear()) + if (!curr.is_clear()) { + curr.original_string = curr.to_string(); result.steps.push_back(curr); + } } } -- cgit 1.4.1-2-gfad0