Files
swift-mirror/test/SILOptimizer/definite_init_existential_let.swift
Michael Gottesman f10b45b540 [ownership] Add an extra run of -Onone tests with diagnostics with -enable-ownership-stripping-after-serialization enabled.
Right now the stdlib/overlays can compile against -Onone tests with or without
-enable-ownership-stripping-after-serialization. This will help me to prevent
other work going on from breaking these properties.
2019-10-26 15:12:14 -07:00

31 lines
700 B
Swift

// RUN: %target-swift-frontend -emit-sil -verify %s
// RUN: %target-swift-frontend -emit-sil -verify %s -enable-ownership-stripping-after-serialization
// rdar://problem/29716016 - Check that we properly enforce DI on `let`
// variables and class properties.
protocol P { }
extension P {
mutating func foo() {}
var bar: Int { get { return 0 } set {} }
}
class ImmutableP {
let field: P // expected-note* {{}}
init(field: P) {
self.field = field
self.field.foo() // expected-error{{}}
self.field.bar = 4 // expected-error{{}}
}
}
func immutableP(field: P) {
let x: P // expected-note* {{}}
x = field
x.foo() // expected-error{{}}
x.bar = 4 // expected-error{{}}
}