Skip to content

Commit fea4765

Browse files
authored
---
yaml --- r: 340927 b: refs/heads/rxwei-patch-1 c: 238f10c h: refs/heads/master i: 340925: a22f082 340923: 2a33ab5 340919: dd26165 340911: a0c92b0 340895: e058457 340863: 4b2932a
1 parent c376913 commit fea4765

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: f5963923de41d011c25f6bc9e2badc3bb92eae7b
1018+
refs/heads/rxwei-patch-1: 238f10cbcc5297a4c6d233619425c81c7b32b1a3
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/lib/Sema/CSDiagnostics.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,21 +2671,31 @@ bool ClosureParamDestructuringFailure::diagnoseAsError() {
26712671
auto bodyStmts = closureBody->getElements();
26722672

26732673
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+
26742681
// If the body is empty let's put the cursor
26752682
// right after "in", otherwise make it start
26762683
// location of the first statement in the body.
26772684
if (bodyStmts.empty())
2678-
bodyLoc = Lexer::getLocForEndOfToken(sourceMgr, closure->getInLoc());
2685+
bodyLoc = Lexer::getLocForEndOfToken(sourceMgr, inLoc);
26792686
else
26802687
bodyLoc = bodyStmts.front().getStartLoc();
26812688

2689+
if (bodyLoc.isInvalid())
2690+
return true;
2691+
26822692
SmallString<64> fixIt;
26832693
llvm::raw_svector_ostream OS(fixIt);
26842694

26852695
// If this is multi-line closure we'd have to insert new lines
26862696
// in the suggested 'let' to keep the structure of the code intact,
26872697
// otherwise just use ';' to keep everything on the same line.
2688-
auto inLine = sourceMgr.getLineNumber(closure->getInLoc());
2698+
auto inLine = sourceMgr.getLineNumber(inLoc);
26892699
auto bodyLine = sourceMgr.getLineNumber(bodyLoc);
26902700
auto isMultiLineClosure = bodyLine > inLine;
26912701
auto indent =

branches/rxwei-patch-1/test/IRGen/abi_v7k.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func testClike8(t: Int, x: CLike8) -> Int {
142142
// assigned values in the data area of the enum in declaration order
143143
// CHECK-LABEL: define hidden swiftcc double @"$s8test_v7k0A7SingleP{{.*}}"(i32, i32, i8)
144144
// CHECK: br i1
145-
// CHECK: switch i32 [[ID:%[0-9]+]]
145+
// CHECK: switch i64 [[ID:%[0-9]+]]
146146
// CHECK: [[FIRST:%[0-9]+]] = zext i32 %0 to i64
147147
// CHECK: [[SECOND:%[0-9]+]] = zext i32 %1 to i64
148148
// CHECK: [[TEMP:%[0-9]+]] = shl i64 [[SECOND]], 32
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: not %target-swift-frontend %s -typecheck
2+
3+
func foo() -> [String] {
4+
let dict: [String: String] = [:]
5+
return dict.filter({ (_

0 commit comments

Comments
 (0)