Skip to content

Conversation

@smoothdeveloper
Copy link
Contributor

Fix the .bsl spurious whitespace in test/fsharp infrastructure fixing the bsl in separate commit(s).

related: #8208

@cartermp
Copy link
Contributor

This won't be fixable without also doing the baseline updates.

@smoothdeveloper
Copy link
Contributor Author

@cartermp I'm well aware of it, and also some experience updating the baselines (en masse like
discussed recently with @dsyme on some issue), I wrote this in the PR description:

fixing the bsl in separate commit(s).

To do so, I'm kind of blocked, or seriously slowed down by #8220 as I need to get all the up-to-date .err locally.

Realistically, once I get the all the .err locally, I intend this PR to be a large insignificant white space reduction in the repository 🙂

Is the completion of this PR something that we can get merged soon once it is green in CI?

@cartermp
Copy link
Contributor

This is more of a @KevinRansom call in terms of merging

@smoothdeveloper
Copy link
Contributor Author

So, here is the issue:

filtering out "" strings is incorrect

https://github.com/dotnet/fsharp/blob/db0ee662e201c3b305dbe8480df38b7c2e36a04d/src/scripts/scriptlib.fsx#L100

it will just strip out any empty string, while some are perfectly legit:

https://github.com/dotnet/fsharp/blob/09b45701a37e7bbbe3d68e5495a385ad0a53d211/tests/fsharp/typecheck/overloads/neg_System.Convert.ToString.OverloadList.bsl#L1-L18

this is how it looks when invoked from command line:


neg_System.Convert.ToString.OverloadList.fsx(1,1,1,31): typecheck error FS0041: No overloads match for method 'ToString'.

Known types of arguments: char * int

Available overloads:
 - System.Convert.ToString(value: System.DateTime, provider: System.IFormatProvider) : string
 - System.Convert.ToString(value: bool, provider: System.IFormatProvider) : string
 - System.Convert.ToString(value: byte, provider: System.IFormatProvider) : string
 - System.Convert.ToString(value: byte, toBase: int) : string
 - System.Convert.ToString(value: char, provider: System.IFormatProvider) : string
 - System.Convert.ToString(value: decimal, provider: System.IFormatProvider) : string
 - System.Convert.ToString(value: float, provider: System.IFormatProvider) : string
...

Also, appending Environment.NewLine at those places seem bogus, but removing it isn't solving the selective discrepancy.

https://github.com/dotnet/fsharp/blob/db0ee662e201c3b305dbe8480df38b7c2e36a04d/src/scripts/scriptlib.fsx#L128

https://github.com/dotnet/fsharp/blob/db0ee662e201c3b305dbe8480df38b7c2e36a04d/src/scripts/scriptlib.fsx#L136

I'm not sure how to faithfully retrieve what comes out of the console from System.Diagnostics.Process but the current approach doesn't work, it is only an issue on output that contains valid blank lines (like in #6596).

I'll look some more, I think it is really worth it to get this fixed with what I was touching in #8208 but any suggestion is welcome.

@cartermp
Copy link
Contributor

Whitespace is hard :)

…onmentNewLines`

`writeViaBufferWithEnvironmentNewLines` is causing borked output when error message ends with "\n".

This is probably dating from far back in the history of the codebase, and it doesn't show in windows console, probably because the console itself has some silly work around line termination...
@smoothdeveloper smoothdeveloper force-pushed the spurious-whitespace-in-bsl-files branch from b0e3706 to ef60ad4 Compare January 15, 2020 23:20
@smoothdeveloper
Copy link
Contributor Author

@cartermp, I've found the culprit in the compiler itself rather than the testing infrastructure.

The fact it always shown correctly on windows command prompt is something I don't want to dig into though.

Now we have coherent things in the baseline files that matches exactly the console output that the user sees.

The CI is green, PR ready for review, and hopefully merge in master.

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome find.

@cartermp cartermp merged commit 68ea1f9 into dotnet:master Jan 16, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
* Rename `buff` to `writeViaBuffer` and remove `writeViaBufferWithEnvironmentNewLines`

`writeViaBufferWithEnvironmentNewLines` is causing borked output when error message ends with "\n".

This is probably dating from far back in the history of the codebase, and it doesn't show in windows console, probably because the console itself has some silly work around line termination...

* a bunch of .bsl updated with accurate output

* fix one bsl

* non change for CI

* non change for CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants