-
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
Conversation
//<Expects status=success> end</Expects> | ||
|
||
type Heterogeneous = | ||
static member Echo([<System.ParamArray>] args: obj[]) = args |
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.
no newline at eof
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.
Done
The code looks good. Have you checked in the language service unit tests continue to pass? |
There is no change in language service (yet). Tooltips still use the old style "params " i.e. https://github.com/Microsoft/visualfsharp/blob/468487fa52fce555928ccd1ba60f81b1cb56e93b/src/fsharp/vs/service.fs#L113. Do you think we should change display of tooltips as well? |
No, it's ok, don't change the tooltips. |
Could you point me to the part that means this change is not used when formatting types in the language service? (Just for me to understand) thanks |
Sorry, my mistake. The changes indeed have influence on language service. I corrected failing language service tests in the last commit. |
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
What is the logic that determines whether System.
is included?
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.
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.
What do you think?
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.
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.
This test needs to be updated: fsharpqa\source -> Conformance\InferenceProcedures\TypeInference (E_LeftToRightOverloadResolution01.fs) |
@@ -0,0 +1,11 @@ | |||
// #Regression #NoMT #Printing |
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.
- I would rename this to .fsx since it's being run via FSI
- As is, piping this into FSI actually results in FSI exit code of 1, which causes the test to fail.
- You need to add
#q
at the end to get a 0 exit code
- You need to add
@latkin Thanks, done. |
//<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 comment
The 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 [<System.ParamArray>]
to \[<System\.ParamArray>\]
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.
Thanks for the help.
Fixed #109.
Print
System.ParamArray
attribute to ensure that generated signature is valid F# code.A few questions:
attrib_ParamArrayAttribute
? The attribute doesn't seem to be present in symbol metadata (there is onlyisParamArray
flag in most cases).ParamArray
attribute for consistency?