https://issues.dlang.org/show_bug.cgi?id=12606
--- Comment #6 from Kenji Hara <[email protected]> --- (In reply to Andrej Mitrovic from comment #2) > For example, in 'implicitConvTo' in the visitor functions 'result' is simply > initialized to MATCHnomatch if the dimensions of the two slices don't match. > But this isn't propagate back to the caller side. If e->implicitConvTo(t) returns MATCHnomatch, e->implicitCastTo(sc, t) should cause error which represents why e does not match to t. So, the following compiler code form would be sufficient. e = e->implicitCastTo(sc, t); or: if (e->implicitConvTo(t)) { e = e->implicitCastTo(sc, t); assert(e->op != TOKerror); // always succeeds } else { // extra handling for the unmatch, if e and t have known forms. if (...) { error("more better diagnostic for particular case"); e = new ErrorExp(); } // error report for generic case // (if e is already an ErrorExp, no redundant error generated) e = e->implicitCastTo(sc, t); } --
