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
Apple Swift version 4.0.3 (swiftlang-900.0.71 clang-900.0.38)
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: 73935e9dc5ce6ff220d1e7eebbe68006
duplicates:
SR-2925 Inconsistent linking in debug vs. release builds w/ public method in extension of internal protocol
Issue Description:
I have a library, exposing a public protocol (MapController below). I'm using a refined, internal protocol to avoid writing boilerplate for wrappers of the base.
I want to set a default for some of the inherited associated types. The only way to do that seems to be to redeclare them in the refined protocol with a default. However, this stops me writing public default implementations based on constraints using that inherited associated type.
publicstructObservable<T> {}
publicenumGeo { publicstructRect {} }
publicprotocolMapController: class {
associatedtypePlaceTypeassociatedtypeOptionsTypevarplaces: Observable<[PlaceType]> { get }
varregion: Geo.Rect { getset }
varoptions: OptionsType { getset }
funcsetRegion(_newRegion: Geo.Rect, options: OptionsType)
}
protocolMapControllerWrapper: MapController {
associatedtypeWrapped: MapControllerassociatedtypeOptionsType = Wrapped.OptionsTypevarbase: Wrapped { get }
}
// This default implementation seems to work. Note it is declared 'public'.extensionMapControllerWrapper {
publicvarregion: Geo.Rect {
get { returnbase.region }
set { base.region = newValue }
}
}
// This one doesn't.// "Cannot declare a public var in an extension with internal requirements".extensionMapControllerWrapperwhereOptionsType == Wrapped.OptionsType {
publicvaroptions: OptionsType {
get { returnbase.options }
set { base.options = newValue }
}
publicfuncsetRegion(_newRegion: Geo.Rect, options: OptionsType) {
base.setRegion(newRegion, options: options)
}
}
The text was updated successfully, but these errors were encountered:
This is not supported today. It might look like it is because of SE-0025, but the public in the unconstrained extension is supposed to be ignored today. (It might not be, but that's a bug that can lead to linker errors.)
(In theory this could also apply to the constrained extension, but that's closer to "a function cannot be made public if it has non-public arguments".)
Environment
Version 9.2 beta (9C32c)
Apple Swift version 4.0.3 (swiftlang-900.0.71 clang-900.0.38)
Additional Detail from JIRA
md5: 73935e9dc5ce6ff220d1e7eebbe68006
duplicates:
Issue Description:
I have a library, exposing a public protocol (MapController below). I'm using a refined, internal protocol to avoid writing boilerplate for wrappers of the base.
I want to set a default for some of the inherited associated types. The only way to do that seems to be to redeclare them in the refined protocol with a default. However, this stops me writing public default implementations based on constraints using that inherited associated type.
The text was updated successfully, but these errors were encountered: