Files
swift-mirror/test/SILOptimizer/definite_init_existential_let.swift
Michael Gottesman 3ebd8df493 [gardening] Remove unnecessary -enable-sil-ownership from tests that now just get it from their pattern.
This just eliminates -enable-sil-ownership from all target-swift-frontend and
target-swift-emit-silgen RUN lines. Both of those now include
enable-sil-ownership in their expansion.
2019-03-12 20:39:18 -07:00

30 lines
600 B
Swift

// RUN: %target-swift-frontend -emit-sil -verify %s
// 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{{}}
}