Skip to content

Conversation

AnthonyLatsis
Copy link
Collaborator

@AnthonyLatsis AnthonyLatsis commented Sep 8, 2018

SE - swiftlang/swift-evolution#878

Beta version.

TODO

  • Figure out where to add executable tests.
  • Add more comments, get rid of debug prints.
  • Think about what can be done to avoid including ConstriaintSystem.h in MiscDiagnostics.cpp to reach necessary diagnostics APIs (diagnoseUnwrap).

@AnthonyLatsis AnthonyLatsis changed the title [WIP][Parse][Sema] Optional iteration [WIP | SE] [Parse][Sema] Optional iteration Sep 9, 2018
Copy link
Contributor

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).

Copy link
Collaborator Author

@AnthonyLatsis AnthonyLatsis Sep 10, 2018

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?

Copy link
Contributor

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.

@DougGregor
Copy link
Member

@swift-ci build toolchain

@swift-ci
Copy link
Contributor

Linux Toolchain (Ubuntu 16.04)
Download Toolchain
Git Sha - 60569d71db658b5a3f694af7daa46f388be59f8f

Install command
tar zxf swift-PR-19207-53-ubuntu16.04.tar.gz
More info

@swift-ci
Copy link
Contributor

macOS Toolchain
Download Toolchain
Git Sha - 60569d71db658b5a3f694af7daa46f388be59f8f

Install command
tar -zxf swift-PR-19207-67-osx.tar.gz --directory ~/

… 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.
@AnthonyLatsis
Copy link
Collaborator Author

@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) 

@rudkx
Copy link
Contributor

rudkx commented Sep 14, 2018

@AnthonyLatsis People have been dropping small executable tests into test/Interpreter but I don't think that's ideal. The Development | Compiler forum might be a good place to discuss whether there is a better organization for executable tests.

@AnthonyLatsis
Copy link
Collaborator Author

Does that mean that we currently mainly rely on the standard library tests to verify that language constructs function correctly?

@rudkx
Copy link
Contributor

rudkx commented Sep 14, 2018

I haven't looked closely but yes I think standard library testing and benchmark testing account for most of the executable test cycles run.

@AnthonyLatsis AnthonyLatsis deleted the optional-iteration branch February 17, 2022 21:04
@AnthonyLatsis AnthonyLatsis restored the optional-iteration branch February 17, 2022 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants