-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Implement 'join' for optional types and a special case for 'nil'. #4408
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
Implement 'join' for optional types and a special case for 'nil'. #4408
Conversation
@swift-ci please test macOS |
@@ -1,4 +1,4 @@ | |||
//===--- TypeJoinMeet.cpp - Swift Type "Join" and "Meet" -----------------===// | |||
//===--- TypeJoinjoin.cpp - Swift Type "Join" and "join" -----------------===// |
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.
sed gone wild, heh.
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.
Doug is hereby enmeeted from using sed
again.
Drat! Will fix. |
I'm not a type checker expert but everything else looks good. |
This isn't specifically addressing any regression that I know of (I originally thought it did), so probably not for 3.0. Whaddya think, @rudkx ? |
…e for 'nil'. The join operation for optional types is straightforward to define/implement: join(T?, U) ::= join(T, U)? join(T, U?) ::= join(T, U)? join(T?, U?) ::= join(T, U)? As a special case in the constraint solver, handle the join of a 'nil' literal with a non-ExpressibleByNilLiteral-conforming concrete type 'T' to produce 'T?'. This allows us, e.g., infer [String?] for the expressions ["hello", nil] and true ? "hello" nil for example. Fixes rdar://problem/16326914.
e87226b
to
78b7bb4
Compare
Force-merging; the CI shouldn't pay for my comment fixes. |
@DougGregor Yeah, I don't think we need to take this now. |
Handle `swift_once` workaround in a proper way
What's in this pull request?
The join operation for optional types is straightforward to define/implement:
As a special case in the constraint solver, handle the join of a 'nil'
literal with a non-ExpressibleByNilLiteral-conforming concrete type
'T' to produce 'T?'. This allows us, e.g., infer [String?] for the
expressions
and
for example.
Resolved bug number: (rdar://problem/16326914)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
A smoke test on macOS does the following:
device standard libraries are not built.
version of these tests are not run.
A smoke test on Linux does the following:
tests are not run.
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.