Skip to content

Commit e38d4bd

Browse files
authored
Merge pull request #73172 from eeckstein/fix-reabstraction-info
embedded: fix a crash when specializing a generic class method with an indirect return value
2 parents a7ff815 + 7746c0a commit e38d4bd

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ getReturnTypeCategory(const SILResultInfo &RI,
813813
const SILFunctionConventions &substConv,
814814
TypeExpansionContext typeExpansion) {
815815
auto ResultTy = substConv.getSILType(RI, typeExpansion);
816-
ResultTy = Callee->mapTypeIntoContext(ResultTy);
816+
ResultTy = mapTypeIntoContext(ResultTy);
817817
auto &TL = getModule().Types.getTypeLowering(ResultTy, typeExpansion);
818818

819819
if (!TL.isLoadable())
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-swift-emit-sil %s -enable-experimental-feature Embedded -wmo | %FileCheck %s
2+
3+
// REQUIRES: swift_in_compiler
4+
5+
// CHECK: sil @$s4main1XC3fooxyFSi_Tg5 : $@convention(method) (@guaranteed X<Int>) -> Int {
6+
7+
// CHECK-LABEL: sil_vtable $X<Int>
8+
// CHECK: #X.foo: <T> (X<T>) -> () -> T : @$s4main1XC3fooxyFSi_Tg5
9+
// CHECK: }
10+
11+
open class X<T> {
12+
13+
var t: T
14+
15+
init(t: T) {
16+
self.t = t
17+
}
18+
19+
open func foo() -> T { t }
20+
}
21+
22+
func testit() -> Int {
23+
let x = X(t: 27)
24+
return x.foo()
25+
}

0 commit comments

Comments
 (0)