Skip to content

Commit c9e259a

Browse files
committed
Fix SIL parsing of lifetime dependence in parameter position
1 parent 1acfec1 commit c9e259a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4561,6 +4561,10 @@ SILParameterInfo TypeResolver::resolveSILParameter(
45614561

45624562
std::optional<TypeAttrSet> attrsBuffer;
45634563
TypeAttrSet *attrs = nullptr;
4564+
4565+
if (auto *lifetimeRepr = dyn_cast<LifetimeDependentTypeRepr>(repr)) {
4566+
repr = lifetimeRepr->getBase();
4567+
}
45644568
if (yieldAttrs) {
45654569
attrs = yieldAttrs;
45664570
assert(!isa<AttributedTypeRepr>(repr));

test/SILOptimizer/lifetime_dependence/lifetime_dependence.sil

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ sil_stage raw
1313

1414
class C {}
1515

16-
@_marker public protocol Escapable { }
17-
1816
struct Nonescapable: ~Escapable {}
1917

2018
sil @c_dependence : $@convention(thin) (@guaranteed C) -> _scope(0) @owned Nonescapable
@@ -52,3 +50,7 @@ bb0:
5250
%t = tuple ()
5351
return %t : $()
5452
}
53+
54+
public struct Container<Element> : ~Copyable, ~Escapable where Element : ~Copyable {}
55+
56+
sil [ossa] @parseInoutDep : $@convention(method) <Element where Element : ~Copyable> (_lifetime(_copy 0) @inout Container<Element>) -> ()

0 commit comments

Comments
 (0)