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

Commit8c44f0c

Browse files
authored
Fix error list unification (#3071)
* try use roslyn build error reporter* undo changes* undo changes* undo changes* try use roslyn build error reporter* more work on unifying diagnostics* minimize diff* bang bang* code review feedback* remove old test
1 parentc78be89 commit8c44f0c

File tree

26 files changed

+205
-1411
lines changed

26 files changed

+205
-1411
lines changed

‎src/fsharp/symbols/Symbols.fs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,13 +1343,13 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
13431343
member__.EnclosingEntity=
13441344
checkIsResolved()
13451345
match dwith
1346-
| E m-> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType)
1347-
| P m-> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType)
1348-
| M m| C m-> FSharpEntity(cenv, m.DeclaringEntityRef)
1346+
| E m-> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType)|> Some
1347+
| P m-> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType)|> Some
1348+
| M m| C m-> FSharpEntity(cenv, m.DeclaringEntityRef)|> Some
13491349
| V v->
13501350
match v.ActualParentwith
1351-
| ParentNone->invalidOp"the value or member doesn't have an enclosing entity"
1352-
| Parent p-> FSharpEntity(cenv, p)
1351+
| ParentNone->None
1352+
| Parent p-> FSharpEntity(cenv, p)|> Some
13531353

13541354
member__.IsCompilerGenerated=
13551355
if isUnresolved()thenfalseelse
@@ -1758,7 +1758,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
17581758
match ewith
17591759
| ILEvent(_,x)->
17601760
letilAccess= AccessibilityLogic.GetILAccessOfILEventInfo x
1761-
getApproxFSharpAccessibilityOfMember this.EnclosingEntity.Entity ilAccess
1761+
getApproxFSharpAccessibilityOfMember this.EnclosingEntity.Value.Entity ilAccess
17621762
|_-> taccessPublic
17631763

17641764
FSharpAccessibility(access)
@@ -1769,7 +1769,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
17691769
match pwith
17701770
| ILProp(_,x)->
17711771
letilAccess= AccessibilityLogic.GetILAccessOfILPropInfo x
1772-
getApproxFSharpAccessibilityOfMember this.EnclosingEntity.Entity ilAccess
1772+
getApproxFSharpAccessibilityOfMember this.EnclosingEntity.Value.Entity ilAccess
17731773
|_-> taccessPublic
17741774

17751775
FSharpAccessibility(access)

‎src/fsharp/symbols/Symbols.fsi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ and [<Class>] internal FSharpMemberOrFunctionOrValue =
720720
memberIsUnresolved:bool
721721

722722
/// Get the enclosing entity for the definition
723-
memberEnclosingEntity:FSharpEntity
723+
memberEnclosingEntity:FSharpEntity option
724724

725725
/// Get the declaration location of the member, function or value
726726
memberDeclarationLocation:range

‎src/fsharp/vs/ServiceAssemblyContent.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module Extensions =
8888
memberx.TryGetFullCompiledOperatorNameIdents():Idents option=
8989
// For operator ++ displayName is ( ++ ) compiledName is op_PlusPlus
9090
if isOperator x.DisplayName&& x.DisplayName<> x.CompiledNamethen
91-
Option.attempt(fun _->x.EnclosingEntity)
91+
x.EnclosingEntity
9292
|> Option.bind(fun e-> e.TryGetFullName())
9393
|> Option.map(fun enclosingEntityFullName->
9494
Array.append(enclosingEntityFullName.Split'.')[| x.CompiledName|])

‎src/fsharp/vs/ServiceInterfaceStubGenerator.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ module internal InterfaceStubGenerator =
448448

449449
letinternal(|TypeOfMember|_|)(m:FSharpMemberOrFunctionOrValue)=
450450
match m.FullTypeSafewith
451-
| Some(MemberFunctionType typ)when m.IsProperty&& m.EnclosingEntity.IsFSharp->
451+
| Some(MemberFunctionType typ)when m.IsProperty&& m.EnclosingEntity.IsSome&& m.EnclosingEntity.Value.IsFSharp->
452452
Some typ
453453
| Some typ-> Some typ
454454
| None-> None
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
// Learn more about F# at http://fsharp.org
22
// See the 'F# Tutorial' project for more help.
33

4+
5+
letprivatex:int= failwith""
6+
7+
let inlinef()= x
8+
49
letf1 argv=
5-
letx=1+1.0
6-
lety= argx// this gives
10+
//let x = 1 + 1.0
11+
lety= argx// this givesa multi-line error message
712
printfn"%A" argv
813
0// return an integer exit code
914

1015
[<EntryPoint>]
1116
letmain argv=
1217
//let x = 1 + 1.0
13-
lety= argx// this gives
18+
//let y = argx // this gives
1419
printfn"%A" argv
1520
0// return an integer exit code
1621

‎tests/service/EditorTests.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ let ``Symbols many tests`` () =
220220
fnVal.CurriedParameterGroups.[0].[1].Name.Value|> shouldEqual"y"
221221
fnVal.DeclarationLocation.StartLine|> shouldEqual3
222222
fnVal.DisplayName|> shouldEqual"foo"
223-
fnVal.EnclosingEntity.DisplayName|> shouldEqual"Test"
224-
fnVal.EnclosingEntity.DeclarationLocation.StartLine|> shouldEqual1
223+
fnVal.EnclosingEntity.Value.DisplayName|> shouldEqual"Test"
224+
fnVal.EnclosingEntity.Value.DeclarationLocation.StartLine|> shouldEqual1
225225
fnVal.GenericParameters.Count|> shouldEqual0
226226
fnVal.InlineAnnotation|> shouldEqual FSharpInlineAnnotation.OptionalInline
227227
fnVal.IsActivePattern|> shouldEqualfalse

‎tests/service/ExprTests.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module internal Utils =
3232
| BasicPatterns.Application(f,tyargs,args)-> quote low(printExpr10 f+ printTyargs tyargs+""+ printCurriedArgs args)
3333
| BasicPatterns.BaseValue(_)->"base"
3434
| BasicPatterns.Call(Some obj,v,tyargs1,tyargs2,argsL)-> printObjOpt(Some obj)+ v.CompiledName+ printTyargs tyargs2+ printTupledArgs argsL
35-
| BasicPatterns.Call(None,v,tyargs1,tyargs2,argsL)-> v.EnclosingEntity.CompiledName+ printTyargs tyargs1+"."+ v.CompiledName+ printTyargs tyargs2+""+ printTupledArgs argsL
35+
| BasicPatterns.Call(None,v,tyargs1,tyargs2,argsL)-> v.EnclosingEntity.Value.CompiledName+ printTyargs tyargs1+"."+ v.CompiledName+ printTyargs tyargs2+""+ printTupledArgs argsL
3636
| BasicPatterns.Coerce(ty1,e1)-> quote low(printExpr10 e1+" :>"+ printTy ty1)
3737
| BasicPatterns.DefaultValue(ty1)->"dflt"
3838
| BasicPatterns.FastIntegerForLoop_->"for-loop"
@@ -45,7 +45,7 @@ module internal Utils =
4545
| BasicPatterns.LetRec(vse,b)->"let rec ... in"+ printExpr0 b
4646
| BasicPatterns.NewArray(ty,es)->"[|"+(es|> Seq.map(printExpr0)|> String.concat";")+"|]"
4747
| BasicPatterns.NewDelegate(ty,es)->"new-delegate"
48-
| BasicPatterns.NewObject(v,tys,args)->"new"+ v.EnclosingEntity.CompiledName+ printTupledArgs args
48+
| BasicPatterns.NewObject(v,tys,args)->"new"+ v.EnclosingEntity.Value.CompiledName+ printTupledArgs args
4949
| BasicPatterns.NewRecord(v,args)->
5050
letfields= v.TypeDefinition.FSharpFields
5151
"{"+((fields, args)||> Seq.map2(fun f a-> f.Name+" ="+ printExpr0 a)|> String.concat";")+"}"

‎tests/service/ProjectAnalysisTests.fs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3267,9 +3267,9 @@ let ``Test Project23 property`` () =
32673267
extensionProps
32683268
|> Array.collect(fun f->
32693269
[|if f.HasGetterMethodthen
3270-
yield(f.EnclosingEntity.FullName, f.GetterMethod.CompiledName, f.GetterMethod.EnclosingEntity.FullName, attribsOfSymbol f)
3270+
yield(f.EnclosingEntity.Value.FullName, f.GetterMethod.CompiledName, f.GetterMethod.EnclosingEntity.Value.FullName, attribsOfSymbol f)
32713271
if f.HasSetterMethodthen
3272-
yield(f.EnclosingEntity.FullName, f.SetterMethod.CompiledName, f.SetterMethod.EnclosingEntity.FullName, attribsOfSymbol f)
3272+
yield(f.EnclosingEntity.Value.FullName, f.SetterMethod.CompiledName, f.SetterMethod.EnclosingEntity.Value.FullName, attribsOfSymbol f)
32733273
|])
32743274
|> Array.toList
32753275

@@ -3313,9 +3313,9 @@ let ``Test Project23 extension properties' getters/setters should refer to the c
33133313
match x.Symbolwith
33143314
|:? FSharpMemberOrFunctionOrValueas f->
33153315
if f.HasGetterMethodthen
3316-
yield(f.EnclosingEntity.FullName, f.GetterMethod.EnclosingEntity.FullName, attribsOfSymbol f)
3316+
yield(f.EnclosingEntity.Value.FullName, f.GetterMethod.EnclosingEntity.Value.FullName, attribsOfSymbol f)
33173317
if f.HasSetterMethodthen
3318-
yield(f.EnclosingEntity.FullName, f.SetterMethod.EnclosingEntity.FullName, attribsOfSymbol f)
3318+
yield(f.EnclosingEntity.Value.FullName, f.SetterMethod.EnclosingEntity.Value.FullName, attribsOfSymbol f)
33193319
|_->()
33203320
|])
33213321
|> Array.toList

‎vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,13 @@ module internal RoslynHelpers =
129129
letStartAsyncUnitAsTask cancellationToken(computation:Async<unit>)=
130130
StartAsyncAsTask cancellationToken computation:> Task
131131

132-
letSupportedDiagnostics()=
132+
letprivateTheSupportedDiagnostics=
133133
// We are constructing our own descriptors at run-time. Compiler service is already doing error formatting and localization.
134-
letdummyDescriptor= DiagnosticDescriptor("0", String.Empty, String.Empty, String.Empty, DiagnosticSeverity.Error,true,null,null)
135-
ImmutableArray.Create<DiagnosticDescriptor>(dummyDescriptor)
134+
letdummyDescriptors=
135+
[|for iin0..10000-> DiagnosticDescriptor(sprintf"FS%04d" i, String.Empty, String.Empty, String.Empty, DiagnosticSeverity.Error,true,null,null)|]
136+
ImmutableArray.Create<DiagnosticDescriptor>(dummyDescriptors)
137+
138+
letSupportedDiagnostics()= TheSupportedDiagnostics
136139

137140
letConvertError(error:FSharpErrorInfo,location:Location)=
138141
// Normalize the error message into the same format that we will receive it from the compiler.

‎vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ module private UnusedOpens =
100100
| SymbolUse.Field fwhennot(isQualified f.FullName)->
101101
Some([f.FullName], Some f.DeclaringEntity)
102102
| SymbolUse.MemberFunctionOrValue mfvwhennot(isQualified mfv.FullName)->
103-
Some([mfv.FullName], mfv.EnclosingEntitySafe)
103+
Some([mfv.FullName], mfv.EnclosingEntity)
104104
| SymbolUse.Operator opwhennot(isQualified op.FullName)->
105-
Some([op.FullName], op.EnclosingEntitySafe)
105+
Some([op.FullName], op.EnclosingEntity)
106106
| SymbolUse.ActivePattern apwhennot(isQualified ap.FullName)->
107-
Some([ap.FullName], ap.EnclosingEntitySafe)
107+
Some([ap.FullName], ap.EnclosingEntity)
108108
| SymbolUse.ActivePatternCase apcwhennot(isQualified apc.FullName)->
109109
Some([apc.FullName], apc.Group.EnclosingEntity)
110110
| SymbolUse.UnionCase ucwhennot(isQualified uc.FullName)->

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp