Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[stdlib] 0-ary tuples should be equatable #8354
Conversation
This comment has been minimized.
This comment has been minimized.
@swift-ci Please smoke test |
CodaFi
requested changes
Mar 26, 2017
May as well do the full monty and edit the gyb template to make tuples quasi- |
CodaFi
requested a review
from
airspeedswift
Mar 26, 2017
This comment has been minimized.
This comment has been minimized.
@CodaFi - Thanks. Just to clarify edit the .gyb to add |
This comment has been minimized.
This comment has been minimized.
You should edit the GYB template to account for the non-generic 0-ary tuple. It should be possible to do this "in GYB's terms" so we don't litter this file with just this specific conformance. |
This comment has been minimized.
This comment has been minimized.
Gotcha - was considering that adding extra logic for the 0 case in the existing templated methods might actually be less readable / more complicated (both the impls and comment generation will have to fork based on arity) than having a specific extra section for 0 outside of that, but can do that if preferred since it would litter less. |
This comment has been minimized.
This comment has been minimized.
|
jrose-apple
requested a review
from
moiseev
Mar 27, 2017
This comment has been minimized.
This comment has been minimized.
Thanks @anayini! I agree that trying to incorporate the |
moiseev
reviewed
Mar 27, 2017
@@ -23,6 +23,14 @@ comparableOperators = [ | |||
|
|||
}% | |||
|
|||
/// Two tuples each of arity 0 are equal |
This comment has been minimized.
This comment has been minimized.
moiseev
Mar 27, 2017
•
Member
I would copy the heading from the 'generic' ==
on tuples, and later add a sentence that all empty-tuples are equal to each other as a note.
/// Returns a Boolean value indicating whether the corresponding components of
/// two tuples are equal.
///
/// All zero-arity tuples are equal.
Similarly for the <
etc...
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@moiseev - Updated to address your comments. Could also roll up the |
moiseev
reviewed
Mar 28, 2017
/// Returns a Boolean value indicating whether any corresponding components of | ||
/// the two tuples are not equal. | ||
/// | ||
/// Two tuples each of arity zero are never unequal |
This comment has been minimized.
This comment has been minimized.
moiseev
Mar 28, 2017
Member
'never unequal' is a bit hard to understand (and there is a period missing ;-)). I'd go with the same note as for the ==
.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I don't mind the non-gybbed version. @CodaFi , @airspeedswift what do you think? |
CodaFi
approved these changes
Mar 28, 2017
This comment has been minimized.
This comment has been minimized.
I don't have any qualms with not using GYB here - my thinking was that the file would be more resilient to future interface changes/tuple changes and we could update everything all at once. But that's a lot of work that can be done later. For now, LGTM. |
This comment has been minimized.
This comment has been minimized.
There a bit of more discussion here: https://bugs.swift.org/browse/SR-4172, regarding the size of this code and whether the |
This comment has been minimized.
This comment has been minimized.
@swift-ci please smoke test |
This comment has been minimized.
This comment has been minimized.
Welp, I suck. Looks like a failure in |
This comment has been minimized.
This comment has been minimized.
@anayini that's why we have CI ;-) Few people have enough resources and patience to run all the tests locally. |
This comment has been minimized.
This comment has been minimized.
Long time since last update, sorry about that. - @moiseev I'm actually still pretty confused about how the IDE code completion tests run using FileCheck. I've got something that I believe passes, but I'm definitely still confused about the semantics of the file. I basically have a pseudo understanding of how it works, but would like a deeper understanding so that I can update my commit to make sense. |
anayini
reviewed
Apr 24, 2017
@@ -40,7 +40,7 @@ | |||
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_14 | %FileCheck %s -check-prefix=NO_OPERATORS | |||
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_15 | %FileCheck %s -check-prefix=NO_OPERATORS | |||
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_16 | %FileCheck %s -check-prefix=NO_OPERATORS | |||
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_17 | %FileCheck %s -check-prefix=NO_OPERATORS | |||
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_17 | %FileCheck %s -check-prefix=VOID_OPERATORS |
This comment has been minimized.
This comment has been minimized.
anayini
reviewed
Apr 24, 2017
func testInfix17(x: Void) { | ||
x#^INFIX_17^# | ||
} | ||
|
||
// VOID_OPERATORS: Begin completions |
This comment has been minimized.
This comment has been minimized.
anayini
Apr 24, 2017
Author
Contributor
Generally want some feedback as to where the CHECK:
lines need to go. Even before this PR seems like the NO_OPERATORS-NOT
was in a strange place, but could be my misunderstanding.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
moiseev
Apr 25, 2017
Member
Oh, I see how this is related to the change. ()
is same as Void
, and therefore we get all the equality/comparison ops on the value of type Void
. This might have other consequences...
This comment has been minimized.
This comment has been minimized.
anayini
Apr 25, 2017
•
Author
Contributor
Yup. Took me a bit to figure out, but yeah SourceKit code completion was offering suggestions of all the equality/comparison ops that were added, but it wasn't expecting any suggestions so this test was failing.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@swift-ci Please smoke test |
moiseev
reviewed
Apr 25, 2017
@@ -244,6 +244,7 @@ func testInfix11() { | |||
S2#^INFIX_11^# | |||
} | |||
// NO_OPERATORS-NOT: Decl[InfixOperatorFunction] | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bump @airspeedswift I can fix the newline nits, but wanted to see if you had any other feedback if you have some time |
This comment has been minimized.
This comment has been minimized.
@moiseev - anyone else we can get feedback from :) I'll push up the whitespace fix, but was going to wait for other feedback in case its needed. |
This comment has been minimized.
This comment has been minimized.
@anayini Sorry for the silence. Last I remember there were some discussions about it. We'll get back to you once things clear up. Thanks for your patience! |
This comment has been minimized.
This comment has been minimized.
@moiseev - Just checking in again :) |
This comment has been minimized.
This comment has been minimized.
@moiseev - Did ya'll come to a conclusion? Should I close for now? |
This comment has been minimized.
This comment has been minimized.
@swift-ci please smoke test |
This comment has been minimized.
This comment has been minimized.
@swift-ci Please Test Source Compatibility |
This comment has been minimized.
This comment has been minimized.
@moiseev - Can dive into the Source Compatibility Suite error log - do these tests ever flake? If so, can you rerun? |
This comment has been minimized.
This comment has been minimized.
This one's a known issue that we just XFAILed. I'll kick off another run for you. @swift-ci Please test source compatibility |
This comment has been minimized.
This comment has been minimized.
Hm seems like this time its an |
This comment has been minimized.
This comment has been minimized.
Finally back to normal! @swift-ci Please test source compatibility |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
@moiseev - Are we good to merge? |
This comment has been minimized.
This comment has been minimized.
@anayini, do you mind sending an email to swift-evolution with a proposal to refine https://github.com/apple/swift-evolution/blob/master/proposals/0015-tuple-comparison-operators.md to cover the empty tuple case? |
This comment has been minimized.
This comment has been minimized.
@moiseev - Sorry for the delay - was getting ready for a long OOTO and am now out of the country until the end of the month. Will be able to check in on this periodically. Sent the email. |
This comment has been minimized.
This comment has been minimized.
@moiseev - Looks like it was accepted to be posted on swift-evolution. What are the next steps? |
This comment has been minimized.
This comment has been minimized.
@anayini Thanks for the contribution and your patience! |
anayini commentedMar 26, 2017
Add an == method for comparing two empty tuples.
Resolves: SR-4172 (https://bugs.swift.org/browse/SR-4172)