Skip to content

Commit 3a4f0b7

Browse files
committed
Minor shift in logic order for less comparisons
1 parent ccd2156 commit 3a4f0b7

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/fsharp/FSharp.Core/prim-types.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,13 +1156,13 @@ namespace Microsoft.FSharp.Core
11561156
true
11571157

11581158
and isSuitableTupleType (ty:Type) =
1159-
Reflection.isTupleType ty
1160-
&& ty.IsValueType // Tuple<...> don't have implementation, but ValueTuple<...> does
1161-
&& checkType 0 (ty.GetGenericArguments ())
1159+
ty.IsValueType && // Tuple<...> don't have implementation, but ValueTuple<...> does
1160+
Reflection.isTupleType ty &&
1161+
checkType 0 (ty.GetGenericArguments ())
11621162

11631163
and isSuitableStructType (ty:Type) =
1164-
Reflection.isObjectType (ty, bindingPublicOrNonPublic) &&
11651164
ty.IsValueType &&
1165+
Reflection.isObjectType (ty, bindingPublicOrNonPublic) &&
11661166
(not (isCustom ty)) &&
11671167
checkType 0 (Reflection.getAllInstanceFields ty)
11681168

@@ -1202,11 +1202,11 @@ namespace Microsoft.FSharp.Core
12021202
&& (er || (not (ty.Equals typeof<float>)))
12031203
&& (er || (not (ty.Equals typeof<float32>)))
12041204
&& isSuitableNullableTypeOrNotNullable ty
1205-
&& ( isSuitableTupleType ty
1205+
&& ((not (hasStructuralInterface ty))
1206+
|| isSuitableTupleType ty
12061207
|| isSuitableStructType ty
12071208
|| isSuitableRecordType ty
1208-
|| isSuitableUnionType ty
1209-
|| not (hasStructuralInterface ty))
1209+
|| isSuitableUnionType ty)
12101210
&& checkType (idx+1) types
12111211

12121212
checkType 0 [|rootType|]

0 commit comments

Comments
 (0)