https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1073 --- Comment #1 from Mihael Hategan <[email protected]> 2013-08-25 13:30:35 --- Hmm. I think there is a deeper problem there. readData does not have a static return type. It is inferred by looking at the lvalue. So when you have: int v; v = readData(...); It's obvious that readData should return an int and a check is made a run-time to make sure that is the case (or at least I hope that check is made). In the case of an expression, the type that readData should return cannot be clearly inferred, since multiple types may be valid in the expression term where readData appears. For example: sum = readData(f1) + readData(f2); Here, the terms can be either ints, or floats, or strings, some combinations being valid, some not. I propose that a different error message be printed in this case: "Cannot infer function return type for 'readData' at x.swift, line y. Assign the result from 'readData' to a variable instead of using it directly in an expression." That's pretty easy to do. An alternative would be to support type casting in such situations: sum = (int) readData(f1) + (int) readData(f2); I am not sure if the parser already supports this, so it might be easy or hard to add. -- Configure bugmail: https://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.