<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I’m trying to solve SR-4715, which is about improving the fixit for the diagnostic about out-of-order arguments. Currently I’m stuck with an issue where I can’t figure out the end of an argument expression in the TupleExpr that I have. <div class=""><br class=""></div><div class="">It would seem that this should work:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">auto tuple = cast<TupleExpr>(ArgExpr);</div><div class="">auto end = tuple->getElement(argIdx)->getEndLoc();</div></blockquote><div class=""><br class=""></div><div class="">but I have one unit test that’s failing because the range of the argument is incorrect. The only difference I can see in that test, compared to the similar ones that are passing is that the argument is a number with more than one digit. Looking at NumberLiteralExpr (the superclass of IntegerLiteralExpr) I can see that getSourceRange() only returns the DigitsLoc source location, not a range with a length. </div><div class=""><br class=""></div><div class="">If I instead get the CharSourceRange for that range, and get the End source location from that, it get’s me the location that I’m after:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">auto end = Lexer::getCharSourceRangeFromSourceRange(</div><div class=""> TC.Context.SourceMgr, </div><div class=""> tuple->getElement(argIdx)->getSourceRange()</div><div class="">).getEnd(); </div></blockquote><div class=""><br class=""></div><div class="">Is this the correct way to get the location of the end of a multi digit NumberLiteralExpr or should the first approach have worked? </div><div class=""><br class=""></div><div class="">Perhaps I don’t understand the distinction between SourceRange and CharSourceRange. Is SourceRange the location of the token (where Start and End would be the same) and CharSourceRange the location of the characters?</div><div class=""><br class=""></div><div class="">Kind regards,</div><div class="">David</div></body></html>