-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print ParamArray attribute instead of 'params' #192
Changes from all commits
3fde68d
a8972fe
adb4fa2
93bd099
e7f654f
301dfaa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ Array.iter (fun it -> System.Console.WriteLine(it)) array | |
|
||
array |> Array.iter (fun it -> System.Console.WriteLine(it)) | ||
|
||
//<Expects status="error" span="(7,23-7,51)" id="FS0041">A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point\. A type annotation may be needed\. Candidates: System\.Console\.WriteLine\(buffer: char \[\]\) : unit, System\.Console\.WriteLine\(format: string, params arg: obj \[\]\) : unit, System\.Console\.WriteLine\(value: bool\) : unit, System\.Console\.WriteLine\(value: char\) : unit, System\.Console\.WriteLine\(value: decimal\) : unit, System\.Console\.WriteLine\(value: float\) : unit, System\.Console\.WriteLine\(value: float32\) : unit, System\.Console\.WriteLine\(value: int\) : unit, System\.Console\.WriteLine\(value: int64\) : unit, System\.Console\.WriteLine\(value: obj\) : unit, System\.Console\.WriteLine\(value: string\) : unit, System\.Console\.WriteLine\(value: uint32\) : unit, System\.Console\.WriteLine\(value: uint64\) : unit$</Expects> | ||
//<Expects status="error" span="(9,23-9,51)" id="FS0041">A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point\. A type annotation may be needed\. Candidates: System\.Console\.WriteLine\(buffer: char \[\]\) : unit, System\.Console\.WriteLine\(format: string, params arg: obj \[\]\) : unit, System\.Console\.WriteLine\(value: bool\) : unit, System\.Console\.WriteLine\(value: char\) : unit, System\.Console\.WriteLine\(value: decimal\) : unit, System\.Console\.WriteLine\(value: float\) : unit, System\.Console\.WriteLine\(value: float32\) : unit, System\.Console\.WriteLine\(value: int\) : unit, System\.Console\.WriteLine\(value: int64\) : unit, System\.Console\.WriteLine\(value: obj\) : unit, System\.Console\.WriteLine\(value: string\) : unit, System\.Console\.WriteLine\(value: uint32\) : unit, System\.Console\.WriteLine\(value: uint64\) : unit$</Expects> | ||
//<Expects status="error" span="(7,23-7,51)" id="FS0041">A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point\. A type annotation may be needed\. Candidates: System\.Console\.WriteLine\(buffer: char \[\]\) : unit, System\.Console\.WriteLine\(format: string, [<System.ParamArray>] arg: obj \[\]\) : unit, System\.Console\.WriteLine\(value: bool\) : unit, System\.Console\.WriteLine\(value: char\) : unit, System\.Console\.WriteLine\(value: decimal\) : unit, System\.Console\.WriteLine\(value: float\) : unit, System\.Console\.WriteLine\(value: float32\) : unit, System\.Console\.WriteLine\(value: int\) : unit, System\.Console\.WriteLine\(value: int64\) : unit, System\.Console\.WriteLine\(value: obj\) : unit, System\.Console\.WriteLine\(value: string\) : unit, System\.Console\.WriteLine\(value: uint32\) : unit, System\.Console\.WriteLine\(value: uint64\) : unit$</Expects> | ||
//<Expects status="error" span="(9,23-9,51)" id="FS0041">A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point\. A type annotation may be needed\. Candidates: System\.Console\.WriteLine\(buffer: char \[\]\) : unit, System\.Console\.WriteLine\(format: string, [<System.ParamArray>] arg: obj \[\]\) : unit, System\.Console\.WriteLine\(value: bool\) : unit, System\.Console\.WriteLine\(value: char\) : unit, System\.Console\.WriteLine\(value: decimal\) : unit, System\.Console\.WriteLine\(value: float\) : unit, System\.Console\.WriteLine\(value: float32\) : unit, System\.Console\.WriteLine\(value: int\) : unit, System\.Console\.WriteLine\(value: int64\) : unit, System\.Console\.WriteLine\(value: obj\) : unit, System\.Console\.WriteLine\(value: string\) : unit, System\.Console\.WriteLine\(value: uint32\) : unit, System\.Console\.WriteLine\(value: uint64\) : unit$</Expects> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The expected strings in these kinds of tests are actually regex. In this case I took care of escaping There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the help. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// #Regression #NoMT #Printing | ||
// Regression test for https://github.com/Microsoft/visualfsharp/issues/109 | ||
|
||
// pretty printing signatures with params arguments | ||
//<Expects status=success>type Heterogeneous =</Expects> | ||
//<Expects status=success> class</Expects> | ||
//<Expects status=success> static member Echo : \[<System.ParamArray>\] args:obj \[\] -> obj \[\]</Expects> | ||
//<Expects status=success> end</Expects> | ||
|
||
type Heterogeneous = | ||
static member Echo([<System.ParamArray>] args: obj[]) = args | ||
|
||
#q;; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -466,7 +466,7 @@ type QuickInfoTests() = | |
let fileContents = """ | ||
let t = "a".Split('c')""" | ||
|
||
this.AssertQuickInfoContainsAtEndOfMarker (fileContents, "Spl", "params separator") | ||
this.AssertQuickInfoContainsAtEndOfMarker (fileContents, "Spl", "[<System.ParamArray>] separator") | ||
|
||
[<Test>] | ||
[<Category("TypeProvider")>] | ||
|
@@ -919,7 +919,7 @@ type QuickInfoTests() = | |
type A() = | ||
static member Foo([<System.ParamArrayAttribute>] a : int[]) = () | ||
let r = A.Foo(42)""" , | ||
"type A","params a:" ) | ||
"type A","[<ParamArray>] a:" ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the logic that determines whether There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On types, it's always printed in the short form https://github.com/Microsoft/visualfsharp/blob/742c13304ce98a0af84bfcd5bf20afdbe3a74cdb/src/fsharp/vs/ServiceDeclarations.fs#L809. The check is at https://github.com/dungpa/visualfsharp/blob/93bd0997069713d8f0fed10d3af794bf66928e1c/src/fsharp/NicePrint.fs#L87-L88. It seems ok because this is displayed by language service, not FSI response or signature generation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. In member intellisense, the module or namespace qualification is intelligently modified based on the current environment. But yes, for hover tip on types, it seems that existing established behavior is to naively shorten, no matter what. So I guess the inconsistency is not worth worrying about. |
||
|
||
[<Test>] | ||
member public this.``ParamsArrayArgument.OnMethod``() = | ||
|
@@ -928,7 +928,7 @@ type QuickInfoTests() = | |
type A() = | ||
static member Foo([<System.ParamArrayAttribute>] a : int[]) = () | ||
let r = A.Foo(42)""" , | ||
"A.Foo","params a:" ) | ||
"A.Foo","[<System.ParamArray>] a:" ) | ||
|
||
[<Test>] | ||
member public this.``Regression.AccessorMutator.Bug4903e``() = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used same bound name
path
, use another instead of replacepath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are subjective opinions on value shadowing. Since the code is moved from another place in the file, I will keep it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's fine. FWIW there is plenty of shadowing in the compiler in any case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dungpa I have not seen that code was moved only.
btw @dsyme about shadowing (asking, like for
<|
on code review ) is it usually ok? or we should avoit it for new code ( not moved code )