-
Notifications
You must be signed in to change notification settings - Fork 803
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
Compiler emits incorrect visibility modifier for internal constructors of abstract class #420
Comments
Problem is here, all ctors of abstract classes are naïvely set to Similar bug here, although this is even worse because this code sets them all to For the I think the better option is to simply stop altering the access modifiers entirely. Although the current conversion from @dsyme, do you know of a compelling reason to keep the accessibility conversion, or can we take it out? |
While testing this I learned that F# So my earlier statement
is not quite accurate. They would be translated to |
I was looking into minimizing the metadata the compiler emits and noticed that everything compiles to internal, is there a reason for this? If things could be private it seems like we could trivially omit a lot of metadata (it's significant for fsharp.compiler for example) |
@braden, @latkin, As background: we did make a decision in F# 1.0 (and confirmed it in 2.0) to not try to make use of "private" in IL but rather use "internal" as the minimum accessibility annotation we emitted. This was a deliberate choice, and was simplifying at the time (or seemed like it), especially when taking signature files into account. |
I am glad this is fixed; it makes the behavior of the F# compiler more predictable in multi-language solutions. Thanks. |
Compile the following code:
Note that we've defined an abstract class with two
internal
constructors and onepublic
one. When you disassemble the code you can see that the following code was generated by the compiler:Note how the constructors' visibilities were incorrectly changed to
protected
; that's only ok for thepublic
constructor, but definitely wrong for theinternal
ones. Theinternal
constructors should still beinternal
. I noticed that problem while deriving from such a class in a C# project where all of a sudden I had the possibility to choose between different base constructors to call, whereas only thepublic
one of the F# class should have been visible.Happens with VS2013 and VS2015 RC in both debug and release builds. When you remove the
[<AbstractClass>]
attribute, the compiler emits the correct visibilities.I realize that fixing this bug would be a breaking change, but then again, I consider this bug to be pretty serious.
The text was updated successfully, but these errors were encountered: