Files
swift-mirror/test/attr/open_swift5.swift
Jordan Rose 2b1f7657d4 Also check for open static and 'open'-in-'final'-class
Like the change for `open let`, this is only a warning in Swift 4
mode, because it didn't actually cause any harm in practice. Neither a
Swift developer nor a compiler developer wants to rely on that going
forward, though!
2018-04-19 13:16:36 -07:00

12 lines
681 B
Swift

// RUN: %target-typecheck-verify-swift -swift-version 5
open class AnOpenClass {
open let openLet: Int = 1 // expected-error {{'let' properties are implicitly 'final'; use 'public' instead of 'open'}} {{3-7=public}}
open static func test() {} // expected-error {{static declarations are implicitly 'final'; use 'public' instead of 'open'}} {{3-7=public}}
}
final public class NonOpenClass {
open func test() {} // expected-error {{members of 'final' classes are implicitly 'final'; use 'public' instead of 'open'}} {{3-7=public}}
open static func test() {} // expected-error {{static declarations are implicitly 'final'; use 'public' instead of 'open'}} {{3-7=public}}
}