File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -6135,7 +6135,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
6135
6135
// it is in the same module, update the vtable.
6136
6136
if (auto *baseDecl = dyn_cast<ClassDecl>(base->getDeclContext ())) {
6137
6137
if (baseDecl->hasKnownSwiftImplementation () &&
6138
- !base->isDynamic () &&
6138
+ !base->isDynamic () && !isKnownObjC &&
6139
6139
override ->getDeclContext ()->isExtensionContext ()) {
6140
6140
// For compatibility, only generate a warning in Swift 3
6141
6141
TC.diagnose (override , (TC.Context .isSwiftVersion3 ()
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ class A {
9
9
10
10
@objc func f3( ) { } // expected-note{{overridden declaration is here}}
11
11
@objc func f4( ) -> ObjCClassA { } // expected-note{{overridden declaration is here}}
12
+ @objc var v1 : Int { return 0 } // expected-note{{overridden declaration is here}}
13
+ @objc var v2 : Int { return 0 } // expected-note{{overridden declaration is here}}
14
+ @objc var v3 : Int = 0 // expected-note{{overridden declaration is here}}
12
15
13
16
dynamic func f3D( ) { }
14
17
dynamic func f4D( ) -> ObjCClassA { }
@@ -30,6 +33,15 @@ extension B {
30
33
31
34
override func f3( ) { } // expected-error{{cannot override a non-dynamic class declaration from an extension}}
32
35
override func f4( ) -> ObjCClassB { } // expected-error{{cannot override a non-dynamic class declaration from an extension}}
36
+ override var v1 : Int { return 1 } // expected-error{{cannot override a non-dynamic class declaration from an extension}}
37
+ override var v2 : Int { // expected-error{{cannot override a non-dynamic class declaration from an extension}}
38
+ get { return 1 }
39
+ set { }
40
+ }
41
+ override var v3 : Int { // expected-error{{cannot override a non-dynamic class declaration from an extension}}
42
+ willSet { }
43
+ didSet { }
44
+ }
33
45
34
46
override func f3D( ) { }
35
47
override func f4D( ) -> ObjCClassB { }
You can’t perform that action at this time.
0 commit comments