Skip to content
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

Do not change abstract class ctors to protected #423

Closed
wants to merge 3 commits into from

Conversation

latkin
Copy link
Contributor

@latkin latkin commented May 7, 2015

Fix for #420

@latkin
Copy link
Contributor Author

latkin commented May 7, 2015

Ah crud, didn't think to run core tests. Will update that...

@dsyme
Copy link
Contributor

dsyme commented May 7, 2015

Hmmm... @latkin - I wonder why we emitted "protected" on constructors for abstract classes though - there must have been some reason why we do that. Does C# really never do it?

thanks
don

@latkin
Copy link
Contributor Author

latkin commented May 7, 2015

I chatted w/ @VSadov yesterday and he says C# never alters the accessibility in this case. Quick peek at compiled assembly confirms.

I don't know if F# compiler makes some assumptions elsewhere that rely on conversion to protected. Compiler tests ran ok with the change.

    public abstract class A
    {
        internal A(string x) { }
        public A(int x) { }
        private A(float x) { }
        protected A(double x) { }
        internal protected A(byte x) { }
    }
.class public auto ansi abstract beforefieldinit CSConsoleApp1.A
    extends [mscorlib]System.Object
{
    // Methods
    .method assembly hidebysig specialname rtspecialname 
        instance void .ctor (
            string x
        ) cil managed 
    { ... }

    .method public hidebysig specialname rtspecialname 
        instance void .ctor (
            int32 x
        ) cil managed 
    { ... }

    .method private hidebysig specialname rtspecialname 
        instance void .ctor (
            float32 x
        ) cil managed 
    { ... }

    .method family hidebysig specialname rtspecialname 
        instance void .ctor (
            float64 x
        ) cil managed 
    { ... }

    .method famorassem hidebysig specialname rtspecialname 
        instance void .ctor (
            uint8 x
        ) cil managed 
    { ... }

} // end of class CSConsoleApp1.A

@latkin
Copy link
Contributor Author

latkin commented May 8, 2015

Updated core surface area tests, things are green now

@dsyme
Copy link
Contributor

dsyme commented May 9, 2015

LGTM 👍

@latkin latkin closed this in a64ecb2 May 19, 2015
@latkin latkin added the fixed label May 19, 2015
@latkin latkin mentioned this pull request Jun 17, 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.

3 participants