Skip to content

Use struct tuples instead of reference tuples for orders defined in terms of pairs #18513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ type ReqdItem =

let reqdItemOrder =
let rep = function
| ReqdSubEnv v -> true, v
| ReqdVal v -> false, v
| ReqdSubEnv v -> struct (true, v)
| ReqdVal v -> struct (false, v)

Order.orderOn rep (Pair.order (Bool.order, valOrder))

Expand Down
3 changes: 1 addition & 2 deletions src/Compiler/Utilities/lib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ module Int64 =

module Pair =
let order (compare1: IComparer<'T1>, compare2: IComparer<'T2>) =
{ new IComparer<'T1 * 'T2> with
{ new IComparer<struct ('T1 * 'T2)> with
member _.Compare((a1, a2), (aa1, aa2)) =
let res1 = compare1.Compare (a1, aa1)
if res1 <> 0 then res1 else compare2.Compare (a2, aa2) }


type NameSet = Zset<string>

module NameSet =
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Utilities/lib.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module Int64 =
val order: IComparer<int64>

module Pair =
val order: compare1: IComparer<'T1> * compare2: IComparer<'T2> -> IComparer<'T1 * 'T2>
val order: compare1: IComparer<'T1> * compare2: IComparer<'T2> -> IComparer<struct ('T1 * 'T2)>

type NameSet = Zset<string>

Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/Utilities/range.fs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ module Range =

let posOrder =
let pairOrder = Pair.order (Int32.order, Int32.order)
let lineAndColumn = fun (p: pos) -> p.Line, p.Column
let lineAndColumn = fun (p: pos) -> struct (p.Line, p.Column)

{ new IComparer<pos> with
member _.Compare(x, xx) =
Expand All @@ -458,7 +458,7 @@ module Range =

let rangeOrder =
let tripleOrder = Pair.order (String.order, Pair.order (posOrder, posOrder))
let fileLineColumn = fun (r: range) -> r.FileName, (r.Start, r.End)
let fileLineColumn = fun (r: range) -> struct (r.FileName, struct (r.Start, r.End))

{ new IComparer<range> with
member _.Compare(x, xx) =
Expand Down
Loading