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:
Joe Groff
2015-06-14 19:50:06 +00:00
parent 2e8ee5aa4e
commit d7b9ae72aa
30 changed files with 89 additions and 68 deletions

View File

@@ -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() {