[mcs] Don't do constraints on fabricated generic methods. Fixes #47672
[mono.git] / mcs / mcs / reflection.cs
index d5b7d1753ecfdae0348ef9ecdedf1a8ad2ef3d31..24f25951d583c3ca258fe6b73196ea20036a8f9d 100644 (file)
@@ -48,6 +48,8 @@ namespace Mono.CSharp
                public ReflectionImporter (ModuleContainer module, BuiltinTypes builtin)
                        : base (module)
                {
+                       IgnoreCompilerGeneratedField = false;
+
                        Initialize (builtin);
                }
 
@@ -69,13 +71,6 @@ namespace Mono.CSharp
                        return MemberKind.Class;
                }
 
-               public override void GetCustomAttributeTypeName (CustomAttributeData cad, out string typeNamespace, out string typeName)
-               {
-                       var dt = cad.Constructor.DeclaringType;
-                       typeNamespace = dt.Namespace;
-                       typeName = dt.Name;
-               }
-
                protected override bool HasVolatileModifier (Type[] modifiers)
                {
                        foreach (var t in modifiers) {
@@ -90,7 +85,7 @@ namespace Mono.CSharp
                {
                        // It can be used more than once when importing same assembly
                        // into 2 or more global aliases
-                       var definition = GetAssemblyDefinition (assembly);
+               GetAssemblyDefinition (assembly);
 
                        //
                        // This part tries to simulate loading of top-level
@@ -105,12 +100,12 @@ namespace Mono.CSharp
                                all_types = e.Types;
                        }
 
-                       ImportTypes (all_types, targetNamespace, definition.HasExtensionMethod);
+                       ImportTypes (all_types, targetNamespace, true);
                }
 
                public ImportedModuleDefinition ImportModule (Module module, RootNamespace targetNamespace)
                {
-                       var module_definition = new ImportedModuleDefinition (module, this);
+                       var module_definition = new ImportedModuleDefinition (module);
                        module_definition.ReadAttributes ();
 
                        Type[] all_types;
@@ -173,8 +168,11 @@ namespace Mono.CSharp
        {
                [System.Runtime.InteropServices.FieldOffset (0)]
                int i;
+
+#pragma warning disable 414
                [System.Runtime.InteropServices.FieldOffset (0)]
                float f;
+#pragma warning restore 414
 
                public static int SingleToInt32Bits (float v)
                {
@@ -223,7 +221,7 @@ namespace Mono.CSharp
                //
                public bool Create (AppDomain domain, AssemblyBuilderAccess access)
                {
-#if STATIC
+#if STATIC || FULL_AOT_RUNTIME
                        throw new NotSupportedException ();
 #else
                        ResolveAssemblySecurityAttributes ();
@@ -422,7 +420,7 @@ namespace Mono.CSharp
 
                        default_references.Add ("System");
                        default_references.Add ("System.Xml");
-#if NET_2_1
+#if MOBILE
                        default_references.Add ("System.Net");
                        default_references.Add ("System.Windows");
                        default_references.Add ("System.Windows.Browser");
@@ -444,17 +442,12 @@ namespace Mono.CSharp
                        return Path.GetDirectoryName (typeof (object).Assembly.Location);
                }
 
-               public override bool HasObjectType (Assembly assembly)
+               public override Assembly HasObjectType (Assembly assembly)
                {
-                       return assembly.GetType (compiler.BuiltinTypes.Object.FullName) != null;
+                       return assembly.GetType (compiler.BuiltinTypes.Object.FullName) == null ? null : assembly;
                }
 
-               public override Assembly LoadAssemblyFile (string fileName)
-               {
-                       return LoadAssemblyFile (fileName, false);
-               }
-
-               Assembly LoadAssemblyFile (string assembly, bool soft)
+               public override Assembly LoadAssemblyFile (string assembly, bool isImplicitReference)
                {
                        Assembly a = null;
 
@@ -471,7 +464,7 @@ namespace Mono.CSharp
                                                a = Assembly.Load (ass);
                                        }
                                } catch (FileNotFoundException) {
-                                       bool err = !soft;
+                                       bool err = !isImplicitReference;
                                        foreach (string dir in paths) {
                                                string full_path = Path.Combine (dir, assembly);
                                                if (!assembly.EndsWith (".dll") && !assembly.EndsWith (".exe"))
@@ -497,11 +490,6 @@ namespace Mono.CSharp
                        return a;
                }
 
-               public override Assembly LoadAssemblyDefault (string fileName)
-               {
-                       return LoadAssemblyFile (fileName, true);
-               }
-
                Module LoadModuleFile (AssemblyDefinitionDynamic assembly, string module)
                {
                        string total_log = "";
@@ -561,4 +549,4 @@ namespace Mono.CSharp
                        }
                }
        }
-}
\ No newline at end of file
+}