File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
Sema/type_checker_crashers_fixed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -600,10 +600,11 @@ ParserResult<Expr> Parser::parseExprKeyPath() {
600
600
pathResult = parseExprPostfixSuffix (inner, /* isExprBasic=*/ true ,
601
601
/* periodHasKeyPathBehavior=*/ false ,
602
602
unusedHasBindOptional);
603
- if (pathResult.isParseError ())
604
- return pathResult;
605
603
}
606
604
605
+ if (!rootResult.getPtrOrNull () && !pathResult.getPtrOrNull ())
606
+ return pathResult;
607
+
607
608
auto keypath = new (Context) KeyPathExpr (
608
609
backslashLoc, rootResult.getPtrOrNull (), pathResult.getPtrOrNull ());
609
610
@@ -618,7 +619,8 @@ ParserResult<Expr> Parser::parseExprKeyPath() {
618
619
return makeParserCodeCompletionResult (keypath);
619
620
}
620
621
621
- return makeParserResult (keypath);
622
+ ParserStatus parseStatus = ParserStatus (rootResult) | ParserStatus (pathResult);
623
+ return makeParserResult (parseStatus, keypath);
622
624
}
623
625
624
626
// / expr-keypath-objc:
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename=%s
2
+
3
+ struct SD {
4
+ var array : [ Int ] = [ ]
5
+ }
6
+
7
+ func test( sd: SD ) {
8
+ _ = sd [ \. array [ #^COMPLETE^#] ]
9
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: not %target-swift-frontend %s -typecheck
2
+
3
+ struct SD {
4
+ var array : [ Int ] = [ ]
5
+ }
6
+
7
+ func test( sd: SD ) {
8
+ _ = sd [ \. array [ @] ]
9
+ }
You can’t perform that action at this time.
0 commit comments