Skip to content

Commit 5428dae

Browse files
---
yaml --- r: 341223 b: refs/heads/rxwei-patch-1 c: 7aaf71c h: refs/heads/master i: 341221: 0a87525 341219: d52919e 341215: e143fb3
1 parent f0e0d1d commit 5428dae

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-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: f9fd006c3035d4aebbf422c9a980e320ca842d91
1018+
refs/heads/rxwei-patch-1: 7aaf71c216d165217ff797427b6113df08b592c7
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/CSApply.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3708,9 +3708,8 @@ namespace {
37083708

37093709
cs.setExprTypes(sub);
37103710

3711-
sub = coerceToType(sub, toType, cs.getConstraintLocator(sub));
3712-
3713-
if (!sub) return nullptr;
3711+
if (tc.convertToType(sub, toType, cs.DC))
3712+
return nullptr;
37143713

37153714
cs.cacheExprTypes(sub);
37163715

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3323,6 +3323,11 @@ bool TypeChecker::convertToType(Expr *&expr, Type type, DeclContext *dc,
33233323
// TODO: need to add kind arg?
33243324
// Construct a constraint system from this expression.
33253325
ConstraintSystem cs(*this, dc, ConstraintSystemFlags::AllowFixes);
3326+
3327+
// Cache the expression type on the system to ensure it is available
3328+
// on diagnostics if the convertion fails.
3329+
cs.cacheExprTypes(expr);
3330+
33263331
// If there is a type that we're expected to convert to, add the conversion
33273332
// constraint.
33283333
cs.addConstraint(ConstraintKind::Conversion, expr->getType(), type,

0 commit comments

Comments
 (0)