Skip to content

Commit

Permalink
* more nuanced subs / slice error message
Browse files Browse the repository at this point in the history
* fixes ticket 913
  • Loading branch information
matthewwalkerlewis committed Feb 2, 2015
1 parent 1944129 commit d14bb91
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion source/be_rterror.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,15 @@ static void LookBackForSubscriptSymbol( intptr_t *pc, int sublevel, int has_slic
}
}
else{
snprintf(TPTempBuff, TPTEMP_BUFF_SIZE, " - in %s of desequencing operation", has_slice ? "slice/subscript" : "subscript" );
if( *pc == rhs_subs || *pc == rhs_subs_check ){
symtab_ptr assign_to = *(pc+3);
if( assign_to->name ){
snprintf(TPTempBuff, TPTEMP_BUFF_SIZE, " - in assignment to '%s'", assign_to->name );
sf_output( TPTempBuff );
return;
}
}
snprintf(TPTempBuff, TPTEMP_BUFF_SIZE, " - in %s #%d", has_slice ? "slice/subscript" : "subscript", sublevel);
sf_output( TPTempBuff );
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/t_c_deseq_func.d/control.err
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
t_c_deseq_func.e:10
subscript value 4 is out of bounds, reading from a sequence of length 3 - in subscript of desequencing operation
subscript value 4 is out of bounds, reading from a sequence of length 3 - in assignment to 'd'


Public & Export & Global & Local Variables
Expand Down
2 changes: 1 addition & 1 deletion tests/t_c_deseq_seq.d/control.err
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
t_c_deseq_seq.e:4
subscript value 1 is out of bounds, reading from a sequence of length 0 - in subscript of desequencing operation
subscript value 1 is out of bounds, reading from a sequence of length 0 - in assignment to 'a'


Public & Export & Global & Local Variables

0 comments on commit d14bb91

Please sign in to comment.