-
Notifications
You must be signed in to change notification settings - Fork 77
Generated Metadata for Abstract Classes is missing the abstract class attribute #1482
Comments
As I discussed with @dungpa, I would like to start working on this as part of my FSSF mentorship, as it doesn't require touching a lot of different parts of the code. |
On this particular issue, the explanation is that we haven't handled Abstract attribute yet. It would be great to modify an existing test or add a seperate test to https://github.com/fsprojects/VisualFSharpPowerTools/tree/03c613acd3aa67cb5e3a339d3dcf1c7c783f30c2/tests/data/gotodef/generic-cases for the changes. The test is executed at https://github.com/fsprojects/VisualFSharpPowerTools/blob/03c613acd3aa67cb5e3a339d3dcf1c7c783f30c2/tests/FSharp.Editing.Tests/GoToDefinitionTests.fs#L154 Hope this gives you enough details to get started. |
To verify my understanding here - is it correct that the same issue also exists for the |
I have been poking around a bit and trying a few things to expand my image of the situation, and I have found out a few things:
So, as I understand it, the issue isn't so much handling |
I've started implementing the fix and have run into the first real obstacle: The type being handled is passed to the I have tried to get around that with this: let assembly = System.Reflection.Assembly.ReflectionOnlyLoadFrom(typ.Assembly.FileName.Value);
let clrType = assembly.GetType(typ.FullName)
let abstractClassAttributeHasToBeAdded =
(not typ.IsFSharp)
&& typ.IsClass
&& clrType.IsAbstract
&& not (hasAttribute<AbstractClassAttribute> typ.Attributes) This is kludgy, and I'm not sure if it works in all cases, but it does work in a simple test case. It does not work, however, for types in Ideally, we would get the What I have found is a mysterious |
So, that My current understanding is that ideally, there should be an |
Sorry for the late reply (I have been travelling in the last few days). A few points:
|
I thought about reflection as well, and I'm thinking the same as you. Especially as according to @7sharp9, From what I'm seeing in the debugger, I think we'd need to add this to member __.IsAbstract =
isResolved () &&
match entity.TypeReprInfo with
| TILObjectRepr (_, _, ilTypeDef) -> ilTypeDef.IsAbstract
| _ -> false I'm currently trying to figure out how to build
I considered that as well, but that would be inexact for types that are declared abstract but have no (abstract) members. That may not make much sense, but it's possible to do. |
Now I think it's best to send a PR to FSharp.Compiler.Service. We still need to add a test to FCS to check whether this works.
Could you provide the errors you encountered? I was confused since |
Sorry, my mistake; I wasn't aware those are different things. I have made the change to As for the test to be added to FCS, where would that go, and what would it have to look like? |
Looking at the test results, it seems like there are internal breaking changes in AST in FCS. Once a new FCS NuGet package is published, we should upgrade and adapt accordingly in VFPT. For now, a test for FCS should be added to https://github.com/fsharp/FSharp.Compiler.Service/blob/7e18b8a1aa08e6d4df33bdafbd1f98743a4bb9d7/tests/service/ProjectAnalysisTests.fs |
But why don't breaking changes in FCS cause compiler errors in VFPT or the tests? |
Are you using the untyped ast
…On 11 Dec 2016 6:12 pm, "TeaDrivenDev" ***@***.***> wrote:
But why don't breaking changes in FCS cause compiler errors in VFPT or the
tests?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1482 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAj7yp76_5GMhZ8Le8bOxRh4DyR8aJAhks5rHD0TgaJpZM4Kmy-5>
.
|
@TeaDrivenDev I don't know how you did it. If you take the new FCS and compile the whole VFPT solution against it, there will be compiler errors due to breaking changes. |
@7sharp9 No. This happens without any changes to VFPT, just with a newly built @dungpa I referenced the new DLL directly in the projects. I now tried to build the FCS NuGet package to get a more meaningful result, but I'm running into errors; I have logged an issue there. |
When I generate the metadata for
HostWorkspaceServices
The resulting metadata is
It should show the abstract class attribute above the type, i.e.
If attributes are generally being left out of the metadata, perhaps the fix is to add them generally? If that would add far too many attributes maybe we could identify a subset of attributes that would be most useful to add.
The text was updated successfully, but these errors were encountered: