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

Commit868a184

Browse files
authored
Merge pull requestdotnet#4572 from Microsoft/merges/master-to-dev15.7
Merge master to dev15.7
2 parentsd5c5f39 +178fc31 commit868a184

File tree

13 files changed

+360
-102
lines changed

13 files changed

+360
-102
lines changed

‎src/fsharp/ConstraintSolver.fs‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ let FilterEachThenUndo f meths =
359359
trace.Undo()
360360
match CheckNoErrorsAndGetWarnings reswith
361361
| None-> None
362-
| Some warns-> Some(calledMeth, warns.Length, trace))
362+
| Some warns-> Some(calledMeth, warns, trace))
363363

364364
letShowAccessDomain ad=
365365
match adwith
@@ -2194,8 +2194,8 @@ and ResolveOverloading
21942194
(ArgsEquivInsideUndo csenv cx.IsSome)
21952195
reqdRetTyOpt
21962196
calledMeth)with
2197-
|[(calledMeth,_,_)]->
2198-
Some calledMeth,CompleteD, NoTrace// Can't re-play the trace since ArgsEquivInsideUndo was used
2197+
|[(calledMeth,warns,_)]->
2198+
Some calledMeth,OkResult(warns,()), NoTrace// Can't re-play the trace since ArgsEquivInsideUndo was used
21992199

22002200
|_->
22012201
// Now determine the applicable methods.
@@ -2255,8 +2255,8 @@ and ResolveOverloading
22552255

22562256
None, ErrorD(failOverloading(FSComp.SR.csNoOverloadsFound methodName) errors), NoTrace
22572257

2258-
|[(calledMeth,_, t)]->
2259-
Some calledMeth,CompleteD, WithTrace t
2258+
|[(calledMeth,warns, t)]->
2259+
Some calledMeth,OkResult(warns,()), WithTrace t
22602260

22612261
| applicableMeths->
22622262

@@ -2292,7 +2292,9 @@ and ResolveOverloading
22922292
if c<>0then celse
22932293
0
22942294

2295-
letbetter(candidate:CalledMeth<_>,candidateWarnCount,_)(other:CalledMeth<_>,otherWarnCount,_)=
2295+
letbetter(candidate:CalledMeth<_>,candidateWarnings,_)(other:CalledMeth<_>,otherwarnings,_)=
2296+
letcandidateWarnCount= List.length candidateWarnings
2297+
letotherWarnCount= List.length otherwarnings
22962298
// Prefer methods that don't give "this code is less generic" warnings
22972299
// Note: Relies on 'compare' respecting true > false
22982300
letc= compare(candidateWarnCount=0)(otherWarnCount=0)
@@ -2383,7 +2385,7 @@ and ResolveOverloading
23832385
else
23842386
None)
23852387
match bestMethodswith
2386-
|[(calledMeth,_, t)]-> Some calledMeth,CompleteD, WithTrace t
2388+
|[(calledMeth,warns, t)]-> Some calledMeth,OkResult(warns,()), WithTrace t
23872389
| bestMethods->
23882390
letmethodNames=
23892391
letmethods=

‎src/fsharp/IlxGen.fs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal
1717
openMicrosoft.FSharp.Compiler.AbstractIL.Internal.Library
1818
openMicrosoft.FSharp.Compiler.AbstractIL.Extensions.ILX
1919
openMicrosoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types
20-
openMicrosoft.FSharp.Compiler.AbstractIL.Diagnostics
2120
openMicrosoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants
2221

2322
openMicrosoft.FSharp.Compiler
@@ -35,7 +34,6 @@ open Microsoft.FSharp.Compiler.Lib
3534
openMicrosoft.FSharp.Compiler.TypeRelations
3635
openMicrosoft.FSharp.Compiler.TypeChecker
3736
openMicrosoft.FSharp.Compiler.Infos
38-
openMicrosoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types
3937

4038

4139
letIsNonErasedTypar(tp:Typar)=not tp.IsErased

‎src/fsharp/IlxGen.fsi‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,39 @@ type IlxGenBackend =
1818
[<NoEquality; NoComparison>]
1919
typeinternalIlxGenOptions=
2020
{ fragName:string
21+
22+
/// Indicates if we are generating filter blocks
2123
generateFilterBlocks:bool
24+
25+
/// Indicates if we should workaround old reflection emit bugs
2226
workAroundReflectionEmitBugs:bool
27+
28+
/// Indicates if static array data should be emitted using static blobs
2329
emitConstantArraysUsingStaticDataBlobs:bool
30+
2431
/// If this is set, then the last module becomes the "main" module
2532
mainMethodInfo:Attribs option
33+
34+
/// Indicates if local optimizations are active
2635
localOptimizationsAreOn:bool
36+
37+
/// Indicates if we are generating debug symbols or not
2738
generateDebugSymbols:bool
39+
40+
/// A flag to help test emit of debug information
2841
testFlagEmitFeeFeeAs100001:bool
42+
43+
/// Indicates which backend we are generating code for
2944
ilxBackend:IlxGenBackend
45+
3046
/// Indicates the code is being generated in FSI.EXE and is executed immediately after code generation
3147
/// This includes all interactively compiled code, including #load, definitions, and expressions
3248
isInteractive:bool
49+
3350
/// Indicates the code generated is an interactive 'it' expression. We generate a setter to allow clearing of the underlying
3451
/// storage, even though 'it' is not logically mutable
3552
isInteractiveItExpr:bool
53+
3654
/// Indicates that, whenever possible, use callvirt instead of call
3755
alwaysCallVirt:bool}
3856

‎src/fsharp/NameResolution.fs‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,12 +1330,18 @@ let (|ActivePatternCaseUse|_|) (item:Item) =
13301330
| Item.ActivePatternResult(ap,_, idx,_)-> Some(ap.Range, ap.Range, idx)
13311331
|_-> None
13321332

1333+
lettyconRefDefnHash(_g:TcGlobals)(eref1:EntityRef)=
1334+
hash eref1.LogicalName
1335+
13331336
lettyconRefDefnEq g(eref1:EntityRef)(eref2:EntityRef)=
13341337
tyconRefEq g eref1 eref2
13351338
// Signature items considered equal to implementation items
13361339
||((eref1.DefinitionRange= eref2.DefinitionRange|| eref1.SigRange= eref2.SigRange)&&
13371340
(eref1.LogicalName= eref2.LogicalName))
13381341

1342+
letvalRefDefnHash(_g:TcGlobals)(vref1:ValRef)=
1343+
hash vref1.DisplayName
1344+
13391345
letvalRefDefnEq g(vref1:ValRef)(vref2:ValRef)=
13401346
valRefEq g vref1 vref2
13411347
// Signature items considered equal to implementation items
@@ -1410,6 +1416,23 @@ let ItemsAreEffectivelyEqual g orig other =
14101416

14111417
|_->false
14121418

1419+
/// Given the Item 'orig' - returns function 'other : Item -> bool', that will yield true if other and orig represents the same item and false - otherwise
1420+
letItemsAreEffectivelyEqualHash(g:TcGlobals)orig=
1421+
match origwith
1422+
| EntityUse tcref-> tyconRefDefnHash g tcref
1423+
| Item.TypeVar(nm,_)-> hash nm
1424+
| ValUse vref-> valRefDefnHash g vref
1425+
| ActivePatternCaseUse(_,_, idx)-> hash idx
1426+
| MethodUse minfo-> minfo.ComputeHashCode()
1427+
| PropertyUse pinfo-> pinfo.ComputeHashCode()
1428+
| Item.ArgName(id,_,_)-> hash id.idText
1429+
| ILFieldUse ilfinfo-> ilfinfo.ComputeHashCode()
1430+
| UnionCaseUse ucase-> hash ucase.CaseName
1431+
| RecordFieldUse(name,_)-> hash name
1432+
| EventUse einfo-> einfo.ComputeHashCode()
1433+
| Item.ModuleOrNamespaces_->100013
1434+
|_->389329
1435+
14131436
[<System.Diagnostics.DebuggerDisplay("{DebugToString()}")>]
14141437
typeCapturedNameResolution(p:pos,i:Item,tpinst,io:ItemOccurence,de:DisplayEnv,nre:NameResolutionEnv,ad:AccessorDomain,m:range)=
14151438
memberthis.Pos= p

‎src/fsharp/NameResolution.fsi‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ type internal ItemOccurence =
251251
/// Check for equality, up to signature matching
252252
valItemsAreEffectivelyEqual:TcGlobals->Item->Item->bool
253253

254+
/// Hash compatible with ItemsAreEffectivelyEqual
255+
valItemsAreEffectivelyEqualHash:TcGlobals->Item->int
256+
254257
[<Class>]
255258
typeinternalCapturedNameResolution=
256259
/// line and column

‎src/fsharp/infos.fs‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,7 @@ type MethInfo =
12401240

12411241
/// Tests whether two method infos have the same underlying definition.
12421242
/// Used to merge operator overloads collected from left and right of an operator constraint.
1243+
/// Must be compatible with ItemsAreEffectivelyEqual relation.
12431244
static memberMethInfosUseIdenticalDefinitions x1 x2=
12441245
match x1,x2with
12451246
| ILMeth(_,x1,_), ILMeth(_,x2,_)->(x1.RawMetadata=== x2.RawMetadata)
@@ -1250,8 +1251,7 @@ type MethInfo =
12501251
#endif
12511252
|_->false
12521253

1253-
/// Calculates a hash code of method info. Note: this is a very imperfect implementation,
1254-
/// but it works decently for comparing methods in the language service...
1254+
/// Calculates a hash code of method info. Must be compatible with ItemsAreEffectivelyEqual relation.
12551255
memberx.ComputeHashCode()=
12561256
match xwith
12571257
| ILMeth(_,x1,_)-> hash x1.RawMetadata.Name
@@ -1689,6 +1689,8 @@ type ILFieldInfo =
16891689
| ProvidedField(amap,fi,m)-> Import.ImportProvidedType amap m(fi.PApply((fun fi-> fi.FieldType),m))
16901690
#endif
16911691

1692+
/// Tests whether two infos have the same underlying definition.
1693+
/// Must be compatible with ItemsAreEffectivelyEqual relation.
16921694
static memberILFieldInfosUseIdenticalDefinitions x1 x2=
16931695
match x1,x2with
16941696
| ILFieldInfo(_, x1), ILFieldInfo(_, x2)->(x1=== x2)
@@ -1698,6 +1700,10 @@ type ILFieldInfo =
16981700
#endif
16991701
/// Get an (uninstantiated) reference to the field as an Abstract IL ILFieldRef
17001702
memberx.ILFieldRef= rescopeILFieldRef x.ScopeRef(mkILFieldRef(x.ILTypeRef,x.FieldName,x.ILFieldType))
1703+
1704+
/// Calculates a hash code of field info. Must be compatible with ItemsAreEffectivelyEqual relation.
1705+
memberx.ComputeHashCode()= hash x.FieldName
1706+
17011707
overridex.ToString()= x.FieldName
17021708

17031709

@@ -2156,8 +2162,8 @@ type PropInfo =
21562162
| FSProp_-> failwith"no setter method"
21572163

21582164
/// Test whether two property infos have the same underlying definition.
2159-
///
21602165
/// Uses the same techniques as 'MethInfosUseIdenticalDefinitions'.
2166+
/// Must be compatible with ItemsAreEffectivelyEqual relation.
21612167
static memberPropInfosUseIdenticalDefinitions x1 x2=
21622168
letoptVrefEq g=function
21632169
| Some(v1), Some(v2)-> valRefEq g v1 v2
@@ -2172,7 +2178,7 @@ type PropInfo =
21722178
#endif
21732179
|_->false
21742180

2175-
/// Calculates a hash code of property info (similar as previous)
2181+
/// Calculates a hash code of property info. Must be compatible with ItemsAreEffectivelyEqual relation.
21762182
memberpi.ComputeHashCode()=
21772183
match piwith
21782184
| ILProp ilpinfo-> hash ilpinfo.RawMetadata.Name
@@ -2411,6 +2417,7 @@ type EventInfo =
24112417

24122418

24132419
/// Test whether two event infos have the same underlying definition.
2420+
/// Must be compatible with ItemsAreEffectivelyEqual relation.
24142421
static memberEventInfosUseIdenticalDefintions x1 x2=
24152422
match x1, x2with
24162423
| FSEvent(g, pi1, vrefa1, vrefb1), FSEvent(_, pi2, vrefa2, vrefb2)->
@@ -2422,6 +2429,7 @@ type EventInfo =
24222429
|_->false
24232430

24242431
/// Calculates a hash code of event info (similar as previous)
2432+
/// Must be compatible with ItemsAreEffectivelyEqual relation.
24252433
memberei.ComputeHashCode()=
24262434
match eiwith
24272435
| ILEvent ileinfo-> hash ileinfo.RawMetadata.Name

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp