swiftlang/swift

[SR-1019] Can't use the new #selector syntax for generic types

オープン

#43,631 opened on 2016/03/22

 (3 件のコメント) (0 件のリアクション) (0 人の担当者)Swift (10,719 件のフォーク)batch import
bugcompilergood first issue

Repository metrics

Stars
 (69,989 個のスター)
PR merge metrics
 (平均マージ 8d 17h) (30d で 510 merged PRs)

説明

Previous ID SR-1019
Radar None
Original Reporter JamieWhite (JIRA User)
Type Bug

xcode 7.3
Swift 2.2

Votes 2
Component/s Compiler
Labels Bug, StarterBug
Assignee None
Priority Medium

md5: 5685a8e13e6f20612a2c6754c850cfe2

Issue Description:

I have an example here: https://gist.github.com/JamieWhite/72e0f7406a33d8e52657/51032655f639d9f92042ed7c02d0ee6c9e22790f

You'll notice this:

addTarget(trampoline, action: #selector(ActionTrampoline.action(_:)), forControlEvents: events)

ActionTrampoline is generic type. How this should work is doing this:

addTarget(trampoline, action: #selector(ActionTrampoline<Self>.action(_:)), forControlEvents: events)

How I worked around this was typeAliasing ActionTrampoline<self> and using that in the #selector like this:

https://gist.github.com/JamieWhite/72e0f7406a33d8e52657/fb010c8c0403725e431880b9dc6253dafc0c3b35

コントリビューターガイド