Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit663d07f

Browse files
committed
cleanup
1 parente57e82a commit663d07f

File tree

1 file changed

+30
-32
lines changed

1 file changed

+30
-32
lines changed

‎src/fsharp/ConstraintSolver.fs‎

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,43 +1542,42 @@ and AddConstraint (csenv:ConstraintSolverEnv) ndeep m2 trace tp newConstraint =
15421542
TyparConstraint.MayResolveMember(trait2,_)->
15431543
traitsAEquiv g aenv trait1 trait2
15441544

1545-
| TyparConstraint.CoercesTo(ty1,_),TyparConstraint.CoercesTo(ty2,_)->
1545+
| TyparConstraint.CoercesTo(ty1,_),TyparConstraint.CoercesTo(ty2,_)->
15461546
ExistsSameHeadTypeInHierarchy g amap m ty1 ty2
15471547

1548-
| TyparConstraint.IsEnum(u1,_),TyparConstraint.IsEnum(u2,_)-> typeEquiv g u1 u2
1548+
| TyparConstraint.IsEnum(u1,_),TyparConstraint.IsEnum(u2,_)-> typeEquiv g u1 u2
15491549

1550-
| TyparConstraint.IsDelegate(aty1,bty1,_),TyparConstraint.IsDelegate(aty2,bty2,_)->
1550+
| TyparConstraint.IsDelegate(aty1,bty1,_),TyparConstraint.IsDelegate(aty2,bty2,_)->
15511551
typeEquiv g aty1 aty2&& typeEquiv g bty1 bty2
15521552

1553-
| TyparConstraint.SupportsComparison_,TyparConstraint.SupportsComparison_
1554-
| TyparConstraint.SupportsEquality_,TyparConstraint.SupportsEquality_
1553+
| TyparConstraint.SupportsComparison_,TyparConstraint.SupportsComparison_
1554+
| TyparConstraint.SupportsEquality_,TyparConstraint.SupportsEquality_
15551555
// comparison implies equality
1556-
| TyparConstraint.SupportsComparison_,TyparConstraint.SupportsEquality_
1557-
| TyparConstraint.SupportsNull_,TyparConstraint.SupportsNull_
1558-
| TyparConstraint.IsNonNullableStruct_,TyparConstraint.IsNonNullableStruct_
1556+
| TyparConstraint.SupportsComparison_,TyparConstraint.SupportsEquality_
1557+
| TyparConstraint.SupportsNull_,TyparConstraint.SupportsNull_
1558+
| TyparConstraint.IsNonNullableStruct_,TyparConstraint.IsNonNullableStruct_
15591559
| TyparConstraint.IsUnmanaged_, TyparConstraint.IsUnmanaged_
1560-
| TyparConstraint.IsReferenceType_,TyparConstraint.IsReferenceType_
1561-
| TyparConstraint.RequiresDefaultConstructor_,TyparConstraint.RequiresDefaultConstructor_->true
1562-
| TyparConstraint.SimpleChoice(tys1,_),TyparConstraint.SimpleChoice(tys2,_)-> ListSet.isSubsetOf(typeEquiv g) tys1 tys2
1560+
| TyparConstraint.IsReferenceType_,TyparConstraint.IsReferenceType_
1561+
| TyparConstraint.RequiresDefaultConstructor_,TyparConstraint.RequiresDefaultConstructor_->true
1562+
| TyparConstraint.SimpleChoice(tys1,_),TyparConstraint.SimpleChoice(tys2,_)-> ListSet.isSubsetOf(typeEquiv g) tys1 tys2
15631563
| TyparConstraint.DefaultsTo(priority1,dty1,_), TyparConstraint.DefaultsTo(priority2,dty2,_)->
15641564
(priority1= priority2)&& typeEquiv g dty1 dty2
15651565
|_->false
1566-
15671566

15681567

15691568
// First ensure constraint conforms with existing constraints
15701569
// NOTE: QUADRATIC
15711570
letexistingConstraints= tp.Constraints
15721571

15731572
letallCxs= newConstraint:: List.rev existingConstraints
1574-
begin
1575-
let recenforceMutualConsistency i cxs=
1576-
match cxswith
1577-
|[]-> CompleteD
1578-
| cx:: rest-> IterateIdxD(fun j cx2->if i= jthen CompleteDelse consistent cx cx2) allCxs++(fun()-> enforceMutualConsistency(i+1) rest)
1579-
1580-
enforceMutualConsistency0 allCxs
1581-
end++(fun()->
1573+
1574+
let recenforceMutualConsistency i cxs=
1575+
match cxswith
1576+
|[]-> CompleteD
1577+
| cx:: rest-> IterateIdxD(fun j cx2->if i= jthen CompleteDelse consistent cx cx2) allCxs++(fun()-> enforceMutualConsistency(i+1) rest)
1578+
1579+
enforceMutualConsistency0 allCxs
1580+
++(fun()->
15821581

15831582
letimpliedByExistingConstraints= existingConstraints|> List.exists(fun tpc2-> implies tpc2 newConstraint)
15841583

@@ -1592,7 +1591,7 @@ and AddConstraint (csenv:ConstraintSolverEnv) ndeep m2 trace tp newConstraint =
15921591
elif tp.Rigidity= TyparRigidity.Rigidthen
15931592
ErrorD(ConstraintSolverMissingConstraint(denv,tp,newConstraint,m,m2))
15941593
else
1595-
(// It is important that we give a warning if a constraint is missing from a
1594+
// It is important that we give a warning if a constraint is missing from a
15961595
// will-be-made-rigid type variable. This is because the existence of these warnings
15971596
// is relevant to the overload resolution rules (see 'candidateWarnCount' in the overload resolution
15981597
// implementation). See also FSharp 1.0 bug 5461
@@ -1602,25 +1601,24 @@ and AddConstraint (csenv:ConstraintSolverEnv) ndeep m2 trace tp newConstraint =
16021601
CompleteD)++(fun()->
16031602

16041603
letnewConstraints=
1605-
// Eliminate any constraints where one constraint implies another
1606-
// Keep constraints in the left-to-right form according to the order they are asserted.
1607-
// NOTE: QUADRATIC
1608-
let receliminateRedundant cxs acc=
1609-
match cxswith
1610-
|[]-> acc
1611-
| cx:: rest->
1612-
eliminateRedundant rest(if List.exists(fun cx2-> implies cx2 cx) accthen accelse(cx::acc))
1604+
// Eliminate any constraints where one constraint implies another
1605+
// Keep constraints in the left-to-right form according to the order they are asserted.
1606+
// NOTE: QUADRATIC
1607+
let receliminateRedundant cxs acc=
1608+
match cxswith
1609+
|[]-> acc
1610+
| cx:: rest->
1611+
eliminateRedundant rest(if List.exists(fun cx2-> implies cx2 cx) accthen accelse(cx::acc))
16131612

1614-
eliminateRedundant allCxs[]
1613+
eliminateRedundant allCxs[]
16151614

1616-
16171615
// Write the constraint into the type variable
16181616
// Record a entry in the undo trace if one is provided
16191617
letd= tp.Data
16201618
letorig= d.typar_constraints
16211619
trace.Exec(fun()-> d.typar_constraints<- newConstraints)(fun()-> d.typar_constraints<- orig)
16221620

1623-
CompleteD)))
1621+
CompleteD))
16241622

16251623
andSolveTypSupportsNull(csenv:ConstraintSolverEnv)ndeep m2 trace ty=
16261624
letg= csenv.g

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp