Link: Fix channel.read*(type) to throw EOF errors by benharsh · Pull Request #20037 · chapel-lang/chapel · GitHub
Merge pull request #20037 from benharsh/read-type-throws
Fix channel.read*(type) to throw EOF errors
This PR updates various channel.read* methods that accept a type to throw EOF errors rather than silently dropping them. A helper method channel._readInner is introduced to implement this change, which is essentially a version of channel.read(ref args...) that throws EOF errors rather than returning a bool. The channel.read*( methods that accept type arguments are updated to invoke this helper method directly, so that any errors are propagated upwards.
This PR also removes a couple of old comments about EOF errors being difficult to handle. These comments predated error handling and were likely written to emphasize that there was in fact no reliable way to handle such errors for these type-argument methods. With the advent of error handling such errors could have been handled, but the implementations of these methods were not updated, and so the old comment was inadvertently still accurate.
This PR adds a test to lock in this expected behavior.
Modified Files: A test/io/bharshbarg/readTypeEOF.chpl