|
| 1 | +// RUN: %target-swift-emit-silgen %s | %FileCheck %s |
| 2 | + |
| 3 | +class Container { |
| 4 | + class NestedType {} |
| 5 | + |
| 6 | + func someFunc1() { |
| 7 | + // This constructor call should not require a curry thunk. |
| 8 | + _ = Container.NestedType() |
| 9 | + } |
| 10 | + |
| 11 | + func someFunc2() { |
| 12 | + // This constructor call should not require a curry thunk. |
| 13 | + _ = Self.NestedType() |
| 14 | + } |
| 15 | + |
| 16 | + func someFunc3() { |
| 17 | + let m = Container.self |
| 18 | + |
| 19 | + // This constructor call should not require a curry thunk. |
| 20 | + _ = m.NestedType() |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | +// CHECK-LABEL: sil hidden [ossa] @$s17bogus_curry_thunk9ContainerC9someFunc1yyF : $@convention(method) (@guaranteed Container) -> () { |
| 25 | +// CHECK: bb0(%0 : @guaranteed $Container): |
| 26 | +// CHECK: [[META2:%.*]] = metatype $@thick Container.NestedType.Type |
| 27 | +// CHECK: [[FN:%.*]] = function_ref @$s17bogus_curry_thunk9ContainerC10NestedTypeCAEycfC : $@convention(method) (@thick Container.NestedType.Type) -> @owned Container.NestedType |
| 28 | +// CHECK: [[RESULT:%.*]] = apply [[FN]]([[META2]]) : $@convention(method) (@thick Container.NestedType.Type) -> @owned Container.NestedType |
| 29 | +// CHECK: ignored_use [[RESULT]] |
| 30 | +// CHECK: destroy_value [[RESULT]] |
| 31 | +// CHECK: [[TUPLE:%.*]] = tuple () |
| 32 | +// CHECK: return [[TUPLE]] |
| 33 | +// CHECK: } |
| 34 | + |
| 35 | + |
| 36 | +// CHECK-LABEL: sil hidden [ossa] @$s17bogus_curry_thunk9ContainerC9someFunc2yyF : $@convention(method) (@guaranteed Container) -> () { |
| 37 | +// CHECK: bb0(%0 : @guaranteed $Container): |
| 38 | +// CHECK: [[META2:%.*]] = metatype $@thick Container.NestedType.Type |
| 39 | +// CHECK: [[FN:%.*]] = function_ref @$s17bogus_curry_thunk9ContainerC10NestedTypeCAEycfC : $@convention(method) (@thick Container.NestedType.Type) -> @owned Container.NestedType |
| 40 | +// CHECK: [[RESULT:%.*]] = apply [[FN]]([[META2]]) : $@convention(method) (@thick Container.NestedType.Type) -> @owned Container.NestedType |
| 41 | +// CHECK: ignored_use [[RESULT]] |
| 42 | +// CHECK: destroy_value [[RESULT]] |
| 43 | +// CHECK: [[TUPLE:%.*]] = tuple () |
| 44 | +// CHECK: return [[TUPLE]] |
| 45 | +// CHECK: } |
| 46 | + |
| 47 | + |
| 48 | +// CHECK-LABEL: sil hidden [ossa] @$s17bogus_curry_thunk9ContainerC9someFunc3yyF : $@convention(method) (@guaranteed Container) -> () { |
| 49 | +// CHECK: bb0(%0 : @guaranteed $Container): |
| 50 | +// CHECK: [[META:%.*]] = metatype $@thick Container.Type |
| 51 | +// CHECK: [[META2:%.*]] = metatype $@thick Container.NestedType.Type |
| 52 | +// CHECK: [[FN:%.*]] = function_ref @$s17bogus_curry_thunk9ContainerC10NestedTypeCAEycfC : $@convention(method) (@thick Container.NestedType.Type) -> @owned Container.NestedType |
| 53 | +// CHECK: [[RESULT:%.*]] = apply [[FN]]([[META2]]) : $@convention(method) (@thick Container.NestedType.Type) -> @owned Container.NestedType |
| 54 | +// CHECK: ignored_use [[RESULT]] |
| 55 | +// CHECK: destroy_value [[RESULT]] |
| 56 | +// CHECK: [[TUPLE:%.*]] = tuple () |
| 57 | +// CHECK: return [[TUPLE]] |
| 58 | +// CHECK: } |
0 commit comments