-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[WIP | SE] [Parse][Sema] Optional iteration #19207
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
Conversation
include/swift/AST/Stmt.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the whitespace-only diffs like this one (and several others).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are from the last gardening commit (extra whitespaces I noticed while working on the proposal), I intendedly separated them. You still want me to remove the commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you could replace it with just the typo fixes.
@swift-ci build toolchain |
Linux Toolchain (Ubuntu 16.04) Install command |
macOS Toolchain Install command |
… for-in loop. Adapt 'callWitness' to build optional evaluation expressions when needed.
Amend the 'must be unwrapped' error when a optional sequence is used in a for-in loop. The additional and preferred fixit becomes 'use for?'. This is a problem since we don't have a way to propagate the stmt to CSDiagnostics.cpp, where this diagnostic is emitted. But we don't really need to: in the case of for-in loops, this error can be diagnosed outside of the constraint system. Currently, it is diagnosed in 'performStmtDiagnostics' in MiscDiagnostics.cpp. However, I had to ultimalety #include ConstraintSystem.h to be able to call the fixit methods and avoid duplicating logic.
60569d7
to
a8db4df
Compare
@rudkx What's the best place for tests that check the functioning of statements, i.e. let array: [Int]? = [1, 2, 3]
var counter = 0
for? _ in array { counter += 1 }
expectEqual(counter, 3) |
@AnthonyLatsis People have been dropping small executable tests into |
Does that mean that we currently mainly rely on the standard library tests to verify that language constructs function correctly? |
I haven't looked closely but yes I think standard library testing and benchmark testing account for most of the executable test cycles run. |
SE - swiftlang/swift-evolution#878
Beta version.
TODO
ConstriaintSystem.h
inMiscDiagnostics.cpp
to reach necessary diagnostics APIs (diagnoseUnwrap
).