Skip to content

Commit 37266d8

Browse files
author
Brian King
committed
Verify behavior of Swift 3 and Swift 4 final protocol extension behavior
1 parent ca66379 commit 37266d8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-typecheck-verify-swift -swift-version 3
2+
// Generate a swift 3 compatible warning if final is specified in an extension
3+
4+
protocol P {}
5+
6+
extension P {
7+
final func inExtension() {} // expected-warning{{functions in a protocol extension do not need to be marked with 'final'}} {{3-9=}}
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %target-typecheck-verify-swift -swift-version 4
2+
3+
protocol P {}
4+
5+
extension P {
6+
final func inExtension() {} // expected-error {{only classes and class members may be marked with 'final'}} {{3-9=}}
7+
}

0 commit comments

Comments
 (0)