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

Commit690fdc4

Browse files
auduchinokKevinRansom
authored andcommitted
Do not trim error ranges (dotnet#3892)
* Do not trim error ranges (fixesdotnet#3685)* Remove a mention of the Error List window in an error message
1 parent578db47 commit690fdc4

File tree

10 files changed

+34
-35
lines changed

10 files changed

+34
-35
lines changed

‎src/fsharp/FSComp.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ csCtorHasNoArgumentOrReturnProperty,"The object constructor '%s' has no argument
361361
csNoOverloadsFound,"No overloads match for method '%s'."
362362
csMethodIsOverloaded,"A unique overload for method '%s' could not be determined based on type information prior to this program point. A type annotation may be needed."
363363
csCandidates,"Candidates: %s"
364-
csSeeAvailableOverloads,"The available overloads are shown below (or in the Error List window)."
364+
csSeeAvailableOverloads,"The available overloads are shown below."
365365
512,parsDoCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on 'do' bindings, but '%s' was given."
366366
513,parsEofInHashIf,"End of file in #if section begun at or after here"
367367
514,parsEofInString,"End of file in string begun at or before here"

‎src/fsharp/symbols/SymbolHelpers.fs‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,15 @@ type FSharpErrorInfo(fileName, s: pos, e: pos, severity: FSharpErrorSeverity, me
6262
override__.ToString()= sprintf"%s (%d,%d)-(%d,%d)%s%s%s" fileName(int s.Line)(s.Column+1)(int e.Line)(e.Column+1) subcategory(if severity=FSharpErrorSeverity.Warningthen"warning"else"error") message
6363

6464
/// Decompose a warning or error into parts: position, severity, message, error number
65-
static memberCreateFromException(exn,isError,trim:bool,fallbackRange:range)=
65+
static memberCreateFromException(exn,isError,fallbackRange:range)=
6666
letm=match GetRangeOfDiagnostic exnwith Some m-> m| None-> fallbackRange
67-
lete=if trimthen m.Startelse m.End
6867
letmsg= bufs(fun buf-> OutputPhasedDiagnostic buf exnfalse)
6968
leterrorNum= GetDiagnosticNumber exn
70-
FSharpErrorInfo(m.FileName, m.Start,e,(if isErrorthen FSharpErrorSeverity.Errorelse FSharpErrorSeverity.Warning), msg, exn.Subcategory(), errorNum)
69+
FSharpErrorInfo(m.FileName, m.Start,m.End,(if isErrorthen FSharpErrorSeverity.Errorelse FSharpErrorSeverity.Warning), msg, exn.Subcategory(), errorNum)
7170

7271
/// Decompose a warning or error into parts: position, severity, message, error number
73-
static memberCreateFromExceptionAndAdjustEof(exn,isError,trim:bool,fallbackRange:range,(linesCount:int,lastLength:int))=
74-
letr= FSharpErrorInfo.CreateFromException(exn, isError,trim,fallbackRange)
72+
static memberCreateFromExceptionAndAdjustEof(exn,isError,fallbackRange:range,(linesCount:int,lastLength:int))=
73+
letr= FSharpErrorInfo.CreateFromException(exn, isError, fallbackRange)
7574

7675
// Adjust to make sure that errors reported at Eof are shown at the linesCount
7776
letstartline,schange= min(r.StartLineAlternate,false)(linesCount,true)
@@ -93,7 +92,7 @@ type ErrorScope() =
9392
PushErrorLoggerPhaseUntilUnwind(fun _oldLogger->
9493
{new ErrorLogger("ErrorScope")with
9594
member x.DiagnosticSink(exn, isError)=
96-
leterr= FSharpErrorInfo.CreateFromException(exn, isError,false,range.Zero)
95+
leterr= FSharpErrorInfo.CreateFromException(exn, isError, range.Zero)
9796
errors<- err:: errors
9897
if isError&& firstError.IsNonethen
9998
firstError<- Some err.Message
@@ -180,18 +179,18 @@ module ErrorHelpers =
180179
letReportError(options,allErrors,mainInputFileName,fileInfo,(exn,sev))=
181180
[letisError=(sev= FSharpErrorSeverity.Error)|| ReportWarningAsError options exn
182181
if(isError|| ReportWarning options exn)then
183-
letoneErrortrimexn=
182+
letoneError exn=
184183
[// We use the first line of the file as a fallbackRange for reporting unexpected errors.
185184
// Not ideal, but it's hard to see what else to do.
186185
letfallbackRange= rangeN mainInputFileName1
187-
letei= FSharpErrorInfo.CreateFromExceptionAndAdjustEof(exn, isError,trim,fallbackRange, fileInfo)
186+
letei= FSharpErrorInfo.CreateFromExceptionAndAdjustEof(exn, isError, fallbackRange, fileInfo)
188187
if allErrors||(ei.FileName= mainInputFileName)||(ei.FileName= TcGlobals.DummyFileNameForRangesWithoutASpecificLocation)then
189188
yield ei]
190189

191190
letmainError,relatedErrors= SplitRelatedDiagnostics exn
192-
yield! oneErrorfalsemainError
191+
yield! oneError mainError
193192
for ein relatedErrorsdo
194-
yield! oneErrortruee]
193+
yield! oneError e]
195194

196195
letCreateErrorInfos(options,allErrors,mainInputFileName,errors)=
197196
letfileInfo=(Int32.MaxValue, Int32.MaxValue)

‎src/fsharp/symbols/SymbolHelpers.fsi‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ type internal FSharpErrorInfo =
4646
memberMessage:string
4747
memberSubcategory:string
4848
memberErrorNumber:int
49-
static memberinternalCreateFromExceptionAndAdjustEof:PhasedDiagnostic* isError: bool*trim: bool*range* lastPosInFile:(int*int)-> FSharpErrorInfo
50-
static member internal CreateFromException: PhasedDiagnostic* isError: bool*trim: bool*range-> FSharpErrorInfo
49+
static memberinternalCreateFromExceptionAndAdjustEof:PhasedDiagnostic* isError: bool* range* lastPosInFile:(int*int)-> FSharpErrorInfo
50+
static member internal CreateFromException: PhasedDiagnostic* isError: bool* range-> FSharpErrorInfo
5151

5252
//----------------------------------------------------------------------------
5353
// Object model for quick info

‎src/fsharp/vs/service.fs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,10 +2104,10 @@ module CompileHelpers =
21042104
leterrors= ResizeArray<_>()
21052105

21062106
leterrorSink isError exn=
2107-
letmainError,relatedErrors= SplitRelatedDiagnostics exn
2108-
letoneErrortrime= errors.Add(FSharpErrorInfo.CreateFromException(e, isError, trim, Range.range0))
2109-
oneErrorfalsemainError
2110-
List.iter(oneErrortrue) relatedErrors
2107+
letmainError,relatedErrors= SplitRelatedDiagnostics exn
2108+
letoneError e= errors.Add(FSharpErrorInfo.CreateFromException(e, isError, Range.range0))
2109+
oneError mainError
2110+
List.iter oneError relatedErrors
21112111

21122112
leterrorLogger=
21132113
{new ErrorLogger("CompileAPI")with

‎tests/fsharp/typecheck/sigs/neg20.bsl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ neg20.fs(129,19,129,22): typecheck error FS0001: This expression was expected to
159159
but here has type
160160
'string'
161161

162-
neg20.fs(131,5,131,24): typecheck error FS0041: No overloads matchfor method 'OM3'. The available overloads are shown below (orin the Error List window).
162+
neg20.fs(131,5,131,24): typecheck error FS0041: No overloads matchfor method 'OM3'. The available overloads are shown below.
163163
neg20.fs(131,5,131,24): typecheck error FS0041: Possible overload: 'static member C.OM3 : x:'b* y:int-> int'. Type constraint mismatch. The type
164164
'obj'
165165
isnot compatible with type
@@ -199,7 +199,7 @@ neg20.fs(166,13,166,35): typecheck error FS0502: The member or object constructo
199199

200200
neg20.fs(167,13,167,31): typecheck error FS0502: The memberor object constructor 'M5' takes2 type argument(s) but is here given1. The required signature is 'member C.M5 : y:'a* z:'b-> int'.
201201

202-
neg20.fs(182,14,182,31): typecheck error FS0041: No overloads matchfor method 'M'. The available overloads are shown below (orin the Error List window).
202+
neg20.fs(182,14,182,31): typecheck error FS0041: No overloads matchfor method 'M'. The available overloads are shown below.
203203
neg20.fs(182,14,182,31): typecheck error FS0041: Possible overload: 'static member C2.M : fmt:string* [<System.ParamArray>] args:int []-> string'. Type constraint mismatch. The type
204204
'obj'
205205
isnot compatible with type
@@ -236,7 +236,7 @@ neg20.fs(184,34,184,39): typecheck error FS0001: This expression was expected to
236236
but here has type
237237
'obj'
238238

239-
neg20.fs(188,14,188,31): typecheck error FS0041: No overloads matchfor method 'M'. The available overloads are shown below (orin the Error List window).
239+
neg20.fs(188,14,188,31): typecheck error FS0041: No overloads matchfor method 'M'. The available overloads are shown below.
240240
neg20.fs(188,14,188,31): typecheck error FS0041: Possible overload: 'static member C3.M : fmt:string* [<System.ParamArray>] args:string []-> string'. Type constraint mismatch. The type
241241
'obj'
242242
isnot compatible with type

‎tests/fsharp/typecheck/sigs/neg61.bsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ neg61.fs(156,21,156,22): typecheck error FS3147: This 'let' definition may not b
8383

8484
neg61.fs(171,13,171,18):typecheckerrorFS3099: 'sumBy'isusedwithanincorrectnumberofarguments.Thisisacustomoperationinthisqueryorcomputationexpression.Expected1argument(s),butgiven0.
8585

86-
neg61.fs(174,22,174,23):typecheckerrorFS0041:Nooverloadsmatchformethod 'Source'.Theavailableoverloadsareshownbelow (orintheErrorListwindow).
86+
neg61.fs(174,22,174,23):typecheckerrorFS0041:Nooverloadsmatchformethod 'Source'.Theavailableoverloadsareshownbelow.
8787
neg61.fs(174,22,174,23):typecheckerrorFS0041:Possibleoverload: 'memberLinq.QueryBuilder.Source :source:System.Linq.IQueryable<'T> ->Linq.QuerySource<'T,'Q>'.Typeconstraintmismatch.Thetype
8888
'int'
8989
isnotcompatiblewithtype

‎tests/fsharpqa/Source/Conformance/Expressions/Type-relatedExpressions/E_RigidTypeAnnotation03.fsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ let _ = T.M( @"\" : char )
2323
exit1
2424
// Way more errors are reported, but this is a good enough list.
2525
//<Expects id="FS0001" span="(17,13-17,16)" status="error">This expression was expected to have type. 'sbyte' .but here has type. 'byte'</Expects>
26-
//<Expects span="(17,9-17,25)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
26+
//<Expects span="(17,9-17,25)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
2727
//<Expects id="FS0001" span="(18,13-18,19)" status="error">This expression was expected to have type. 'float32' .but here has type. 'float<'u>'</Expects>
28-
//<Expects span="(18,9-18,30)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
28+
//<Expects span="(18,9-18,30)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
2929
//<Expects id="FS0001" span="(19,13-19,20)" status="error">This expression was expected to have type. 'float32<'u>' .but here has type. 'decimal<s>'</Expects>
3030
//<Expects id="FS0001" span="(20,13-20,21)" status="error">Type mismatch\. Expecting a. 'decimal<N s \^ 2>' .but given a. 'decimal<Kg>'</Expects>
31-
//<Expects span="(20,9-20,39)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
31+
//<Expects span="(20,9-20,39)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
3232
//<Expects id="FS0001" span="(21,14-21,18)" status="error">This expression was expected to have type. 'char' .but here has type. 'string'</Expects>
33-
//<Expects span="(21,9-21,27)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
33+
//<Expects span="(21,9-21,27)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>

‎tests/fsharpqa/Source/Conformance/InferenceProcedures/TypeInference/E_TwoDifferentTypeVariablesGen00.fs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
//<Expects id="FS0001" span="(105,48-105,49)" status="error">This expression was expected to have type. 'int' .but here has type. ''b'</Expects>
88
//<Expects id="FS0001" span="(106,48-106,49)" status="error">A type parameter is missing a constraint 'when 'b :> C'</Expects>
99
//<Expects id="FS0193" span="(106,48-106,49)" status="error">Type constraint mismatch. The type.+''b'.+is not compatible with type</Expects>
10-
//<Expects span="(107,41-107,51)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
10+
//<Expects span="(107,41-107,51)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
1111

1212

1313

14-
//<Expects span="(108,41-108,51)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
14+
//<Expects span="(108,41-108,51)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
1515

1616

1717

@@ -20,12 +20,12 @@
2020
//<Expects id="FS0001" span="(110,52-110,53)" status="error">This expression was expected to have type. 'int' .but here has type. ''b'</Expects>
2121
//<Expects id="FS0001" span="(111,52-111,53)" status="error">A type parameter is missing a constraint 'when 'b :> C'</Expects>
2222
//<Expects id="FS0193" span="(111,52-111,53)" status="error">Type constraint mismatch. The type.+''b'.+is not compatible with type</Expects>
23-
//<Expects span="(112,41-112,55)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
23+
//<Expects span="(112,41-112,55)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
2424

2525

2626

2727

28-
//<Expects span="(113,41-113,55)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
28+
//<Expects span="(113,41-113,55)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
2929

3030

3131

@@ -34,12 +34,12 @@
3434
//<Expects id="FS0001" span="(115,51-115,52)" status="error">This expression was expected to have type. 'int' .but here has type. ''b'</Expects>
3535
//<Expects id="FS0001" span="(116,51-116,52)" status="error">A type parameter is missing a constraint 'when 'b :> C'</Expects>
3636
//<Expects id="FS0193" span="(116,51-116,52)" status="error">Type constraint mismatch. The type.+''b'.+is not compatible with type</Expects>
37-
//<Expects span="(117,41-117,54)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
37+
//<Expects span="(117,41-117,54)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
3838

3939

4040

4141

42-
//<Expects span="(118,41-118,54)" status="error">No overloads match for method 'M'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
42+
//<Expects span="(118,41-118,54)" status="error">No overloads match for method 'M'\. The available overloads are shown below\.</Expects>
4343

4444

4545

‎tests/fsharpqa/Source/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// want to verify we do not crash!
55
//<Expects status="warning" id="FS0064">This construct causes code to be less generic than indicated by the type annotations\. The type variable 'S has been constrained to be type 'int'</Expects>
66
//<Expects status="error" id="FS0670">This code is not sufficiently generic\. The type variable \^T when \^T : \(static member \( \+ \) : \^T \* \^T -> \^a\) could not be generalized because it would escape its scope</Expects>
7-
//<Expects status="error">No overloads match for method 'op_PlusPlusPlus'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
8-
//<Expects status="error">No overloads match for method 'op_PlusPlusPlus'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
9-
//<Expects status="error">No overloads match for method 'op_PlusPlusPlus'\. The available overloads are shown below \(or in the Error List window\)\.</Expects>
7+
//<Expects status="error">No overloads match for method 'op_PlusPlusPlus'\. The available overloads are shown below\.</Expects>
8+
//<Expects status="error">No overloads match for method 'op_PlusPlusPlus'\. The available overloads are shown below\.</Expects>
9+
//<Expects status="error">No overloads match for method 'op_PlusPlusPlus'\. The available overloads are shown below\.</Expects>
1010

1111
typepublicTestType<'T,'S>()=
1212

‎vsintegration/tests/unittests/Tests.LanguageService.ErrorList.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ let g (t : T) = t.Count()
184184
CheckErrorList content<|
185185
fun errors->
186186
Assert.AreEqual(3, List.length errors)
187-
assertContains errors"No overloads match for method 'X'. The available overloads are shown below (or in the Error List window)."
187+
assertContains errors"No overloads match for method 'X'. The available overloads are shown below."
188188
for expectedin expectedMessagesdo
189189
errors
190190
|> List.exists(fun e-> e.Message.StartsWith expected)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp