mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeComplete] Fix crash when completing inside a result builder containing a variable initialized with nil
Resolves rdar://78017503
This commit is contained in:
@@ -4718,6 +4718,9 @@ bool constraints::isStandardComparisonOperator(ASTNode node) {
|
||||
Optional<std::pair<Expr *, unsigned>>
|
||||
ConstraintSystem::isArgumentExpr(Expr *expr) {
|
||||
auto *argList = getParentExpr(expr);
|
||||
if (!argList) {
|
||||
return None;
|
||||
}
|
||||
|
||||
if (isa<ParenExpr>(argList)) {
|
||||
for (;;) {
|
||||
|
||||
13
validation-test/IDE/crashers_2_fixed/rdar78017503.swift
Normal file
13
validation-test/IDE/crashers_2_fixed/rdar78017503.swift
Normal file
@@ -0,0 +1,13 @@
|
||||
// RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename=%s
|
||||
|
||||
@resultBuilder
|
||||
struct TupleBuilder<T> {
|
||||
static func buildBlock() -> () { }
|
||||
}
|
||||
|
||||
func testPatternMatching() {
|
||||
@TupleBuilder<String> var x3 {
|
||||
let x: Int? = nil
|
||||
#^COMPLETE^#
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user