From ec2eabc022ce45f91442f69ea24ca826104e095f Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Mon, 3 Aug 2020 20:51:16 +0100 Subject: [PATCH 1/5] Remove CompactFramework-supporting implementations --- src/fsharp/FSharp.Core/event.fs | 14 ++++---------- src/fsharp/FSharp.Core/seqcore.fs | 5 +---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/fsharp/FSharp.Core/event.fs b/src/fsharp/FSharp.Core/event.fs index 8643b669c3e..d14eea26904 100644 --- a/src/fsharp/FSharp.Core/event.fs +++ b/src/fsharp/FSharp.Core/event.fs @@ -97,13 +97,10 @@ namespace Microsoft.FSharp.Control // CreateDelegate creates a delegate that is fast to invoke. invoker.Invoke(multicast, sender, args) |> ignore - member x.Publish = - // Note, we implement each interface explicitly: this works around a bug in the CLR - // implementation on CompactFramework 3.7, used on Windows Phone 7 + member x.Publish = { new obj() with member x.ToString() = "" - interface IEvent<'Delegate,'Args> - interface IDelegateEvent<'Delegate> with + interface IEvent<'Delegate,'Args> with member e.AddHandler(d) = multicast <- System.Delegate.Combine(multicast, d) :?> 'Delegate member e.RemoveHandler(d) = @@ -126,13 +123,10 @@ namespace Microsoft.FSharp.Control match x.multicast with | null -> () | d -> d.Invoke(null,arg) |> ignore - member x.Publish = - // Note, we implement each interface explicitly: this works around a bug in the CLR - // implementation on CompactFramework 3.7, used on Windows Phone 7 + member x.Publish = { new obj() with member x.ToString() = "" - interface IEvent<'T> - interface IDelegateEvent> with + interface IEvent<'T> with member e.AddHandler(d) = x.multicast <- (System.Delegate.Combine(x.multicast, d) :?> Handler<'T>) member e.RemoveHandler(d) = diff --git a/src/fsharp/FSharp.Core/seqcore.fs b/src/fsharp/FSharp.Core/seqcore.fs index bc54d01e670..663227cb4e5 100644 --- a/src/fsharp/FSharp.Core/seqcore.fs +++ b/src/fsharp/FSharp.Core/seqcore.fs @@ -335,12 +335,9 @@ namespace Microsoft.FSharp.Core.CompilerServices (FinallyEnumerable(compensation, (fun () -> source)) :> seq<_>) let CreateEvent (addHandler : 'Delegate -> unit) (removeHandler : 'Delegate -> unit) (createHandler : (obj -> 'Args -> unit) -> 'Delegate ) :IEvent<'Delegate,'Args> = - // Note, we implement each interface explicitly: this works around a bug in the CLR - // implementation on CompactFramework 3.7, used on Windows Phone 7 { new obj() with member x.ToString() = "" - interface IEvent<'Delegate,'Args> - interface IDelegateEvent<'Delegate> with + interface IEvent<'Delegate,'Args> with member x.AddHandler(h) = addHandler h member x.RemoveHandler(h) = removeHandler h interface System.IObservable<'Args> with From 98572eaede17e32b5df46365aef126ab781c2b0e Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Tue, 4 Aug 2020 09:26:35 +0100 Subject: [PATCH 2/5] Remove unneeded TryDeref and simplify OR logic --- src/fsharp/TypedTreeBasics.fs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/fsharp/TypedTreeBasics.fs b/src/fsharp/TypedTreeBasics.fs index 7f35d57a865..593b189e393 100644 --- a/src/fsharp/TypedTreeBasics.fs +++ b/src/fsharp/TypedTreeBasics.fs @@ -412,17 +412,11 @@ let primUnionCaseRefEq compilingFslib fslibCcu (UnionCaseRef(tcr1, c1) as uc1) ( /// /// Note this routine doesn't take type forwarding into account let primValRefEq compilingFslib fslibCcu (x: ValRef) (y: ValRef) = - x === y || - if (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) || - (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) then - true - else - (// Use TryDeref to guard against the platforms/times when certain F# language features aren't available, - // e.g. CompactFramework doesn't have support for quotations. - match x.TryDeref with - | ValueSome v1 -> match y.TryDeref with ValueSome v2 -> v1 === v2 | _ -> false - | _ -> match y.TryDeref with ValueNone -> true | _ -> false) - || (if compilingFslib then fslibValRefEq fslibCcu x y else false) + x === y + || (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) + || (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) + || x.Deref === y.Deref + || (compilingFslib && fslibValRefEq fslibCcu x y) //--------------------------------------------------------------------------- // pubpath/cpath mess From 6fad1e5fba995b87b709876be267fb357b6939ec Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Fri, 7 Aug 2020 07:50:45 +0100 Subject: [PATCH 3/5] Revert "Remove unneeded TryDeref and simplify OR logic" This reverts commit 9fb63c26d0f32a47556900f62ac87d8dcb810903. --- src/fsharp/TypedTreeBasics.fs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/fsharp/TypedTreeBasics.fs b/src/fsharp/TypedTreeBasics.fs index 593b189e393..7f35d57a865 100644 --- a/src/fsharp/TypedTreeBasics.fs +++ b/src/fsharp/TypedTreeBasics.fs @@ -412,11 +412,17 @@ let primUnionCaseRefEq compilingFslib fslibCcu (UnionCaseRef(tcr1, c1) as uc1) ( /// /// Note this routine doesn't take type forwarding into account let primValRefEq compilingFslib fslibCcu (x: ValRef) (y: ValRef) = - x === y - || (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) - || (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) - || x.Deref === y.Deref - || (compilingFslib && fslibValRefEq fslibCcu x y) + x === y || + if (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) || + (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) then + true + else + (// Use TryDeref to guard against the platforms/times when certain F# language features aren't available, + // e.g. CompactFramework doesn't have support for quotations. + match x.TryDeref with + | ValueSome v1 -> match y.TryDeref with ValueSome v2 -> v1 === v2 | _ -> false + | _ -> match y.TryDeref with ValueNone -> true | _ -> false) + || (if compilingFslib then fslibValRefEq fslibCcu x y else false) //--------------------------------------------------------------------------- // pubpath/cpath mess From 3b41412ef7230ab492f2722e5076b2f301311e49 Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Fri, 7 Aug 2020 08:40:21 +0100 Subject: [PATCH 4/5] remove CompactFramework reference and simplify or logic take 2 --- src/fsharp/TypedTreeBasics.fs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/fsharp/TypedTreeBasics.fs b/src/fsharp/TypedTreeBasics.fs index 7f35d57a865..0da4790367c 100644 --- a/src/fsharp/TypedTreeBasics.fs +++ b/src/fsharp/TypedTreeBasics.fs @@ -412,17 +412,14 @@ let primUnionCaseRefEq compilingFslib fslibCcu (UnionCaseRef(tcr1, c1) as uc1) ( /// /// Note this routine doesn't take type forwarding into account let primValRefEq compilingFslib fslibCcu (x: ValRef) (y: ValRef) = - x === y || - if (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) || - (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) then - true - else - (// Use TryDeref to guard against the platforms/times when certain F# language features aren't available, - // e.g. CompactFramework doesn't have support for quotations. - match x.TryDeref with - | ValueSome v1 -> match y.TryDeref with ValueSome v2 -> v1 === v2 | _ -> false - | _ -> match y.TryDeref with ValueNone -> true | _ -> false) - || (if compilingFslib then fslibValRefEq fslibCcu x y else false) + x === y + || (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) + || (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) + || // Use TryDeref to guard against the platforms/times when certain F# language features aren't available + match x.TryDeref with + | ValueSome v1 -> match y.TryDeref with ValueSome v2 -> v1 === v2 | ValueNone -> false + | ValueNone -> match y.TryDeref with ValueNone -> true | ValueSome _ -> false + || (compilingFslib && fslibValRefEq fslibCcu x y) //--------------------------------------------------------------------------- // pubpath/cpath mess From 3843cd5ac8b15b985ce1445b77981a520ce6842b Mon Sep 17 00:00:00 2001 From: Abel Braaksma Date: Sat, 22 Aug 2020 18:21:59 +0200 Subject: [PATCH 5/5] ws cleanup --- src/fsharp/TypedTreeBasics.fs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/fsharp/TypedTreeBasics.fs b/src/fsharp/TypedTreeBasics.fs index 0da4790367c..8c74d6bdbeb 100644 --- a/src/fsharp/TypedTreeBasics.fs +++ b/src/fsharp/TypedTreeBasics.fs @@ -413,13 +413,13 @@ let primUnionCaseRefEq compilingFslib fslibCcu (UnionCaseRef(tcr1, c1) as uc1) ( /// Note this routine doesn't take type forwarding into account let primValRefEq compilingFslib fslibCcu (x: ValRef) (y: ValRef) = x === y - || (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) - || (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) - || // Use TryDeref to guard against the platforms/times when certain F# language features aren't available - match x.TryDeref with - | ValueSome v1 -> match y.TryDeref with ValueSome v2 -> v1 === v2 | ValueNone -> false - | ValueNone -> match y.TryDeref with ValueNone -> true | ValueSome _ -> false - || (compilingFslib && fslibValRefEq fslibCcu x y) + || (x.IsResolved && y.IsResolved && x.ResolvedTarget === y.ResolvedTarget) + || (x.IsLocalRef && y.IsLocalRef && valEq x.ResolvedTarget y.ResolvedTarget) + || // Use TryDeref to guard against the platforms/times when certain F# language features aren't available + match x.TryDeref with + | ValueSome v1 -> match y.TryDeref with ValueSome v2 -> v1 === v2 | ValueNone -> false + | ValueNone -> match y.TryDeref with ValueNone -> true | ValueSome _ -> false + || (compilingFslib && fslibValRefEq fslibCcu x y) //--------------------------------------------------------------------------- // pubpath/cpath mess