| Newsgroups |
gmane.comp.gnome.mono.patches |
| Message-ID |
<00000142573e36f2-05cfa0b8-484d-4fe1-b713-e9ae92752894-000000@email.amazonses.com> |
Branch: refs/heads/master
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/5659b9a9ea79...58d4cd39c7cb
Commit: c0567c50b824e2ff58726bec627c3c270c576d61
Author: Marek Safar <[email protected]> (marek-safar)
Date: 2013-11-14 15:26:58 GMT
URL: https://github.com/mono/mono/commit/c0567c50b824e2ff58726bec627c3c270c576d61
[ilasm] Fixes forwarded types namespace encoding
Changed paths:
M mcs/class/PEAPI/PEAPI.cs
M mcs/ilasm/codegen/ExternTable.cs
Modified: mcs/class/PEAPI/PEAPI.cs
===================================================================
@@ -753,9 +753,9 @@ public ModuleRef AddExternModule(string name)
return modRef;
}
- public ClassRef AddExternClass(string name, TypeAttr attrs, MetaDataElement declRef)
+ public ClassRef AddExternClass(string ns, string name, TypeAttr attrs, MetaDataElement declRef)
{
- return new ExternClassRef (attrs, null, name, declRef, metaData);
+ return new ExternClassRef (attrs, ns, name, declRef, metaData);
}
/// <summary>
Modified: mcs/ilasm/codegen/ExternTable.cs
===================================================================
@@ -251,13 +251,13 @@ public void SetHash (byte [] hash)
public class ExternClass
{
- string name;
+ string fullName;
TypeAttr ta;
string assemblyReference;
- public ExternClass (string name, TypeAttr ta, string assemblyReference)
+ public ExternClass (string fullName, TypeAttr ta, string assemblyReference)
{
- this.name = name;
+ this.fullName = fullName;
this.ta = ta;
this.assemblyReference = assemblyReference;
}
@@ -265,8 +265,18 @@ public ExternClass (string name, TypeAttr ta, string assemblyReference)
public void Resolve (CodeGen code_gen, ExternTable table)
{
var ar = table.GetAssemblyRef (assemblyReference);
- if (ar != null)
- code_gen.PEFile.AddExternClass (name, ta, ar.AssemblyRef);
+ if (ar != null) {
+ string ns = null;
+ string name = fullName;
+
+ int pos = name.LastIndexOf ('.');
+ if (pos > 0) {
+ ns = name.Substring (0, pos);
+ name = name.Substring (pos + 1);
+ }
+
+ code_gen.PEFile.AddExternClass (ns, name, ta, ar.AssemblyRef);
+ }
}
}
Commit: 58d4cd39c7cb110ffab20cfa1e42985c76a97d80
Author: Marek Safar <[email protected]> (marek-safar)
Date: 2013-11-14 15:26:58 GMT
URL: https://github.com/mono/mono/commit/58d4cd39c7cb110ffab20cfa1e42985c76a97d80
[mcs] Missing type forwarded types should not cause type collision. Fixes #16196
Changed paths:
M mcs/errors/CS1070-lib.il
M mcs/mcs/namespace.cs
M mcs/tests/ver-il-net_4_5.xml
Added paths:
A mcs/errors/cs1070-2.cs
A mcs/tests/test-875-2-lib.il
A mcs/tests/test-875-lib.cs
A mcs/tests/test-875.cs
Modified: mcs/errors/CS1070-lib.il
===================================================================
@@ -14,7 +14,7 @@
.module 'CS1070-lib.dll'
-.class extern forwarder E
+.class extern forwarder N.E
{
.assembly extern 'CS1070-lib-missing'
}
Added: mcs/errors/cs1070-2.cs
===================================================================
@@ -0,0 +1,12 @@
+// CS1070: The type `N.E' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `CS1070-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
+// Line: 9
+// Compiler options: -r:CS1070-lib.dll
+
+using N;
+
+public class D
+{
+ public void Foo (E e)
+ {
+ }
+}
\ No newline at end of file
Modified: mcs/mcs/namespace.cs
===================================================================
@@ -353,11 +353,20 @@ public TypeSpec LookupType (IMemberContext ctx, string name, int arity, LookupMo
}
if (best.MemberDefinition.IsImported && ts.MemberDefinition.IsImported) {
+ if (ts.Kind == MemberKind.MissingType)
+ continue;
+
+ if (best.Kind == MemberKind.MissingType) {
+ best = ts;
+ continue;
+ }
+
if (mode == LookupMode.Normal) {
ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (best);
ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (ts);
ctx.Module.Compiler.Report.Error (433, loc, "The imported type `{0}' is defined multiple times", ts.GetSignatureForError ());
}
+
break;
}
Added: mcs/tests/test-875-2-lib.il
===================================================================
@@ -0,0 +1,21 @@
+.assembly extern mscorlib
+{
+}
+
+.assembly extern 'test-875-lib-missing'
+{
+}
+
+.assembly 'test-875-2-lib'
+{
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+
+.module 'test-875-2-lib'
+
+.class extern forwarder N.Lib
+{
+ .assembly extern 'test-875-lib-missing'
+}
+
Added: mcs/tests/test-875-lib.cs
===================================================================
@@ -0,0 +1,8 @@
+// Compiler options: -t:library
+
+namespace N
+{
+ public class Lib
+ {
+ }
+}
Added: mcs/tests/test-875.cs
===================================================================
@@ -0,0 +1,11 @@
+// Compiler options: -r:test-875-lib.dll -r:test-875-2-lib.dll
+
+using N;
+
+public class Test: Lib
+{
+ public static void Main ()
+ {
+ new Test ();
+ }
+}
Modified: mcs/tests/ver-il-net_4_5.xml
===================================================================
@@ -48339,6 +48339,16 @@
</method>
</type>
</test>
+ <test name="test-875.cs">
+ <type name="Test">
+ <method name="Void Main()" attrs="150">
+ <size>8</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-88.cs">
<type name="X">
<method name="Void f(System.String)" attrs="145">
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches