-
Notifications
You must be signed in to change notification settings - Fork 793
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
Elm-like compiler errors for name resolution #1102
Conversation
10d6ba6
to
fdcd823
Compare
nenv.eFieldLabels | ||
|> Seq.filter (fun kv -> | ||
kv.Value | ||
|> List.map (fun r -> r.TyconRef.ToString()) // TODO: Ask Don how to compare type names here |
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.
/cc @dsyme I think we want to compare full qualified names of the types. How can I do that?!
@@ -0,0 +1,13 @@ | |||
// #ErrorMessages #NameResolution | |||
//<Expects status="error" span="(11,31-11,34)" id="FS1129">The record type 'F' does not contain a label 'Wall'\.</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.
@KevinRansom @enricosada @dsyme I want to test for the multi line error message here. How can I do that?
8f66301
to
a83883b
Compare
@@ -0,0 +1,13 @@ | |||
// #ErrorMessages #NameResolution | |||
//<Expects status="error" span="(11,29)" id="FS0039">The record label 'Wall' is not defined\.</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.
This is awesome. :D |
5792c92
to
155be99
Compare
I think something seriously bad happened to nuget. This doesn't even start to build anymore because restore failed. See http://dotnet-ci.cloudapp.net/job/Microsoft_visualfsharp/job/master/job/debug_windows_nt_prtest/261/console |
@forki I may be missing it in the build log but where does it go wrong? If it's that first restore, it seems it's somehow not hitting the correct feed(s) |
04:16:05 The path is not of a legal form. This all worked yesterday. I only pushed a change that is related to unittests that come much later. |
Possible change on the build machine? (the error is kinda vague :)) |
The same happens on appveyor. Both (unrelated) build servers report this issue |
Definitely no server-side changes on NuGet since yesterday. Client side no idea. @KevinRansom |
In 98a329a I commited older version of dotnet cli. This seems to work. /cc @KevinRansom @enricosada is there a way to make it download a pinned version of dotnet cli? and who do we have to ask to fix it!? |
Implemented first round of feedback. |
1b02724
to
9051054
Compare
dd0bb0c
to
32c44ed
Compare
I think this is ready and merging this would help me to work on similar issues. |
WTF!? appveyor reporting something unrelated:
|
is there anything I can do to get this in? I would need that infrastructure for other similar cases |
that test was flaky. it's green now |
I'm OK with this change (up to the caveats I mentioned up above about also eventually making the information available through the compiler service) |
Something I've just noticed about this - if you create a record via |
Also the "suggest types" one (e.g. Lst instead of List) doesn't work on the RHS of the equals e.g. |
please create separate issues with repro and set me cc |
Introduction
This PR is a starting point for making the F# compiler emit error messages that are more user friendly. Newcomers to Elm report that the excellent compiler errors [read http://elm-lang.org/blog/compiler-errors-for-humans] help so much to get started quickly. We should do our best to improve our error messages as well.
I think this can be done as community effort. This PR will start and bring some infrastructure in place. After that we can create a list with possible optimizatons and divide the work. This approach worked very well when we "regularized" the collections.
Sample: Propose compatible record labels when compiler can't find label and doesn't know record type
Let's consider a small sample to see what we can improve:
So the compiler can't find the record label
Wall
and complains about that. After applying the PR we will get the following:As you can see the compiler proposes record labels that might work here. In this case it looks for all records that are compatible with what you already have (Size, Height labels). It then computes the edit distance (Damerau Levenshtein) to the labels of these records and proposes the top 5.
Sample: Propose compatible record labels when compiler can't find label in known record type
Here we only predict labels that are in same record type, ordered by edit distance.
Sample: Propose types inside of module / namespace
Changes in this Pull Request