You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
macOS Mojave, both in Swift 4.2 and the 2018-12-09 5.0 snapshot.
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: cbac37027cfe1a9f7b7ec5f6d6688217
is duplicated by:
SR-10832 Generic encapsulating type erases optional protocol methods
Issue Description:
I need to manually specify @objc names for optional methods in a protocol implemented by a generic superclass.
Example:
import Foundation
@objcprotocolP{@objc(doF)optionalfunc f()->Int}classGen<T>:NSObject,P{}classNoGen:NSObject,P{}classNoGen1:NoGen{func f()->Int{return42}}(NoGen1()asP).f?()// 42, worksclassGen1:Gen<Any>{func f()->Int{return42}}(Gen1()asP).f?()// nil <----------classGen2:Gen<Any>{@objc(doF)func f()->Int{// explicitly set objc namereturn42}}(Gen2()asP).f?()// 42, works again
The text was updated successfully, but these errors were encountered:
The problem here seems to be in swift::findWitnessedObjCRequirements:
// If we have an optional requirement in an inherited conformance,
// check whether the potential witness matches the requirement.
// FIXME: for now, don't even try this with generics involved. We
// should be tracking how subclasses implement optional requirements,
// in which case the getWitness() check above would suffice.
Environment
macOS Mojave, both in Swift 4.2 and the 2018-12-09 5.0 snapshot.
Additional Detail from JIRA
md5: cbac37027cfe1a9f7b7ec5f6d6688217
is duplicated by:
Issue Description:
I need to manually specify @objc names for optional methods in a protocol implemented by a generic superclass.
Example:
The text was updated successfully, but these errors were encountered: