Files
swift-mirror/test/SILOptimizer/definite_init_diagnostics_objc.swift
Allan Shortlidge 0e5cfa6259 NFC: Remove duplicated RUN lines from many SILOptimizer tests.
A previous PR (https://github.com/apple/swift/pull/32407) that mass-modified
tests left some duplicate `RUN:` lines behind.
2023-08-08 11:19:52 -07:00

38 lines
887 B
Swift

// RUN: %target-swift-frontend -emit-sil -sdk %S/../SILGen/Inputs %s -I %S/../SILGen/Inputs -enable-source-import -parse-stdlib -o /dev/null -verify
// REQUIRES: objc_interop
import Swift
import gizmo
@requires_stored_property_inits
class RequiresInitsDerived : Gizmo {
var a = 1
var b = 2
var c = 3
override init() {
super.init()
}
init(i: Int) {
if i > 0 {
super.init()
}
} // expected-error{{'super.init' isn't called on all paths before returning from initializer}}
init(d: Double) {
f() // expected-error {{'self' used in method call 'f' before 'super.init' call}}
super.init()
}
init(t: ()) {
a = 5 // expected-error {{'self' used in property access 'a' before 'super.init' call}}
b = 10 // expected-error {{'self' used in property access 'b' before 'super.init' call}}
super.init()
c = 15
}
func f() { }
}