From 0dfef7b3453a1599806b8be04cf42f9b67c2e592 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 16 Sep 2016 13:12:34 +0200 Subject: [PATCH] [mcs] Delay array base type interfaces initialization. Fixes #44402 --- mcs/mcs/typespec.cs | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/mcs/mcs/typespec.cs b/mcs/mcs/typespec.cs index fb02370d..696bde5 100644 --- a/mcs/mcs/typespec.cs +++ b/mcs/mcs/typespec.cs @@ -109,7 +109,6 @@ public TypeSpec (MemberKind kind, TypeSpec declaringType, ITypeDefinition defini var imported = MemberDefinition as ImportedTypeDefinition; if (imported != null && Kind != MemberKind.MissingType) imported.DefineInterfaces (this); - } return ifaces; @@ -1603,6 +1602,12 @@ protected ElementTypeSpec (MemberKind kind, TypeSpec element, MetaType info) public TypeSpec Element { get; private set; } + public override IList Interfaces { + set { + throw new NotSupportedException (); + } + } + bool ITypeDefinition.IsComImport { get { return false; @@ -1777,13 +1782,19 @@ public bool Equals (TypeRankPair other) readonly int rank; readonly ModuleContainer module; - private ArrayContainer (ModuleContainer module, TypeSpec element, int rank) + ArrayContainer (ModuleContainer module, TypeSpec element, int rank) : base (MemberKind.ArrayType, element, null) { this.module = module; this.rank = rank; } + public override IList Interfaces { + get { + return BaseType.Interfaces; + } + } + public int Rank { get { return rank; @@ -1926,7 +1937,6 @@ public static ArrayContainer MakeType (ModuleContainer module, TypeSpec element, if (!module.ArrayTypesCache.TryGetValue (key, out ac)) { ac = new ArrayContainer (module, element, rank); ac.BaseType = module.Compiler.BuiltinTypes.Array; - ac.Interfaces = ac.BaseType.Interfaces; module.ArrayTypesCache.Add (key, ac); } @@ -1942,11 +1952,17 @@ public override List ResolveMissingDependencies (Membe class ReferenceContainer : ElementTypeSpec { - private ReferenceContainer (TypeSpec element) + ReferenceContainer (TypeSpec element) : base (MemberKind.Class, element, null) // TODO: Kind.Class is most likely wrong { } + public override IList Interfaces { + get { + return null; + } + } + public override MetaType GetMetaInfo () { if (info == null) { @@ -1977,6 +1993,12 @@ private PointerContainer (TypeSpec element) state &= ~StateFlags.CLSCompliant_Undetected; } + public override IList Interfaces { + get { + return null; + } + } + public override MetaType GetMetaInfo () { if (info == null) {