Skip to content

Commit 582f61c

Browse files
authored
Merge pull request #73182 from eeckstein/fix-reabstraction-info-6.0
[6.0] embedded: fix a crash when specializing a generic class method with an indirect return value
2 parents 83d2330 + d60f09c commit 582f61c

File tree

2 files changed

+27
-1
lines changed

2 files changed

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

0 commit comments

Comments
 (0)