Skip to content

Merge openfsharp 1 #255

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

Closed
wants to merge 3 commits into from
Closed

Conversation

enricosada
Copy link
Contributor

  • e01e100 merge fix test, now is crossplatform (see commit message)
  • 655df3d cleanup style for better diff and merge of some changes

@KevinRansom
Copy link
Contributor

Thanks for taking care of this Enrico, it is a valuable thing to do. The changes look good except for the additional try/with, I would like to understand why it was necessary in the open codebase before we take it.

Thanks

Kevin

@@ -104,7 +104,7 @@ type LanguagePrimitivesModule() =

// reference type
let resultRef = LanguagePrimitives.GenericComparison "ABC" "ABCDE"
Assert.AreEqual(resultRef,-68)
Assert.AreEqual(sign resultRef,-1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, not a blocker, but the nunit APIs are authored to expect Assert.AreEqual(expected, actual) , whereas these are called the other way Assert.AreEqual(actual, expected). The failure message will be a little bit confusing.

Doesn't really matter, they were already wrong. In the future for new tests we can try to remember this though.

Copy link
Contributor

Choose a reason for hiding this comment

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

let shouldEqual (expected:'a) (actual:'a) = Assert.AreEqual(expexted,actual)

Is used in many projects and also enforces the correct type on compile time

Copy link
Contributor

Choose a reason for hiding this comment

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

(the benefit is in using |>)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch! i'll fix it, easy
A long time ago I was filling a bug report to NUnit about this, only to find the parameters were reversed 😅

@latkin
Copy link
Contributor

latkin commented Feb 20, 2015

Agree with @KevinRansom. Looks great, but would want to know the origin of the exception handling.

@dsyme
Copy link
Contributor

dsyme commented Feb 20, 2015

IIRC it was because the simulated registry is not available on Mono in all circumstances and attempts to access it can fail.

So I don't really think the change should be brought into VF# as is. While changes like this (which myself and others put in) served a purpose a few years ago under a "get it running on Mono/Linux/Mac at all costs" agenda, they don't seem appropriate now, especially since we're very likely to have to add even another version of cross-platformness to this repo as we consider bringing the F# compiler up on cross-platform editions of .NET Core.

So I'd vote for keeping the try/catch out for now, but to continue to minimize the textual diffs to reduce them to a small known set of items, and perhaps documenting those.

@enricosada
Copy link
Contributor Author

yes, i was thinking that was ok because the current code do pretty much the same ( see https://github.com/Microsoft/visualfsharp/blob/fac44095a8dbc7303efa9866e0e2d9dddbdeae5d/src/utils/CompilerLocationUtils.fs#L79-L85 ).

i'll remove the try, this code need a refactoring with a good List.tryPick and a list of options 😄

next time i'll separate whitespace cleanup and change of behavior.

the ordinal string comparison is implementation specific, only checks
with less than 0, 0 and greater than 0 are meaningful
@enricosada
Copy link
Contributor Author

removed try
the commit 172c363 align to openfsharp before improve tests with d385f25 for easier merge

@@ -202,11 +202,14 @@ module internal FSharpEnvironment =
// Check for an app.config setting to redirect the default compiler location
// Like fsharp-compiler-location
try
// FSharp.Compiler support setting an appkey for compiler location. I've never seen this used.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's used in this repo

@latkin
Copy link
Contributor

latkin commented Feb 23, 2015

Looks ok to me.

latkin pushed a commit that referenced this pull request Feb 23, 2015
closes #255

commit d385f25
Author: enricosada <[email protected]>
Date:   Mon Feb 23 15:50:35 2015 +0100

    fix Assert.AreEqual arguments (first is expected value, second is actual value)

commit 172c363
Author: enricosada <[email protected]>
Date:   Fri Feb 20 18:35:54 2015 +0100

    merge openfsharp changes

commit aea137d
Author: enricosada <[email protected]>
Date:   Fri Feb 20 17:24:23 2015 +0100

    fix test

    the ordinal string comparison is implementation specific, only checks
    with less than 0, 0 and greater than 0 are meaningful
@latkin
Copy link
Contributor

latkin commented Feb 24, 2015

This is applied

@latkin latkin closed this Feb 24, 2015
@latkin latkin added the fixed label Feb 24, 2015
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.

5 participants