Skip to content
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
29 changes: 0 additions & 29 deletions .fantomasignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ artifacts/
.git/

# Explicitly unformatted implementation
src/Compiler/Checking/AccessibilityLogic.fs
src/Compiler/Checking/AttributeChecking.fs
src/Compiler/Checking/AugmentWithHashCompare.fs
src/Compiler/Checking/CheckBasics.fs
src/Compiler/Checking/CheckDeclarations.fs
src/Compiler/Checking/Expressions/CheckExpressions.fs
src/Compiler/Checking/CheckFormatStrings.fs
Expand All @@ -40,32 +36,7 @@ src/Compiler/Checking/SignatureConformance.fs
src/Compiler/Checking/TypeHierarchy.fs
src/Compiler/Checking/TypeRelations.fs

# The following files were formatted, but the "format, --check" loop is not stable.
# Fantomas formats them, but still thinks they need formatting
src/Compiler/Optimize/DetupleArgs.fs
src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs
src/Compiler/Optimize/LowerCalls.fs
src/Compiler/Optimize/LowerComputedCollections.fs
src/Compiler/Optimize/LowerLocalMutables.fs
src/Compiler/Optimize/LowerSequences.fs
src/Compiler/Optimize/LowerStateMachines.fs
src/Compiler/Optimize/Optimizer.fs

src/Compiler/Symbols/Exprs.fs
src/Compiler/Symbols/FSharpDiagnostic.fs
src/Compiler/Symbols/SymbolHelpers.fs
src/Compiler/Symbols/SymbolPatterns.fs
src/Compiler/Symbols/Symbols.fs

src/Compiler/TypedTree/CompilerGlobalState.fs
src/Compiler/TypedTree/QuotationPickler.fs
src/Compiler/TypedTree/tainted.fs
src/Compiler/TypedTree/TcGlobals.fs
src/Compiler/TypedTree/TypedTree.fs
src/Compiler/TypedTree/TypedTreeBasics.fs
src/Compiler/TypedTree/TypedTreeOps.fs
src/Compiler/TypedTree/TypedTreePickle.fs
src/Compiler/TypedTree/TypeProviders.fs
# Explicitly unformatted file that needs more care to get it to format well

src/Compiler/SyntaxTree/LexFilter.fs
Expand Down
417 changes: 223 additions & 194 deletions src/Compiler/Checking/AccessibilityLogic.fs

Large diffs are not rendered by default.

610 changes: 332 additions & 278 deletions src/Compiler/Checking/AttributeChecking.fs

Large diffs are not rendered by default.

99 changes: 56 additions & 43 deletions src/Compiler/Checking/AugmentWithHashCompare.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ open FSharp.Compiler.TypedTreeOps
open FSharp.Compiler.TypeHierarchy

let mkIComparableCompareToSlotSig (g: TcGlobals) =
TSlotSig("CompareTo", g.mk_IComparable_ty, [], [], [ [ TSlotParam(Some("obj"), g.obj_ty_withNulls, false, false, false, []) ] ], Some g.int_ty)
TSlotSig(
"CompareTo",
g.mk_IComparable_ty,
[],
[],
[ [ TSlotParam(Some("obj"), g.obj_ty_withNulls, false, false, false, []) ] ],
Some g.int_ty
)

let mkGenericIComparableCompareToSlotSig (g: TcGlobals) ty =
TSlotSig(
Expand Down Expand Up @@ -79,7 +86,14 @@ let mkGetHashCodeSlotSig (g: TcGlobals) =
TSlotSig("GetHashCode", g.obj_ty_noNulls, [], [], [ [] ], Some g.int_ty)

let mkEqualsSlotSig (g: TcGlobals) =
TSlotSig("Equals", g.obj_ty_noNulls, [], [], [ [ TSlotParam(Some("obj"), g.obj_ty_withNulls, false, false, false, []) ] ], Some g.bool_ty)
TSlotSig(
"Equals",
g.obj_ty_noNulls,
[],
[],
[ [ TSlotParam(Some("obj"), g.obj_ty_withNulls, false, false, false, []) ] ],
Some g.bool_ty
)

//-------------------------------------------------------------------------
// Helpers associated with code-generation of comparison/hash augmentations
Expand Down Expand Up @@ -386,20 +400,19 @@ let mkRecdEqualityWithComparer g tcref (tycon: Tycon) thise thatobje (thatv, tha

let expr = mkBindThatAddr g m ty thataddrv thatv thate expr

let expr =
if isexact then
let expr =
if isexact then
expr
else
mkIsInstConditional g m ty thatobje thatv expr (mkFalse g m)

let expr =
if tycon.IsStructOrEnumTycon then
expr
else if isexact then
mkBindThatNullEquals g m thise thate expr
else
if isexact then
mkBindThatNullEquals g m thise thate expr
else
mkBindThisNullEquals g m thise thatobje expr
mkBindThisNullEquals g m thise thatobje expr

expr

Expand Down Expand Up @@ -464,20 +477,19 @@ let mkExnEqualityWithComparer g exnref (exnc: Tycon) thise thatobje (thatv, that

let expr = mkBindThatAddr g m g.exn_ty thataddrv thatv thate expr

let expr =
let expr =
if isexact then
expr
else
else
mkIsInstConditional g m g.exn_ty thatobje thatv expr (mkFalse g m)

let expr =
if exnc.IsStructOrEnumTycon then
expr
else if isexact then
mkBindThatNullEquals g m thise thate expr
else
if isexact then
mkBindThatNullEquals g m thise thate expr
else
mkBindThisNullEquals g m thise thatobje expr
mkBindThisNullEquals g m thise thatobje expr

expr

Expand Down Expand Up @@ -865,7 +877,7 @@ let mkUnionEqualityWithComparer g tcref (tycon: Tycon) thise thatobje (thatv, th

let expr = mkBindThatAddr g m ty thataddrv thatv thate expr

let expr =
let expr =
if isexact then
expr
else
Expand All @@ -874,11 +886,10 @@ let mkUnionEqualityWithComparer g tcref (tycon: Tycon) thise thatobje (thatv, th
let expr =
if tycon.IsStructOrEnumTycon then
expr
else if isexact then
mkBindThatNullEquals g m thise thate expr
else
if isexact then
mkBindThatNullEquals g m thise thate expr
else
mkBindThisNullEquals g m thise thatobje expr
mkBindThisNullEquals g m thise thatobje expr

expr

Expand Down Expand Up @@ -1041,7 +1052,7 @@ let getAugmentationAttribs g (tycon: Tycon) =
TryFindFSharpBoolAttribute g g.attrib_StructuralComparisonAttribute tycon.Attribs

[<NoEquality; NoComparison; StructuredFormatDisplay("{DebugText}")>]
type EqualityWithComparerAugmentation =
type EqualityWithComparerAugmentation =
{
GetHashCode: Val
GetHashCodeWithComparer: Val
Expand Down Expand Up @@ -1369,24 +1380,27 @@ let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) =
mkValSpec g tcref ty vis (Some(mkIStructuralEquatableEqualsSlotSig g)) "Equals" (tps +-> (mkEqualsWithComparerTy g ty)) tupArg false

let withEqualsExactWithComparer =
let vis = TAccess (updateSyntaxAccessForCompPath (vis.CompilationPaths) SyntaxAccess.Public)
let vis =
TAccess(updateSyntaxAccessForCompPath (vis.CompilationPaths) SyntaxAccess.Public)

mkValSpec
g
tcref
g
tcref
ty
vis
// This doesn't implement any interface.
None
"Equals"
(tps +-> (mkEqualsWithComparerTyExact g ty))
tupArg
None
"Equals"
(tps +-> (mkEqualsWithComparerTyExact g ty))
tupArg
false

{
GetHashCode = objGetHashCodeVal
GetHashCodeWithComparer = withGetHashCodeVal
EqualsWithComparer = withEqualsVal
EqualsExactWithComparer = withEqualsExactWithComparer
}
}

let MakeBindingsForCompareAugmentation g (tycon: Tycon) =
let tcref = mkLocalTyconRef tycon
Expand Down Expand Up @@ -1515,21 +1529,20 @@ let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon: Tycon
let equalse =
match withcEqualsExactValOption with
| Some withcEqualsExactVal ->
mkIsInstConditional
g
m
ty
thatobje
thatv
(mkApps
g
((exprForValRef m withcEqualsExactVal, withcEqualsExactVal.Type),
(if isNil tinst then [] else [ tinst ]),
[ thise; mkRefTupled g m [ thate; compe ] [ty; g.IEqualityComparer_ty ] ],
m))
(mkFalse g m)
| None ->
equalsf g tcref tycon thise thatobje (thatv, thate) compe false
mkIsInstConditional
g
m
ty
thatobje
thatv
(mkApps
g
((exprForValRef m withcEqualsExactVal, withcEqualsExactVal.Type),
(if isNil tinst then [] else [ tinst ]),
[ thise; mkRefTupled g m [ thate; compe ] [ ty; g.IEqualityComparer_ty ] ],
m))
(mkFalse g m)
| None -> equalsf g tcref tycon thise thatobje (thatv, thate) compe false

mkMultiLambdas g m tps [ [ thisv ]; [ thatobjv; compv ] ] (equalse, g.bool_ty)

Expand Down
Loading