mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: More robust in the face of missing stdlib protocols
This came up with SourceKit fuzz testing on the stdlib. I don't have a reduced testcase right now. Progress on <rdar://problem/19554069>. Swift SVN r30882
This commit is contained in:
@@ -1827,13 +1827,14 @@ ConstraintSystem::matchTypes(Type type1, Type type2, TypeMatchKind kind,
|
||||
}
|
||||
|
||||
// Bridging from an ErrorType to an Objective-C NSError.
|
||||
auto errorType = TC.Context.getProtocol(KnownProtocolKind::ErrorType);
|
||||
if (TC.containsProtocol(type1, errorType, DC,
|
||||
ConformanceCheckFlags::InExpression))
|
||||
if (auto NSErrorTy = TC.getNSErrorType(DC))
|
||||
if (type2->isEqual(NSErrorTy))
|
||||
conversionsOrFixes.push_back(
|
||||
ConversionRestrictionKind::BridgeToNSError);
|
||||
if (auto errorType = TC.Context.getProtocol(KnownProtocolKind::ErrorType)) {
|
||||
if (TC.containsProtocol(type1, errorType, DC,
|
||||
ConformanceCheckFlags::InExpression))
|
||||
if (auto NSErrorTy = TC.getNSErrorType(DC))
|
||||
if (type2->isEqual(NSErrorTy))
|
||||
conversionsOrFixes.push_back(
|
||||
ConversionRestrictionKind::BridgeToNSError);
|
||||
}
|
||||
}
|
||||
|
||||
// Pointer arguments can be converted from pointer-compatible types.
|
||||
|
||||
Reference in New Issue
Block a user