@@ -1349,27 +1349,27 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2,
13491349 return getTypeMatchSuccess ();
13501350}
13511351
1352- // Determine if a function representation conversion is allowed returning
1353- // 'false' (i.e. no error) if the conversion is valid .
1352+ // Determine whether conversion is allowed between two function types
1353+ // based on their representations .
13541354static bool
1355- matchFunctionConversionRepresentations (FunctionTypeRepresentation rep1,
1356- FunctionTypeRepresentation rep2) {
1355+ isConversionAllowedBetween (FunctionTypeRepresentation rep1,
1356+ FunctionTypeRepresentation rep2) {
13571357 auto isThin = [](FunctionTypeRepresentation rep) {
13581358 return rep == FunctionTypeRepresentation::CFunctionPointer ||
13591359 rep == FunctionTypeRepresentation::Thin;
13601360 };
13611361
13621362 // Allowing "thin" (c, thin) to "thin" conventions
13631363 if (isThin (rep1) && isThin (rep2))
1364- return false ;
1364+ return true ;
13651365
13661366 // Allowing all to "thick" (swift, block) conventions
13671367 // "thin" (c, thin) to "thick" or "thick" to "thick"
13681368 if (rep2 == FunctionTypeRepresentation::Swift ||
13691369 rep2 == FunctionTypeRepresentation::Block)
1370- return false ;
1370+ return true ;
13711371
1372- return rep1 ! = rep2;
1372+ return rep1 = = rep2;
13731373}
13741374
13751375// Returns 'false' (i.e. no error) if it is legal to match functions with the
@@ -1390,7 +1390,9 @@ static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1,
13901390 if (!(last && last->is <LocatorPathElt::FunctionArgument>()))
13911391 return false ;
13921392
1393- return matchFunctionConversionRepresentations (rep1, rep2);
1393+ // Inverting the result because matchFunctionRepresentations
1394+ // returns false in conversions are allowed.
1395+ return !isConversionAllowedBetween (rep1, rep2);
13941396 }
13951397
13961398 case ConstraintKind::OpaqueUnderlyingType:
0 commit comments