mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Type annotations for instruction operands are omitted, e.g. ``` %3 = struct $S(%1, %2) ``` Operand types are redundant anyway and were only used for sanity checking in the SIL parser. But: operand types _are_ printed if the definition of the operand value was not printed yet. This happens: * if the block with the definition appears after the block where the operand's instruction is located * if a block or instruction is printed in isolation, e.g. in a debugger The old behavior can be restored with `-Xllvm -sil-print-types`. This option is added to many existing test files which check for operand types in their check-lines.
26 lines
1.2 KiB
Swift
26 lines
1.2 KiB
Swift
// RUN: %target-swift-frontend -swift-version 4 -Xllvm -sil-print-types -emit-silgen %s -verify | %FileCheck %s
|
|
|
|
class Base {
|
|
var foo: Int { return 0 } // expected-note {{attempt to override property here}}
|
|
var bar: Int = 0 // expected-note {{attempt to override property here}}
|
|
}
|
|
|
|
class Sub : Base {
|
|
lazy override var foo: Int = 1 // expected-warning {{cannot override with a stored property 'foo'}}
|
|
lazy override var bar: Int = 1 // expected-warning {{cannot override with a stored property 'bar'}}
|
|
func test() -> Int {
|
|
// CHECK-LABEL: sil {{.*}}@$s18attr_override_lazy3SubC4testSiyF
|
|
// CHECK: class_method %0 : $Sub, #Sub.foo!getter
|
|
// CHECK: class_method %0 : $Sub, #Sub.bar!getter
|
|
// CHECK: // end sil function '$s18attr_override_lazy3SubC4testSiyF'
|
|
return foo + bar // no ambiguity error here
|
|
}
|
|
}
|
|
|
|
// CHECK-LABEL: sil_vtable Sub {
|
|
// CHECK: #Base.foo!getter: (Base) -> () -> Int : {{.*}} // Sub.foo.getter
|
|
// CHECK: #Base.bar!getter: (Base) -> () -> Int : {{.*}} // Sub.bar.getter
|
|
// CHECK: #Base.bar!setter: (Base) -> (Int) -> () : {{.*}} // Sub.bar.setter
|
|
// CHECK: #Base.bar!modify: (Base) -> {{.*}} : {{.*}} // Sub.bar.modify
|
|
// CHECK: }
|