Skip to content

Commit 30e52be

Browse files
committed
[AST] Properly initialize FunctionRefKind for UnresolvedMemberExpr
1 parent 352adc3 commit 30e52be

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

include/swift/AST/Expr.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,21 @@ class UnresolvedMemberExpr final
18411841
UnresolvedMemberExpr(SourceLoc dotLoc, DeclNameLoc nameLoc, DeclNameRef name,
18421842
bool implicit)
18431843
: Expr(ExprKind::UnresolvedMember, implicit), DotLoc(dotLoc),
1844-
NameLoc(nameLoc), Name(name) {}
1844+
NameLoc(nameLoc), Name(name) {
1845+
// FIXME: Really, we should be setting this to `FunctionRefKind::Compound`
1846+
// if `NameLoc` is compound, but this would be a source break for cases like
1847+
// ```
1848+
// struct S {
1849+
// static func makeS(_: Int) -> S! { S() }
1850+
// }
1851+
//
1852+
// let s: S = .makeS(_:)(0)
1853+
// ```
1854+
// Instead, we should store compound-ness as a separate bit from applied/
1855+
// unapplied.
1856+
Bits.UnresolvedMemberExpr.FunctionRefKind =
1857+
static_cast<unsigned>(FunctionRefKind::Unapplied);
1858+
}
18451859

18461860
DeclNameRef getName() const { return Name; }
18471861
DeclNameLoc getNameLoc() const { return NameLoc; }

0 commit comments

Comments
 (0)