mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Require '.init' when constructing from a dynamic metatype.
This makes it clearer that expressions like "foo.myType.init()" are creating new objects, instead of invoking a weird-looking method. The last part of rdar://problem/21375845. Swift SVN r29375
This commit is contained in:
@@ -277,7 +277,7 @@ internal class _ForwardIndexBox<
|
||||
}
|
||||
|
||||
func successor() -> _ForwardIndexBoxType {
|
||||
return self.dynamicType(self.base.successor())
|
||||
return self.dynamicType.init(self.base.successor())
|
||||
}
|
||||
|
||||
func _successorInPlace() {
|
||||
@@ -297,14 +297,14 @@ internal class _ForwardIndexBox<
|
||||
}
|
||||
|
||||
func _advancedBy(n: AnyForwardIndex.Distance) -> _ForwardIndexBoxType {
|
||||
return self.dynamicType(advance(base, numericCast(n)))
|
||||
return self.dynamicType.init(advance(base, numericCast(n)))
|
||||
}
|
||||
|
||||
func _advancedBy(
|
||||
n: AnyForwardIndex.Distance,
|
||||
_ limit: _ForwardIndexBoxType
|
||||
) -> _ForwardIndexBoxType {
|
||||
return self.dynamicType(advance(base, numericCast(n), unsafeUnbox(limit)))
|
||||
return self.dynamicType.init(advance(base, numericCast(n), unsafeUnbox(limit)))
|
||||
}
|
||||
|
||||
func _unbox<T : ForwardIndexType>() -> T? {
|
||||
@@ -339,11 +339,11 @@ internal class _BidirectionalIndexBox<
|
||||
}
|
||||
|
||||
override func successor() -> _ForwardIndexBoxType {
|
||||
return self.dynamicType(self.base.successor())
|
||||
return self.dynamicType.init(self.base.successor())
|
||||
}
|
||||
|
||||
func predecessor() -> _BidirectionalIndexBoxType {
|
||||
return self.dynamicType(self.base.predecessor())
|
||||
return self.dynamicType.init(self.base.predecessor())
|
||||
}
|
||||
|
||||
func _predecessorInPlace() {
|
||||
|
||||
Reference in New Issue
Block a user