Skip to content

Commit d08625e

Browse files
committed
---
yaml --- r: 349175 b: refs/heads/master-next c: 881f521 h: refs/heads/master i: 349173: 990e4e9 349171: 1638829 349167: 0abb008
1 parent e243ae1 commit d08625e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: e30612e8cd257f9a49d200bfa3b7e26999a57286
3+
refs/heads/master-next: 881f521958be6f19e1d3ef505765f77840b026b4
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/lib/Sema/CSDiagnostics.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,6 +3508,20 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
35083508
return true;
35093509
}
35103510

3511+
// Function type has fewer arguments than expected by context:
3512+
//
3513+
// ```
3514+
// func foo() {}
3515+
// let _: (Int) -> Void = foo
3516+
// ```
3517+
if (locator->isLastElement(ConstraintLocator::ContextualType)) {
3518+
auto &cs = getConstraintSystem();
3519+
emitDiagnostic(anchor->getLoc(), diag::cannot_convert_initializer_value,
3520+
getType(anchor), resolveType(cs.getContextualType()));
3521+
// TODO: It would be great so somehow point out which arguments are missing.
3522+
return true;
3523+
}
3524+
35113525
return false;
35123526
}
35133527

0 commit comments

Comments
 (0)