Skip to content

Commit 006872d

Browse files
authored
---
yaml --- r: 348744 b: refs/heads/master c: 1e0d927 h: refs/heads/master
1 parent 6241eab commit 006872d

File tree

9 files changed

+33
-74
lines changed

9 files changed

+33
-74
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: fc635cf8f365f47761ca7798a5a4666b7bfbf30f
2+
refs/heads/master: 1e0d92749fe0fd31fb46c2658eadb559b3bb783d
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/docs/WindowsBuild.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,11 @@ cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
186186
md "S:\b\lldb"
187187
cd "S:\b\lldb"
188188
cmake -G Ninja^
189+
-DLLVM_DIR="S:/b/llvm/lib/cmake/llvm"^
190+
-DClang_DIR="S:/b/llvm/lib/cmake/clang"^
191+
-DSwift_DIR="S:/b/swift/lib/cmake/swift"^
189192
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
190193
-DLLDB_ALLOW_STATIC_BINDINGS=YES^
191-
-DLLDB_PATH_TO_CLANG_SOURCE="S:\clang"^
192-
-DLLDB_PATH_TO_SWIFT_SOURCE="S:\swift"^
193-
-DLLDB_PATH_TO_CLANG_BUILD="S:\b\llvm"^
194-
-DLLDB_PATH_TO_LLVM_BUILD="S:\b\llvm"^
195-
-DLLDB_PATH_TO_SWIFT_BUILD="S:\b\swift"^
196194
-DLLVM_ENABLE_ASSERTIONS=ON^
197195
-DPYTHON_HOME="%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Python37_64"^
198196
S:\lldb

trunk/include/swift/ClangImporter/ClangImporterOptions.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ class ClangImporterOptions {
103103
using llvm::hash_combine;
104104

105105
auto Code = hash_value(ModuleCachePath);
106-
Code = hash_combine(Code, llvm::hash_combine_range(ExtraArgs.begin(),
107-
ExtraArgs.end()));
106+
// ExtraArgs ignored - already considered in Clang's module hashing.
108107
Code = hash_combine(Code, OverrideResourceDir);
109108
Code = hash_combine(Code, TargetCPU);
110109
Code = hash_combine(Code, BridgingHeader);

trunk/lib/Sema/CSDiagnostics.cpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,18 @@ Expr *FailureDiagnostic::findParentExpr(Expr *subExpr) const {
9494
return E ? E->getParentMap()[subExpr] : nullptr;
9595
}
9696

97-
Expr *
98-
FailureDiagnostic::getArgumentListExprFor(ConstraintLocator *locator) const {
99-
auto path = locator->getPath();
100-
auto iter = path.begin();
101-
if (!locator->findFirst<LocatorPathElt::ApplyArgument>(iter))
102-
return nullptr;
103-
104-
// Form a new locator that ends at the ApplyArgument element, then simplify
105-
// to get the argument list.
106-
auto newPath = ArrayRef<LocatorPathElt>(path.begin(), iter + 1);
107-
auto &cs = getConstraintSystem();
108-
auto argListLoc = cs.getConstraintLocator(locator->getAnchor(), newPath);
109-
return simplifyLocatorToAnchor(argListLoc);
97+
Expr *FailureDiagnostic::getArgumentExprFor(Expr *anchor) const {
98+
if (auto *UDE = dyn_cast<UnresolvedDotExpr>(anchor)) {
99+
if (auto *call = dyn_cast_or_null<CallExpr>(findParentExpr(UDE)))
100+
return call->getArg();
101+
} else if (auto *UME = dyn_cast<UnresolvedMemberExpr>(anchor)) {
102+
return UME->getArgument();
103+
} else if (auto *call = dyn_cast<CallExpr>(anchor)) {
104+
return call->getArg();
105+
} else if (auto *SE = dyn_cast<SubscriptExpr>(anchor)) {
106+
return SE->getIndex();
107+
}
108+
return nullptr;
110109
}
111110

112111
Expr *FailureDiagnostic::getBaseExprFor(Expr *anchor) const {
@@ -837,18 +836,21 @@ bool GenericArgumentsMismatchFailure::diagnoseAsError() {
837836
}
838837

839838
bool LabelingFailure::diagnoseAsError() {
840-
auto *argExpr = getArgumentListExprFor(getLocator());
839+
auto &cs = getConstraintSystem();
840+
auto *anchor = getRawAnchor();
841+
842+
auto *argExpr = getArgumentExprFor(anchor);
841843
if (!argExpr)
842844
return false;
843845

844-
auto &cs = getConstraintSystem();
845-
auto *anchor = getRawAnchor();
846846
return diagnoseArgumentLabelError(cs.getASTContext(), argExpr, CorrectLabels,
847847
isa<SubscriptExpr>(anchor));
848848
}
849849

850850
bool LabelingFailure::diagnoseAsNote() {
851-
auto *argExpr = getArgumentListExprFor(getLocator());
851+
auto *anchor = getRawAnchor();
852+
853+
auto *argExpr = getArgumentExprFor(anchor);
852854
if (!argExpr)
853855
return false;
854856

@@ -4179,8 +4181,7 @@ bool ClosureParamDestructuringFailure::diagnoseAsError() {
41794181

41804182
bool OutOfOrderArgumentFailure::diagnoseAsError() {
41814183
auto *anchor = getRawAnchor();
4182-
auto *argExpr = isa<TupleExpr>(anchor) ? anchor
4183-
: getArgumentListExprFor(getLocator());
4184+
auto *argExpr = isa<TupleExpr>(anchor) ? anchor : getArgumentExprFor(anchor);
41844185
if (!argExpr)
41854186
return false;
41864187

@@ -4829,7 +4830,7 @@ bool InvalidTupleSplatWithSingleParameterFailure::diagnoseAsError() {
48294830

48304831
auto *choice = selectedOverload->choice.getDecl();
48314832

4832-
auto *argExpr = getArgumentListExprFor(getLocator());
4833+
auto *argExpr = getArgumentExprFor(getRawAnchor());
48334834
if (!argExpr)
48344835
return false;
48354836

trunk/lib/Sema/CSDiagnostics.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,9 @@ class FailureDiagnostic {
166166
/// `x.foo` or `x[0]` extract and return its base expression.
167167
Expr *getBaseExprFor(Expr *anchor) const;
168168

169-
/// For a given locator describing an argument application, or a constraint
170-
/// within an argument application, returns the argument list for that
171-
/// application. If the locator is not for an argument application, or
172-
/// the argument list cannot be found, returns \c nullptr.
173-
Expr *getArgumentListExprFor(ConstraintLocator *locator) const;
169+
/// \returns An argument expression if given anchor is a call, member
170+
/// reference or subscript, nullptr otherwise.
171+
Expr *getArgumentExprFor(Expr *anchor) const;
174172

175173
/// \returns The overload choice made by the constraint system for the callee
176174
/// of a given locator's anchor, or \c None if no such choice can be found.

trunk/lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ class ArgumentFailureTracker : public MatchCallArgumentListener {
902902
}
903903
}
904904

905-
auto *locator = CS.getConstraintLocator(Locator);
905+
auto *locator = CS.getConstraintLocator(anchor);
906906
auto *fix = RelabelArguments::create(CS, newLabels, locator);
907907
CS.recordFix(fix);
908908
// Re-labeling fixes with extraneous labels should take

trunk/stdlib/public/core/FloatingPointTypes.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ internal struct _${Self}AnyHashableBox: _AnyHashableBox {
12631263

12641264
${SelfDocComment}
12651265
@frozen
1266-
@available(*, unavailable, message: "Float80 is not available on target platform.")
1266+
@available(*, unavailable, message: "Float80 is only available on non-Windows x86 targets.")
12671267
public struct ${Self} {
12681268
/// Creates a value initialized to zero.
12691269
@_transparent

trunk/test/ClangImporter/pch-bridging-header.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@
4646
// RUN: not %target-swift-frontend -typecheck %s -import-objc-header %S/Inputs/sdk-bridging-header.h -pch-output-dir %t/no-pch -pch-disable-validation 2>&1 | %FileCheck %s -check-prefix=NO-VALIDATION
4747
// NO-VALIDATION: PCH file {{.*}} not found
4848

49-
// Test that -Xcc options are considered in the PCH hash.
50-
// RUN: %target-swift-frontend -emit-pch -pch-output-dir %t/pch-Xcc %S/Inputs/sdk-bridging-header.h
51-
// RUN: %target-swift-frontend -emit-pch -pch-output-dir %t/pch-Xcc %S/Inputs/sdk-bridging-header.h -Xcc -Ifoo
52-
// RUN: %target-swift-frontend -emit-pch -pch-output-dir %t/pch-Xcc %S/Inputs/sdk-bridging-header.h -Xcc -Ibar
53-
// RUN: ls %t/pch-Xcc/*swift*clang*.pch | count 3
54-
5549
import Foundation
5650

5751
let not = MyPredicate.not()

trunk/test/expr/unary/keypath/keypath.swift

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,8 @@ func testLabeledSubscript() {
504504
let k = \AA.[labeled: 0]
505505

506506
// TODO: These ought to work without errors.
507-
let _ = \AA.[keyPath: k] // expected-error {{incorrect argument label in call (have 'keyPath:', expected 'labeled:')}}
508-
// expected-error@-1 {{cannot convert value of type 'KeyPath<AA, Int>' to expected argument type 'Int'}}
509-
510-
let _ = \AA.[keyPath: \AA.[labeled: 0]] // expected-error {{incorrect argument label in call (have 'keyPath:', expected 'labeled:')}}
511-
// expected-error@-1 {{cannot convert value of type 'KeyPath<AA, Int>' to expected argument type 'Int'}}
507+
let _ = \AA.[keyPath: k] // expected-error{{}}
508+
let _ = \AA.[keyPath: \AA.[labeled: 0]] // expected-error{{}}
512509
}
513510

514511
func testInvalidKeyPathComponents() {
@@ -833,34 +830,6 @@ func test_keypath_inference_with_optionals() {
833830
}
834831
}
835832

836-
func sr11562() {
837-
struct S1 {
838-
subscript(x x: Int) -> Int { x }
839-
}
840-
841-
_ = \S1.[5] // expected-error {{missing argument label 'x:' in call}} {{12-12=x: }}
842-
843-
struct S2 {
844-
subscript(x x: Int) -> Int { x } // expected-note {{incorrect labels for candidate (have: '(_:)', expected: '(x:)')}}
845-
subscript(y y: Int) -> Int { y } // expected-note {{incorrect labels for candidate (have: '(_:)', expected: '(y:)')}}
846-
}
847-
848-
_ = \S2.[5] // expected-error {{no exact matches in call to subscript}}
849-
850-
struct S3 {
851-
subscript(x x: Int, y y: Int) -> Int { x }
852-
}
853-
854-
_ = \S3.[y: 5, x: 5] // expected-error {{argument 'x' must precede argument 'y'}}
855-
856-
struct S4 {
857-
subscript(x: (Int, Int)) -> Int { x.0 }
858-
}
859-
860-
_ = \S4.[1, 4] // expected-error {{subscript expects a single parameter of type '(Int, Int)'}} {{12-12=(}} {{16-16=)}}
861-
// expected-error@-1 {{subscript index of type '(Int, Int)' in a key path must be Hashable}}
862-
}
863-
864833
func testSyntaxErrors() { // expected-note{{}}
865834
_ = \. ; // expected-error{{expected member name following '.'}}
866835
_ = \.a ;

0 commit comments

Comments
 (0)