https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1287 --- Comment #2 from Mihael Hategan <[email protected]> 2014-06-11 14:26:53 --- (In reply to comment #1)
This is not a bug, per se.
I had the same feeling at first, but I think that, while not a major issue, this should result in an unused variable warning at most.
If a variable is not assigned to, Swift assumes that its an input variable, and hence expects the mapped object to exist (ie the mapper is invoked to read the mapped dir and find any existing files).
Perhaps if the variable is neither set nor read, Swift should print a warning to that effect instead.
Mihael, is there enough info at compile time to detect this "third" case?
There should be. The compiler keeps track of variables read from (to mark them as input) and also of writes (to close when writes are done), so yes.
Either way, we should document this in the user guide (ie how Swift determines input vars vs output vars).
It's pretty simple: a variable is an input if it's never assigned to. -- Configure bugmail: https://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.