Skip to content

Commit 180a136

Browse files
authored
Merge pull request #26821 from gregomni/sil_return_type
2 parents 052ae1f + 3556fdf commit 180a136

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: not --crash %target-swift-emit-silgen %s
2+
3+
protocol Pub {
4+
associatedtype Other
5+
associatedtype Failure: Error
6+
}
7+
8+
class AnyPub<Other, Failure: Error> {}
9+
10+
extension Pub {
11+
func erase() -> AnyPub<Other, Failure> {
12+
return AnyPub<Other, Failure>()
13+
}
14+
}
15+
16+
protocol ObsObj : Pub {
17+
associatedtype NeverPub : Pub where Self.NeverPub.Failure == Never
18+
}
19+
20+
class Subject<Other, Failure: Error> : Pub {}
21+
22+
extension Pub where Other: ObsObj, Other.NeverPub: Subject<Int, Error> {
23+
static func f() -> AnyPub<Other.NeverPub.Other, Other.NeverPub.Failure> {
24+
return Subject<Other.NeverPub.Other, Other.NeverPub.Failure>().erase()
25+
}
26+
}

0 commit comments

Comments
 (0)