Files
swift-mirror/test/SILOptimizer/definite_init_diagnostics_objc.swift
Emanuel Zephir 24141029d3 Refactor ObjC dependencies in definite_init_diagnostics tests
This change moves functionality that requires ObjC interop into a new file and
removes the XFAIL on Linux. Partially resolves SR-216.
2016-01-01 01:04:16 -08:00

37 lines
920 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 {{use of 'self' in method call 'f' before super.init initializes self}}
super.init()
}
init(t: ()) {
a = 5 // expected-error {{use of 'self' in property access 'a' before super.init initializes self}}
b = 10 // expected-error {{use of 'self' in property access 'b' before super.init initializes self}}
super.init()
c = 15
}
func f() { }
}