-
Notifications
You must be signed in to change notification settings - Fork 790
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
Fix #337: skip interfaces-that-lie-outside-the-set-of-referenced-assemblies #356
Conversation
There is a long-failing internal IDE test which is due to this issue. The code is basically the same as #337, though -- use types from open System
open System.Data
let dataset = new DataSet("test add reference")
Console.WriteLine(dataset.DataSetName)
Console.ReadKey(true) Besides that, I don't know of any existing tests for these cases. |
@dsyme what is the status of this PR: are we going to be able to add test cases to ensure that the issue? Thanks |
I think we can try using the "long-disabled IDE test" as the test for this fix. If that now passes then that should be sufficient. |
I added a command-line compilation of the DataSet example as a test. The command-line compiler generates the "you need System.Xml ofr IXmlSerializer" error message. |
Out of curiosity what will be the user experience in case like the one below: let conn: System.Data.SqlClient.SqlConnection = null
conn // type dot after conn Will intellisense list be displayed and if yes - will we print correctly names of types that reside in non-referenced assemblies - in this example method |
I'm pretty sure that will still ask for the reference to be added. |
But will it at leash show the intellisense list or it still will be a |
@vladima I synced this and tried it out on Friday, you still get the |
When the assembly reference set for the compilation is incomplete, some interfaces to types relevant to compilation may lie in assemblies outside the assembly reference set. This applies particularly to private ("internals visible to") interfaces found in .NET assemblies.
This causes very substantial usability bugs in practice as various parts of type inference and other checking "give up" when you get this condition. The C# compiler doesn't give up in the same way.
In most cases it is reasonable to simply skip interfaces-that-lie-outside-the-set-of-referenced-assemblies during F# compilation. Skipping unresolvable interfaces is pretty much harmless: any substantive analysis on the interface type (such as implementing it) will require the assembly holding the interface type.
There are some exceptions: if an interface I1 lies outside the referenceable set and you try to implement I2 inheriting from I1 then we'd better not skip I1. Indeed if you even try to find the methods on I2 then we'd better not skip I1. These are covered by "FoldPrimaryHierarchyOfType" in the code.
I've tested this manually on the example in #337, though not added testing as part of this fix. Constructing compilations with incomplete reference sets is a bit of a PITA - @latkin, do we have any of these compilations already?