File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
validation-test/Sema/type_checker_crashers_fixed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
1015
1015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
1016
1016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
1017
1017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018
- refs/heads/rxwei-patch-1: b47aeb1ae88a50d48e30b3f5cd3671b1844983d6
1018
+ refs/heads/rxwei-patch-1: 21cbc868efc17209567b985128db7f2279b1c648
1019
1019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
1020
1020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
1021
1021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9
Original file line number Diff line number Diff line change @@ -2671,21 +2671,31 @@ bool ClosureParamDestructuringFailure::diagnoseAsError() {
2671
2671
auto bodyStmts = closureBody->getElements ();
2672
2672
2673
2673
SourceLoc bodyLoc;
2674
+ SourceLoc inLoc = closure->getInLoc ();
2675
+ // If location for `in` is unknown we can't proceed
2676
+ // since we'll not be able to figure out source line
2677
+ // to place the fix-it on.
2678
+ if (inLoc.isInvalid ())
2679
+ return true ;
2680
+
2674
2681
// If the body is empty let's put the cursor
2675
2682
// right after "in", otherwise make it start
2676
2683
// location of the first statement in the body.
2677
2684
if (bodyStmts.empty ())
2678
- bodyLoc = Lexer::getLocForEndOfToken (sourceMgr, closure-> getInLoc () );
2685
+ bodyLoc = Lexer::getLocForEndOfToken (sourceMgr, inLoc );
2679
2686
else
2680
2687
bodyLoc = bodyStmts.front ().getStartLoc ();
2681
2688
2689
+ if (bodyLoc.isInvalid ())
2690
+ return true ;
2691
+
2682
2692
SmallString<64 > fixIt;
2683
2693
llvm::raw_svector_ostream OS (fixIt);
2684
2694
2685
2695
// If this is multi-line closure we'd have to insert new lines
2686
2696
// in the suggested 'let' to keep the structure of the code intact,
2687
2697
// otherwise just use ';' to keep everything on the same line.
2688
- auto inLine = sourceMgr.getLineNumber (closure-> getInLoc () );
2698
+ auto inLine = sourceMgr.getLineNumber (inLoc );
2689
2699
auto bodyLine = sourceMgr.getLineNumber (bodyLoc);
2690
2700
auto isMultiLineClosure = bodyLine > inLine;
2691
2701
auto indent =
Original file line number Diff line number Diff line change
1
+ // RUN: not %target-swift-frontend %s -typecheck
2
+
3
+ func foo( ) -> [ String ] {
4
+ let dict : [ String : String ] = [ : ]
5
+ return dict . filter ( { ( _
You can’t perform that action at this time.
0 commit comments