Repository: dotnet/roslyn
File: src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs (C#)

Code before:
            // if the compilation has any global aliases to these quick attributes, then we have to return
            // all the attributes on the decl.  For example, if there is a `global using X = Y;` and 
            // then we have to return any attributes on the type as they might say `[X]`.
            if (quickAttributes != null)
            {
                foreach (var decl in this.DeclaringCompilation.MergedRootDeclaration.Declarations)
                {
                    if (decl is RootSingleNamespaceDeclaration rootNamespaceDecl &&
                        (rootNamespaceDecl.GlobalAliasedQuickAttributes & quickAttributes) != 0)
                    {
                        return declaration.GetAttributeDeclarations(quickAttributes: null);
                    }
                }
            }

            return declaration.GetAttributeDeclarations(quickAttributes);
        }

        IAttributeTargetSymbol IAttributeTargetSymbol.AttributesOwner
        {
            get { return this; }
        }

        AttributeLocation IAttributeTargetSymbol.DefaultAttributeLocation
        {
            get { return IsExtension ? AttributeLocation.None : AttributeLocation.Type; }
        }

        AttributeLocation IAttributeTargetSymbol.AllowedAttributeLocations
        {
            get
            {
                switch (TypeKind)
                {
                    case TypeKind.Delegate:
                        return AttributeLocation.Type | AttributeLocation.Return;

                    case TypeKind.Enum:
                    case TypeKind.Interface:
                        return AttributeLocation.Type;

                    case TypeKind.Struct:
                    case TypeKind.Class:
                        return AttributeLocation.Type | (HasPrimaryConstructor ? AttributeLocation.Method : 0);

                    default:
                        return AttributeLocation.None;
                }
            }
        }


Review comment (suggestion):
>AttributeLocation.None [](http://example.com/codeflow?start=39&length=22)

We probably should add a dedicated location for an extension block #Closed

Code after:
            // if the compilation has any global aliases to these quick attributes, then we have to return
            // all the attributes on the decl.  For example, if there is a `global using X = Y;` and 
            // then we have to return any attributes on the type as they might say `[X]`.
            if (quickAttributes != null)
            {
                foreach (var decl in this.DeclaringCompilation.MergedRootDeclaration.Declarations)
                {
                    if (decl is RootSingleNamespaceDeclaration rootNamespaceDecl &&
                        (rootNamespaceDecl.GlobalAliasedQuickAttributes & quickAttributes) != 0)
                    {
                        return declaration.GetAttributeDeclarations(quickAttributes: null);
                    }
                }
            }

            return declaration.GetAttributeDeclarations(quickAttributes);
        }

        IAttributeTargetSymbol IAttributeTargetSymbol.AttributesOwner
        {
            get { return this; }
        }

        AttributeLocation IAttributeTargetSymbol.DefaultAttributeLocation
        {
            get { return IsExtension ? AttributeLocation.Extension : AttributeLocation.Type; }
        }

        AttributeLocation IAttributeTargetSymbol.AllowedAttributeLocations
        {
            get
            {
                switch (TypeKind)
                {
                    case TypeKind.Delegate:
                        return AttributeLocation.Type | AttributeLocation.Return;

                    case TypeKind.Enum:
                    case TypeKind.Interface:
                        return AttributeLocation.Type;

                    case TypeKind.Struct:
                    case TypeKind.Class:
                        return AttributeLocation.Type | (HasPrimaryConstructor ? AttributeLocation.Method : 0);

                    default:
                        return AttributeLocation.None;
                }
            }
        }