Sema: Fix compiler_crasher with FixKind::ForceOptional

We were using getRValueType() and getRValueObjectType() when
setting up the constraint, but getRValueType() when simplifying
it. This led to a crash if the type was a single-argument tuple
with a named argument.

Swift SVN r29376
This commit is contained in:
Slava Pestov
2015-06-15 02:00:46 +00:00
parent d7b9ae72aa
commit 6a9790ed30
21 changed files with 28 additions and 21 deletions

View File

@@ -4389,8 +4389,8 @@ ConstraintSystem::simplifyFixConstraint(Fix fix,
case FixKind::ForceOptional:
// Assume that '!' was applied to the first type.
return matchTypes(type1->getRValueType()->getOptionalObjectType(), type2,
matchKind, subFlags, locator);
return matchTypes(type1->getRValueObjectType()->getOptionalObjectType(),
type2, matchKind, subFlags, locator);
case FixKind::ForceDowncast:
// These work whenever they are suggested.