Skip to content

Commit 3b8cfca

Browse files
committed
[test] Add more opaque return tests
1 parent bde6a46 commit 3b8cfca

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/AST/Decl.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3088,9 +3088,7 @@ TypeRepr *ValueDecl::getResultTypeRepr() const {
30883088
}
30893089

30903090
TypeRepr *ValueDecl::getOpaqueResultTypeRepr() const {
3091-
TypeRepr *returnRepr = nullptr;
3092-
3093-
returnRepr = this->getResultTypeRepr();
3091+
auto *returnRepr = this->getResultTypeRepr();
30943092

30953093
auto *dc = getDeclContext();
30963094
auto &ctx = dc->getASTContext();

test/type/implicit_some/opaque_return.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,13 @@ struct S: P {
115115

116116
var asExistential: any P { self }
117117
}
118+
119+
enum E {
120+
func f() -> Int {
121+
1
122+
}
123+
}
124+
125+
protocol Q {
126+
func f() -> Int
127+
}

0 commit comments

Comments
 (0)