Files
swift-mirror/test/Compatibility/attr_override_lazy.swift
Jordan Rose ca9d5a9df9 In Swift 3/4 mode, continue treating 'lazy override' as an override (#13335)
Follow-up for 7c707ce97c. Without this, the declaration would be
accepted, but any uses of the overridden property would be treated as
ambiguous because the property wouldn't really be marked as an
override.

rdar://problem/35900345
2017-12-11 15:13:55 -08:00

26 lines
936 B
Swift

// RUN: %target-swift-frontend -swift-version 4 -emit-silgen %s | %FileCheck %s
class Base {
var foo: Int { return 0 }
var bar: Int = 0
}
class Sub : Base {
lazy override var foo: Int = 1
lazy override var bar: Int = 1
func test() -> Int {
// CHECK-LABEL: sil {{.*}}@_T018attr_override_lazy3SubC4testSiyF
// CHECK: class_method %0 : $Sub, #Sub.foo!getter.1
// CHECK: class_method %0 : $Sub, #Sub.bar!getter.1
// CHECK: // end sil function '_T018attr_override_lazy3SubC4testSiyF'
return foo + bar // no ambiguity error here
}
}
// CHECK-LABEL: sil_vtable Sub {
// CHECK: #Base.foo!getter.1: (Base) -> () -> Int : {{.*}} // Sub.foo.getter
// CHECK: #Base.bar!getter.1: (Base) -> () -> Int : {{.*}} // Sub.bar.getter
// CHECK: #Base.bar!setter.1: (Base) -> (Int) -> () : {{.*}} // Sub.bar.setter
// CHECK: #Base.bar!materializeForSet.1: (Base) -> {{.*}} : {{.*}} // Sub.bar.materializeForSet
// CHECK: }