Skip to content

Commit

Permalink
"Fixing" Reflection issues with Profile builds
Browse files Browse the repository at this point in the history
There must be some other way to check if a type is a Value Type? I doubt
if it has been removed?
  • Loading branch information
Paul Westcott committed Jul 21, 2015
1 parent c06d8e6 commit 202e12e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/fsharp/FSharp.Core/seq.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1479,9 +1479,15 @@ namespace Microsoft.FSharp.Collections

[<CompiledName("GroupBy")>]
let groupBy (keyf:'T->'Key) (seq:seq<'T>) =
if typeof<'T>.IsValueType
checkNonNull "source" seq

#if FX_ATLEAST_40
if typeof<'Key>.IsValueType
then mkDelayedSeq (fun () -> groupByValueType keyf seq)
else mkDelayedSeq (fun () -> groupByRefType keyf seq)
#else
mkDelayedSeq (fun () -> groupByRefType keyf seq)
#endif

[<CompiledName("Distinct")>]
let distinct source =
Expand Down Expand Up @@ -1557,10 +1563,16 @@ namespace Microsoft.FSharp.Collections
let countByRefType (keyf:'T->'Key) (seq:seq<'T>) = seq |> countByImpl StructBox<'Key>.Comparer (fun t -> StructBox (keyf t)) (fun sb -> sb.Value)

[<CompiledName("CountBy")>]
let countBy (keyf:'T->'Key) (seq:seq<'T>) =
if typeof<'T>.IsValueType
then mkDelayedSeq (fun () -> countByValueType keyf seq)
else mkDelayedSeq (fun () -> countByRefType keyf seq)
let countBy (keyf:'T->'Key) (source:seq<'T>) =
checkNonNull "source" source

#if FX_ATLEAST_40
if typeof<'Key>.IsValueType
then mkDelayedSeq (fun () -> countByValueType keyf source)
else mkDelayedSeq (fun () -> countByRefType keyf source)
#else
mkDelayedSeq (fun () -> countByRefType keyf source)
#endif

[<CompiledName("Sum")>]
let inline sum (source: seq< (^a) >) : ^a =
Expand Down

0 comments on commit 202e12e

Please sign in to comment.