We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26bf98f commit feb1401Copy full SHA for feb1401
test/decl/func/dynamic_self.swift
@@ -393,3 +393,23 @@ final class FinalFactory : FactoryPattern {
393
self.init(factory: FinalFactory(_string: string))
394
}
395
396
+
397
+// Operators returning Self
398
399
+class SelfOperator {
400
+ required init() {}
401
402
+ static func +(lhs: SelfOperator, rhs: SelfOperator) -> Self {
403
+ return self.init()
404
+ }
405
406
+ func double() -> Self {
407
+ // FIXME: Should this work?
408
+ return self + self // expected-error {{cannot convert return expression of type 'SelfOperator' to return type 'Self'}}
409
410
+}
411
412
+func useSelfOperator() {
413
+ let s = SelfOperator()
414
+ _ = s + s
415
0 commit comments