Skip to content

Bug: Class/Struct in a namespace is converted to member in first class scope it is used #32

@CraigHutchinson

Description

@CraigHutchinson

Reproducer

    namespace ns {
        struct Foo { unsigned short _h; };
    } 
    class Bar { ns::Foo member_; };
    class Baz { ns::Foo member_; };

Issue

The struct Foo is defined as libnative.Bar.Foo instead of libnative.Foo as expected

using System;

namespace LibNative
{
    using System.Runtime.InteropServices;
    
    public static partial class libnative
    {
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
        public partial struct Bar
        {
            public libnative.Bar.Foo member_;
            
            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
            public partial struct Foo
            {
                public ushort _h;
            }
        }
        
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
        public partial struct Baz
        {
            public libnative.Bar.Foo member_;
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions