Swift 2.2 review request: SE-0022 #selector implementation

Hi all,

I’ve finished the implementation of SE-0022, the #selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  https://github.com/apple/swift/commit/dccf3155f1fe5400df0c9b51f21a3b8f7fa09b9c (Jordan reviewed this)
  https://github.com/apple/swift/commit/7c0e087cd514c926d9eaa3082679edff626effc8
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  https://github.com/apple/swift/commit/1a830fa541705594bd4b3936de24a20b5b943059 (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  https://github.com/apple/swift/commit/9a0241bb3bcdde3531d0ba683e8d6668c50c9f58

   - Doug

I reviewed all of these except

[ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub (IRGen)
[SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub (SILGen)

I will say I'm not happy that we don't have any real code completion or IDE support. That seems important for putting it into a release.

Jordan

···

On Jan 28, 2016, at 12:12, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

Hi all,

I’ve finished the implementation of SE-0022, the selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  https://github.com/apple/swift/commit/dccf3155f1fe5400df0c9b51f21a3b8f7fa09b9c (Jordan reviewed this)
  [SIL] Extend the string_literal instruction with an 'objc_selector' e… · apple/swift@7c0e087 · GitHub
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  SE-0022: Deprecate string-literal-as-selector in favor of #selector. · apple/swift@1a830fa · GitHub (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  SE-0022: Address Jordan's review comments about #selector. · apple/swift@9a0241b · GitHub

The code completion we have is just filling in the “selector(@objc method)” after “#” in expression contexts, which is very weak. There are two things we want:

  * Better code completion in general for compound names, e.g., after “UIView.”, we probably want to see (or have some easy way to get to) the compound name “insertSubview(_:aboveSubview:)”. That’s really SE-0021 not having good code completion.
  * Within selector(…), we want to see compound names as the primary completions after a type name, and limit to @objc methods.

  - Doug

···

On Jan 28, 2016, at 3:48 PM, Jordan Rose <jordan_rose@apple.com> wrote:

On Jan 28, 2016, at 12:12, Douglas Gregor via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Hi all,

I’ve finished the implementation of SE-0022, the selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  https://github.com/apple/swift/commit/dccf3155f1fe5400df0c9b51f21a3b8f7fa09b9c (Jordan reviewed this)
  https://github.com/apple/swift/commit/7c0e087cd514c926d9eaa3082679edff626effc8
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  SE-0022: Deprecate string-literal-as-selector in favor of #selector. · apple/swift@1a830fa · GitHub (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  SE-0022: Address Jordan's review comments about #selector. · apple/swift@9a0241b · GitHub

I reviewed all of these except

[ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub (IRGen)
[SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub (SILGen)

I will say I'm not happy that we don't have any real code completion or IDE support. That seems important for putting it into a release.

Hi,

I am seeing a problem with the new selector syntax (latest development snapshot 2016-05-02):

It is not possible to put selectors in an array anymore it seems (example for checking an action against a list of selectors):

[selector(MainWindowController.save(_:)), selector(MainWindowController.discardChanges(_:))].contains(anItem.action())

and Xcode reports:

...MainWindowController.swift:132:53: Expected '#]' at end of object literal expression
...MainWindowController.swift:132:53: Expected 'let' or 'var' in conditional; use '&&' to join boolean conditions
...MainWindowController.swift:132:133: Braced block of statements is an unused closure
...MainWindowController.swift:132:133: Expression resolves to an unused function

The old syntax works fine:

[Selector("save:"), Selector("discardChanges:")].contains(anItem.action())

Was this change expected?

Thanks for looking into it,
Thomas

···

On 29 Jan 2016, at 01:17, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

On Jan 28, 2016, at 3:48 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:

On Jan 28, 2016, at 12:12, Douglas Gregor via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Hi all,

I’ve finished the implementation of SE-0022, the selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  SE-0022: Implement parsing, AST, and semantic analysis for #selector. · apple/swift@dccf315 · GitHub (Jordan reviewed this)
  https://github.com/apple/swift/commit/7c0e087cd514c926d9eaa3082679edff626effc8
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  SE-0022: Deprecate string-literal-as-selector in favor of #selector. · apple/swift@1a830fa · GitHub (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  https://github.com/apple/swift/commit/9a0241bb3bcdde3531d0ba683e8d6668c50c9f58

I reviewed all of these except

[ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub (IRGen)
[SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub (SILGen)

I will say I'm not happy that we don't have any real code completion or IDE support. That seems important for putting it into a release.

The code completion we have is just filling in the “selector(@objc method)” after “#” in expression contexts, which is very weak. There are two things we want:

  * Better code completion in general for compound names, e.g., after “UIView.”, we probably want to see (or have some easy way to get to) the compound name “insertSubview(_:aboveSubview:)”. That’s really SE-0021 not having good code completion.
  * Within selector(…), we want to see compound names as the primary completions after a type name, and limit to @objc methods.

  - Doug

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

Hi,

I am seeing a problem with the new selector syntax (latest development snapshot 2016-05-02):

It is not possible to put selectors in an array anymore it seems (example for checking an action against a list of selectors):

[selector(MainWindowController.save(_:)), selector(MainWindowController.discardChanges(_:))].contains(anItem.action())

and Xcode reports:

...MainWindowController.swift:132:53: Expected '#]' at end of object literal expression
...MainWindowController.swift:132:53: Expected 'let' or 'var' in conditional; use '&&' to join boolean conditions
...MainWindowController.swift:132:133: Braced block of statements is an unused closure
...MainWindowController.swift:132:133: Expression resolves to an unused function

The old syntax works fine:

[Selector("save:"), Selector("discardChanges:")].contains(anItem.action())

Was this change expected?

It's a grammatical ambiguity we had overlooked. Add a space between the [ and # for now, and we'll see what we can do.

  - Doug

···

Sent from my iPhone

On Feb 5, 2016, at 12:22 AM, Thomas Krajacic <thomas.krajacic@gmail.com> wrote:

Thanks for looking into it,
Thomas

On 29 Jan 2016, at 01:17, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

On Jan 28, 2016, at 3:48 PM, Jordan Rose <jordan_rose@apple.com> wrote:

On Jan 28, 2016, at 12:12, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

Hi all,

I’ve finished the implementation of SE-0022, the selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  https://github.com/apple/swift/commit/dccf3155f1fe5400df0c9b51f21a3b8f7fa09b9c (Jordan reviewed this)
  https://github.com/apple/swift/commit/7c0e087cd514c926d9eaa3082679edff626effc8
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  SE-0022: Deprecate string-literal-as-selector in favor of #selector. · apple/swift@1a830fa · GitHub (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  SE-0022: Address Jordan's review comments about #selector. · apple/swift@9a0241b · GitHub

I reviewed all of these except

[ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub (IRGen)
[SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub (SILGen)

I will say I'm not happy that we don't have any real code completion or IDE support. That seems important for putting it into a release.

The code completion we have is just filling in the “selector(@objc method)” after “#” in expression contexts, which is very weak. There are two things we want:

  * Better code completion in general for compound names, e.g., after “UIView.”, we probably want to see (or have some easy way to get to) the compound name “insertSubview(_:aboveSubview:)”. That’s really SE-0021 not having good code completion.
  * Within selector(…), we want to see compound names as the primary completions after a type name, and limit to @objc methods.

  - Doug

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Sent from my iPhone

Hi,

I am seeing a problem with the new selector syntax (latest development snapshot 2016-05-02):

It is not possible to put selectors in an array anymore it seems (example for checking an action against a list of selectors):

[selector(MainWindowController.save(_:)), selector(MainWindowController.discardChanges(_:))].contains(anItem.action())

and Xcode reports:

...MainWindowController.swift:132:53: Expected '#]' at end of object literal expression
...MainWindowController.swift:132:53: Expected 'let' or 'var' in conditional; use '&&' to join boolean conditions
...MainWindowController.swift:132:133: Braced block of statements is an unused closure
...MainWindowController.swift:132:133: Expression resolves to an unused function

The old syntax works fine:

[Selector("save:"), Selector("discardChanges:")].contains(anItem.action())

Was this change expected?

It's a grammatical ambiguity we had overlooked. Add a space between the [ and # for now, and we'll see what we can do.

Fixed in [Parser] Disambiguate between object literals and collection literals. · apple/swift@ab31f08 · GitHub

Thank you!

  - Doug

···

On Feb 5, 2016, at 6:59 AM, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:
On Feb 5, 2016, at 12:22 AM, Thomas Krajacic <thomas.krajacic@gmail.com <mailto:thomas.krajacic@gmail.com>> wrote:

  - Doug

Thanks for looking into it,
Thomas

On 29 Jan 2016, at 01:17, Douglas Gregor via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

On Jan 28, 2016, at 3:48 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:

On Jan 28, 2016, at 12:12, Douglas Gregor via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Hi all,

I’ve finished the implementation of SE-0022, the selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  SE-0022: Implement parsing, AST, and semantic analysis for #selector. · apple/swift@dccf315 · GitHub (Jordan reviewed this)
  [SIL] Extend the string_literal instruction with an 'objc_selector' e… · apple/swift@7c0e087 · GitHub
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  SE-0022: Deprecate string-literal-as-selector in favor of #selector. · apple/swift@1a830fa · GitHub (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  https://github.com/apple/swift/commit/9a0241bb3bcdde3531d0ba683e8d6668c50c9f58

I reviewed all of these except

[ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub (IRGen)
[SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub (SILGen)

I will say I'm not happy that we don't have any real code completion or IDE support. That seems important for putting it into a release.

The code completion we have is just filling in the “selector(@objc method)” after “#” in expression contexts, which is very weak. There are two things we want:

  * Better code completion in general for compound names, e.g., after “UIView.”, we probably want to see (or have some easy way to get to) the compound name “insertSubview(_:aboveSubview:)”. That’s really SE-0021 not having good code completion.
  * Within selector(…), we want to see compound names as the primary completions after a type name, and limit to @objc methods.

  - Doug

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

Sent from my iPhone

Hi,

I am seeing a problem with the new selector syntax (latest development snapshot 2016-05-02):

It is not possible to put selectors in an array anymore it seems (example for checking an action against a list of selectors):

[selector(MainWindowController.save(_:)), selector(MainWindowController.discardChanges(_:))].contains(anItem.action())

and Xcode reports:

...MainWindowController.swift:132:53: Expected '#]' at end of object literal expression
...MainWindowController.swift:132:53: Expected 'let' or 'var' in conditional; use '&&' to join boolean conditions
...MainWindowController.swift:132:133: Braced block of statements is an unused closure
...MainWindowController.swift:132:133: Expression resolves to an unused function

The old syntax works fine:

[Selector("save:"), Selector("discardChanges:")].contains(anItem.action())

Was this change expected?

It's a grammatical ambiguity we had overlooked. Add a space between the [ and # for now, and we'll see what we can do.

Fixed in [Parser] Disambiguate between object literals and collection literals. · apple/swift@ab31f08 · GitHub

Thank you!

  - Doug

Cherry-picked to swift-2.2-branch.

···

On Feb 5, 2016, at 5:15 PM, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

On Feb 5, 2016, at 6:59 AM, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

On Feb 5, 2016, at 12:22 AM, Thomas Krajacic <thomas.krajacic@gmail.com> wrote:

  - Doug

Thanks for looking into it,
Thomas

On 29 Jan 2016, at 01:17, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

On Jan 28, 2016, at 3:48 PM, Jordan Rose <jordan_rose@apple.com> wrote:

On Jan 28, 2016, at 12:12, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

Hi all,

I’ve finished the implementation of SE-0022, the selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  https://github.com/apple/swift/commit/dccf3155f1fe5400df0c9b51f21a3b8f7fa09b9c (Jordan reviewed this)
  https://github.com/apple/swift/commit/7c0e087cd514c926d9eaa3082679edff626effc8
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  SE-0022: Deprecate string-literal-as-selector in favor of #selector. · apple/swift@1a830fa · GitHub (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  https://github.com/apple/swift/commit/9a0241bb3bcdde3531d0ba683e8d6668c50c9f58

I reviewed all of these except

[ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub (IRGen)
[SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub (SILGen)

I will say I'm not happy that we don't have any real code completion or IDE support. That seems important for putting it into a release.

The code completion we have is just filling in the “selector(@objc method)” after “#” in expression contexts, which is very weak. There are two things we want:

  * Better code completion in general for compound names, e.g., after “UIView.”, we probably want to see (or have some easy way to get to) the compound name “insertSubview(_:aboveSubview:)”. That’s really SE-0021 not having good code completion.
  * Within selector(…), we want to see compound names as the primary completions after a type name, and limit to @objc methods.

  - Doug

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Sent from my iPhone

Hi,

I am seeing a problem with the new selector syntax (latest development snapshot 2016-05-02):

It is not possible to put selectors in an array anymore it seems (example for checking an action against a list of selectors):

[selector(MainWindowController.save(_:)), selector(MainWindowController.discardChanges(_:))].contains(anItem.action())

and Xcode reports:

...MainWindowController.swift:132:53: Expected '#]' at end of object literal expression
...MainWindowController.swift:132:53: Expected 'let' or 'var' in conditional; use '&&' to join boolean conditions
...MainWindowController.swift:132:133: Braced block of statements is an unused closure
...MainWindowController.swift:132:133: Expression resolves to an unused function

The old syntax works fine:

[Selector("save:"), Selector("discardChanges:")].contains(anItem.action())

Was this change expected?

It's a grammatical ambiguity we had overlooked. Add a space between the [ and # for now, and we'll see what we can do.

Fixed in [Parser] Disambiguate between object literals and collection literals. · apple/swift@ab31f08 · GitHub

Thank you!

  - Doug

Cherry-picked to swift-2.2-branch.

This caused CI to fail because I pulled this in before pulling in the changes for #column, #line, etc. Reverted, and now tracked with a pull request:

···

On Feb 5, 2016, at 5:46 PM, Ted kremenek via swift-dev <swift-dev@swift.org> wrote:
On Feb 5, 2016, at 5:15 PM, Douglas Gregor via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

On Feb 5, 2016, at 6:59 AM, Douglas Gregor via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:
On Feb 5, 2016, at 12:22 AM, Thomas Krajacic <thomas.krajacic@gmail.com <mailto:thomas.krajacic@gmail.com>> wrote:

  - Doug

Thanks for looking into it,
Thomas

On 29 Jan 2016, at 01:17, Douglas Gregor via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

On Jan 28, 2016, at 3:48 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:

On Jan 28, 2016, at 12:12, Douglas Gregor via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

Hi all,

I’ve finished the implementation of SE-0022, the selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  https://github.com/apple/swift/commit/dccf3155f1fe5400df0c9b51f21a3b8f7fa09b9c (Jordan reviewed this)
  https://github.com/apple/swift/commit/7c0e087cd514c926d9eaa3082679edff626effc8
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  SE-0022: Deprecate string-literal-as-selector in favor of #selector. · apple/swift@1a830fa · GitHub (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  https://github.com/apple/swift/commit/9a0241bb3bcdde3531d0ba683e8d6668c50c9f58

I reviewed all of these except

[ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub (IRGen)
[SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub (SILGen)

I will say I'm not happy that we don't have any real code completion or IDE support. That seems important for putting it into a release.

The code completion we have is just filling in the “selector(@objc method)” after “#” in expression contexts, which is very weak. There are two things we want:

  * Better code completion in general for compound names, e.g., after “UIView.”, we probably want to see (or have some easy way to get to) the compound name “insertSubview(_:aboveSubview:)”. That’s really SE-0021 not having good code completion.
  * Within selector(…), we want to see compound names as the primary completions after a type name, and limit to @objc methods.

  - Doug

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev

Thanks for pulling this in

···

Sent from my iPhone

On Feb 5, 2016, at 6:11 PM, Ted Kremenek <kremenek@apple.com> wrote:

On Feb 5, 2016, at 5:46 PM, Ted kremenek via swift-dev <swift-dev@swift.org> wrote:

On Feb 5, 2016, at 5:15 PM, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

On Feb 5, 2016, at 6:59 AM, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

Sent from my iPhone

On Feb 5, 2016, at 12:22 AM, Thomas Krajacic <thomas.krajacic@gmail.com> wrote:

Hi,

I am seeing a problem with the new selector syntax (latest development snapshot 2016-05-02):

It is not possible to put selectors in an array anymore it seems (example for checking an action against a list of selectors):

[selector(MainWindowController.save(_:)), selector(MainWindowController.discardChanges(_:))].contains(anItem.action())

and Xcode reports:

...MainWindowController.swift:132:53: Expected '#]' at end of object literal expression
...MainWindowController.swift:132:53: Expected 'let' or 'var' in conditional; use '&&' to join boolean conditions
...MainWindowController.swift:132:133: Braced block of statements is an unused closure
...MainWindowController.swift:132:133: Expression resolves to an unused function

The old syntax works fine:

[Selector("save:"), Selector("discardChanges:")].contains(anItem.action())

Was this change expected?

It's a grammatical ambiguity we had overlooked. Add a space between the [ and # for now, and we'll see what we can do.

Fixed in [Parser] Disambiguate between object literals and collection literals. · apple/swift@ab31f08 · GitHub

Thank you!

  - Doug

Cherry-picked to swift-2.2-branch.

This caused CI to fail because I pulled this in before pulling in the changes for #column, #line, etc. Reverted, and now tracked with a pull request:

[Swift 2.2][Parser] Disambiguate between object literals and collection literals. by tkremenek · Pull Request #1219 · apple/swift · GitHub

  - Doug

Thanks for looking into it,
Thomas

On 29 Jan 2016, at 01:17, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

On Jan 28, 2016, at 3:48 PM, Jordan Rose <jordan_rose@apple.com> wrote:

On Jan 28, 2016, at 12:12, Douglas Gregor via swift-dev <swift-dev@swift.org> wrote:

Hi all,

I’ve finished the implementation of SE-0022, the selector expression. Part of that proposal is the deprecation of the use of string literals to form Selectors, which is something we would like to do in Swift 2.2 (so that we can remove it outright in Swift 3).

However, it’s a non-trivial set of changes, and I’d like review of the corresponding commits before pulling it into the branch. The commits are:

  https://github.com/apple/swift/commit/dccf3155f1fe5400df0c9b51f21a3b8f7fa09b9c (Jordan reviewed this)
  https://github.com/apple/swift/commit/7c0e087cd514c926d9eaa3082679edff626effc8
  [ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub
  [SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub
  test/IRGen/objc_selector.sil has an uninteresting 64-bit dependency. · apple/swift@00313a1 · GitHub
  SE-0022: Deprecate string-literal-as-selector in favor of #selector. · apple/swift@1a830fa · GitHub (Jordan reviewed this)
  Use #selector in StdlibUnitTest's Foundation extras · apple/swift@2a42664 · GitHub
  SE-0022: Code completion for #selector. · apple/swift@37441e1 · GitHub
  SE-0022: Add a changelog entry for #selector. It's done. · apple/swift@0a35942 · GitHub
  https://github.com/apple/swift/commit/9a0241bb3bcdde3531d0ba683e8d6668c50c9f58

I reviewed all of these except

[ObjC IRGen] Clean up emission of Objective-C selectors. · apple/swift@89834f8 · GitHub (IRGen)
[SILGen] SE-0022: emit SIL for #selector expressions. · apple/swift@f7407f6 · GitHub (SILGen)

I will say I'm not happy that we don't have any real code completion or IDE support. That seems important for putting it into a release.

The code completion we have is just filling in the “selector(@objc method)” after “#” in expression contexts, which is very weak. There are two things we want:

  * Better code completion in general for compound names, e.g., after “UIView.”, we probably want to see (or have some easy way to get to) the compound name “insertSubview(_:aboveSubview:)”. That’s really SE-0021 not having good code completion.
  * Within selector(…), we want to see compound names as the primary completions after a type name, and limit to @objc methods.

  - Doug

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev