New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error handling: non-inlined iterators cannot throw #7134
Comments
Issue chapel-lang#7134 indicates that throwing iterators don't currently work unless they are inlined. That means that any iterator that is used in tests in --baseline testing can't be marked throws without causing errors in that configuration. To quiet testing, this PR simply makes the two iter functions in the standard modules that throw currently not throwing. Instead, these functions use try! to halt if any error was encountered. This is intended to be a temporary change.
For now, don't mark standard module iters as throws Issue #7134 indicates that throwing iterators don't currently work unless they are inlined. That means that any iterator that is used in tests in --baseline testing can't be marked throws without causing errors in that configuration. To quiet testing, this PR simply makes the two throwing iter functions in the standard modules no longer throw. Instead, these functions use try! to halt if any error was encountered. This is intended to be a temporary change. - [x] full --baseline testing - [x] full local testing Reviewed by @psahabu - thanks!
Considering that iterator inlining is an optimization that can be disabled with And note that some iterators can be direct inlined ( |
@ronawho - right, we havn't been adding error handling to iterators in the modules for this reason. (edit - at least as far as I know). |
This is a workaround for issue chapel-lang#7134. PR chapel-lang#10642 got the compiler to consider loop-exprs to be `throwing` if they call code that throws. As a result, these loop-exprs are now iterators that throw, which are not supported in --baseline testing.
Add .skipifs for baseline mode testing for several tests This is a workaround for issue #7134. PR #10642 got the compiler to consider loop-exprs to be `throwing` if they call code that throws. As a result, these loop-exprs are now iterators that throw, which are not supported in --baseline testing. Passed full baseline testing. Trivial and not reviewed.
…14430) Make the <~> operator equivalent to `channel.read`/`channel.write` (#14430) This PR makes the <~> IO operator throw, and insofar as possible equivalent in semantics to `channel.read` and `channel.write`. There are some unavoidable differences between the two - i.e., the `channel.read` routine opts to return `false` if it hits the end of a file, instead of throwing a SystemError. If a SystemError is thrown from within IO routines up through `readThis`/`writeThis`, then the error is caught and the equivalent QIO error code is stored in the channel. If the user throws an error that is not a SystemError from within their overload of `readThis`/`writeThis`, the EIO error code is stored in the channel as a stopgap to indicate an error has occurred. As of this time there is no way to distinguish between SystemError thrown by the user and SystemError that are thrown by the Chapel IO machinery. This PR adds the `throws` keyword to all the `dsi` IO routines for arrays, as a consequence of modifying <~>. The test `test/classes/deitz/class/tree.chpl` was rewritten to use an iterative postorder traversal instead of a recursive iterator due to compilation bugs. See #7134 for details. --- Testing: - [x] ALL on linux64 when CHPL_COMM=none - [x] ALL on linux64 when CHPL_COMM=gasnet --- Thanks to @mppf for review!
As a Chapel user, I would like to be able to write iterators that throw whether they are inlined or not because I expect to be able to combine language features to achieve my goals. Additionally I would like library supported iterators, such as FileSystem.listdir, to throw errors so that I can handle them appropriately in my programs and libraries.
See for example
At the present time, only iterators that are inlined can throw. Otherwise the compiler generates an error because this code path is not implemented completely yet. This issue is a place to refer to this problem.
Perhaps the iterator lowering process should make 'throwing' those functions built from the iterator (advance, zip1, zip2, etc) that contain code that was setting the
error
argument in the original iterator.Because of this issue, some standard library iterators that should be marked
throws
instead halt on error:Tests that are skipif-ed for nightly testing with --baseline include:
These should be updated to
throw
once this issue is resolved.The text was updated successfully, but these errors were encountered: