Skip to content

Commit edde953

Browse files
committed
---
yaml --- r: 293821 b: refs/heads/tensorflow c: bb52eed h: refs/heads/master i: 293819: 78519f6
1 parent a2cf15f commit edde953

File tree

11 files changed

+9
-87
lines changed

11 files changed

+9
-87
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: 4e86c8ff52aebdd4b19950f5e2b4bbb6d2822b62
819+
refs/heads/tensorflow: bb52eed00daa0f70a3cc024b99968c201093c3de
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,9 +1030,6 @@ ERROR(extra_argument_to_nullary_call,none,
10301030
"argument passed to call that takes no arguments", ())
10311031
ERROR(extra_trailing_closure_in_call,none,
10321032
"extra trailing closure passed in call", ())
1033-
ERROR(trailing_closure_bad_param,none,
1034-
"trailing closure passed to parameter of type %0 that does not "
1035-
"accept a closure", (Type))
10361033
ERROR(no_accessible_initializers,none,
10371034
"%0 cannot be constructed because it has no accessible initializers",
10381035
(Type))

branches/tensorflow/lib/Sema/CSDiag.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3517,28 +3517,6 @@ class ArgumentMatcher : public MatchCallArgumentListener {
35173517
return true;
35183518
}
35193519

3520-
bool trailingClosureMismatch(unsigned paramIdx, unsigned argIdx) override {
3521-
Expr *arg = ArgExpr;
3522-
3523-
auto tuple = dyn_cast<TupleExpr>(ArgExpr);
3524-
if (tuple)
3525-
arg = tuple->getElement(argIdx);
3526-
3527-
auto &param = Parameters[paramIdx];
3528-
TC.diagnose(arg->getLoc(), diag::trailing_closure_bad_param,
3529-
param.getPlainType())
3530-
.highlight(arg->getSourceRange());
3531-
3532-
auto candidate = CandidateInfo[0];
3533-
if (candidate.getDecl())
3534-
TC.diagnose(candidate.getDecl(), diag::decl_declared_here,
3535-
candidate.getDecl()->getFullName());
3536-
3537-
Diagnosed = true;
3538-
3539-
return true;
3540-
}
3541-
35423520
bool diagnose() {
35433521
// Use matchCallArguments to determine how close the argument list is (in
35443522
// shape) to the specified candidates parameters. This ignores the

branches/tensorflow/lib/Sema/CSSimplify.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ bool MatchCallArgumentListener::relabelArguments(ArrayRef<Identifier> newNames){
5454
return true;
5555
}
5656

57-
bool MatchCallArgumentListener::trailingClosureMismatch(
58-
unsigned paramIdx, unsigned argIdx) {
59-
return true;
60-
}
61-
6257
/// Produce a score (smaller is better) comparing a parameter name and
6358
/// potentially-typo'd argument name.
6459
///
@@ -210,21 +205,6 @@ static ConstraintSystem::TypeMatchOptions getDefaultDecompositionOptions(
210205
return flags | ConstraintSystem::TMF_GenerateConstraints;
211206
}
212207

213-
/// Determine whether the given parameter can accept a trailing closure.
214-
static bool acceptsTrailingClosure(const AnyFunctionType::Param &param) {
215-
Type paramTy = param.getPlainType();
216-
if (!paramTy)
217-
return true;
218-
219-
paramTy = paramTy->lookThroughAllOptionalTypes();
220-
return paramTy->isTypeParameter() ||
221-
paramTy->is<ArchetypeType>() ||
222-
paramTy->is<AnyFunctionType>() ||
223-
paramTy->isTypeVariableOrMember() ||
224-
paramTy->is<UnresolvedType>() ||
225-
paramTy->isAny();
226-
}
227-
228208
// FIXME: This should return ConstraintSystem::TypeMatchResult instead
229209
// to give more information to the solver about the failure.
230210
bool constraints::
@@ -445,14 +425,6 @@ matchCallArguments(ArrayRef<AnyFunctionType::Param> args,
445425

446426
// If we have a trailing closure, it maps to the last parameter.
447427
if (hasTrailingClosure && numParams > 0) {
448-
// If there is no suitable last parameter to accept the trailing closure,
449-
// notify the listener and bail if we need to.
450-
if (!acceptsTrailingClosure(params[numParams - 1])) {
451-
if (listener.trailingClosureMismatch(numParams - 1, numArgs - 1))
452-
return true;
453-
}
454-
455-
// Claim the parameter/argument pair.
456428
claimedArgs[numArgs-1] = true;
457429
++numClaimedArgs;
458430
parameterBindings[numParams-1].push_back(numArgs-1);

branches/tensorflow/lib/Sema/CalleeCandidateInfo.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,6 @@ CalleeCandidateInfo::ClosenessResultTy CalleeCandidateInfo::evaluateCloseness(
355355
result = CC_ArgumentLabelMismatch;
356356
return true;
357357
}
358-
bool trailingClosureMismatch(unsigned paramIdx, unsigned argIdx) override {
359-
result = CC_ArgumentMismatch;
360-
return true;
361-
}
362358
} listener;
363359

364360
// Use matchCallArguments to determine how close the argument list is (in

branches/tensorflow/lib/Sema/ConstraintSystem.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3700,13 +3700,6 @@ class MatchCallArgumentListener {
37003700
/// \returns true to indicate that this should cause a failure, false
37013701
/// otherwise.
37023702
virtual bool relabelArguments(ArrayRef<Identifier> newNames);
3703-
3704-
/// Indicates that the trailing closure argument at the given \c argIdx
3705-
/// cannot be passed to the last parameter at \c paramIdx.
3706-
///
3707-
/// \returns true to indicate that this should cause a failure, false
3708-
/// otherwise.
3709-
virtual bool trailingClosureMismatch(unsigned paramIdx, unsigned argIdx);
37103703
};
37113704

37123705
/// Match the call arguments (as described by the given argument type) to

branches/tensorflow/test/Constraints/diag_missing_arg.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,19 @@ trailingClosureSingle1() { 1 } // expected-error {{missing argument for paramete
3535

3636
func trailingClosureSingle2(x: () -> Int, y: Int) {} // expected-note * {{here}}
3737
// FIXME: Bad diagnostics.
38-
trailingClosureSingle2 { 1 } // expected-error {{cannot convert value of type '() -> Int' to expected argument type '(x: () -> Int, y: Int)'}}
39-
trailingClosureSingle2() { 1 } // expected-error {{cannot convert value of type '() -> Int' to expected argument type '(x: () -> Int, y: Int)'}}
38+
trailingClosureSingle2 { 1 } // expected-error {{missing argument for parameter 'x' in call}} {{23-23=(x: <#() -> Int#>)}}
39+
trailingClosureSingle2() { 1 } // expected-error {{missing argument for parameter 'x' in call}} {{24-24=x: <#() -> Int#>}}
4040

4141
func trailingClosureMulti1(x: Int, y: Int, z: () -> Int) {} // expected-note * {{here}}
4242
trailingClosureMulti1(y: 1) { 1 } // expected-error {{missing argument for parameter 'x' in call}} {{23-23=x: <#Int#>, }}
4343
trailingClosureMulti1(x: 1) { 1 } // expected-error {{missing argument for parameter 'y' in call}} {{27-27=, y: <#Int#>}}
4444
trailingClosureMulti1(x: 1, y: 1) // expected-error {{missing argument for parameter 'z' in call}} {{33-33=, z: <#() -> Int#>}}
4545

4646
func trailingClosureMulti2(x: Int, y: () -> Int, z: Int) {} // expected-note * {{here}}
47-
trailingClosureMulti2 { 1 } // expected-error {{cannot convert value of type '() -> Int' to expected argument type '(x: Int, y: () -> Int, z: Int)'}}
47+
trailingClosureMulti2 { 1 } // expected-error {{missing argument for parameter 'x' in call}} {{22-22=(x: <#Int#>)}}
4848
// FIXME: Bad diagnostics.
49-
trailingClosureMulti2() { 1 } // expected-error {{cannot convert value of type '() -> Int' to expected argument type '(x: Int, y: () -> Int, z: Int)'}}
50-
trailingClosureMulti2(x: 1) { 1 } // expected-error {{cannot invoke 'trailingClosureMulti2' with an argument list of type '(x: Int, @escaping () -> Int)'}}
51-
// expected-note@-1{{expected an argument list of type '(x: Int, y: () -> Int, z: Int)'}}
49+
trailingClosureMulti2() { 1 } // expected-error {{missing argument for parameter 'x' in call}} {{23-23=x: <#Int#>}}
50+
trailingClosureMulti2(x: 1) { 1 } // expected-error {{missing argument for parameter 'y' in call}} {{27-27=, y: <#() -> Int#>}}
5251

5352
func param2Func(x: Int, y: Int) {} // expected-note * {{here}}
5453
param2Func(x: 1) // expected-error {{missing argument for parameter 'y' in call}} {{16-16=, y: <#Int#>}}

branches/tensorflow/test/Constraints/overload_filtering.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,3 @@ func testUnresolvedMember(i: Int) -> X {
3939
// CHECK-NEXT: introducing single enabled disjunction term {{.*}} bound to decl overload_filtering.(file).X.init(_:_:)
4040
return .init(i, i)
4141
}
42-
43-
func trailing(x: Int = 0, y: () -> Void) { }
44-
func trailing(x: Int = 0, z: Float) { }
45-
46-
func testTrailing() {
47-
// CHECK: disabled disjunction term {{.*}} bound to decl overload_filtering.(file).trailing(x:z:)
48-
trailing() { }
49-
50-
// CHECK: disabled disjunction term {{.*}} bound to decl overload_filtering.(file).trailing(x:z:)
51-
trailing(x: 5) { }
52-
}

branches/tensorflow/test/expr/closure/trailing.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ func rdar17965209_test() {
132132
func limitXY(_ xy:Int, toGamut gamut: [Int]) {}
133133
let someInt = 0
134134
let intArray = [someInt]
135-
limitXY(someInt, toGamut: intArray) {} // expected-error{{cannot invoke 'limitXY' with an argument list of type '(Int, toGamut: [Int], @escaping () -> ())'}}
136-
// expected-note@-1{{expected an argument list of type '(Int, toGamut: [Int])'}}
135+
limitXY(someInt, toGamut: intArray) {} // expected-error {{extra argument 'toGamut' in call}}
136+
137137

138138
// <rdar://problem/23036383> QoI: Invalid trailing closures in stmt-conditions produce lowsy diagnostics
139139
func retBool(x: () -> Int) -> Bool {}

branches/tensorflow/test/lit.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,7 @@ ENV_VAR_PREFIXES = {
10881088
}
10891089
TARGET_ENV_PREFIX = ENV_VAR_PREFIXES.get(config.target_sdk_name, "")
10901090

1091-
if (not getattr(config, 'target_run', None) and
1092-
'remote_run_host' in lit_config.params):
1091+
if 'remote_run_host' in lit_config.params:
10931092
if 'remote_run_tmpdir' not in lit_config.params:
10941093
lit_config.fatal("'remote_run_host' provided, but no "
10951094
"'remote_run_tmpdir'")

branches/tensorflow/test/stdlib/ErrorBridgedStatic.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// RUN: strip %t/ErrorBridgedStatic
55
// RUN: %target-run %t/ErrorBridgedStatic
66

7-
// REQUIRES: rdar50279940
87
// REQUIRES: executable_test
98
// REQUIRES: objc_interop
109
// REQUIRES: static_stdlib

0 commit comments

Comments
 (0)