diff --git a/mcs/errors/CS1070-lib.il b/mcs/errors/CS1070-lib.il index d4487ff8443af..620077130783f 100644 --- a/mcs/errors/CS1070-lib.il +++ b/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' } diff --git a/mcs/errors/cs1070-2.cs b/mcs/errors/cs1070-2.cs new file mode 100644 index 0000000000000..7fe8760619e0b --- /dev/null +++ b/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 diff --git a/mcs/mcs/namespace.cs b/mcs/mcs/namespace.cs index 6a6f17e8e9d7c..26db3a4d93d1a 100644 --- a/mcs/mcs/namespace.cs +++ b/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; } diff --git a/mcs/tests/test-875-2-lib.il b/mcs/tests/test-875-2-lib.il new file mode 100644 index 0000000000000..7c45836f7ce48 --- /dev/null +++ b/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' +} + diff --git a/mcs/tests/test-875-lib.cs b/mcs/tests/test-875-lib.cs new file mode 100644 index 0000000000000..21219514811b4 --- /dev/null +++ b/mcs/tests/test-875-lib.cs @@ -0,0 +1,8 @@ +// Compiler options: -t:library + +namespace N +{ + public class Lib + { + } +} diff --git a/mcs/tests/test-875.cs b/mcs/tests/test-875.cs new file mode 100644 index 0000000000000..b4ebd438d58b6 --- /dev/null +++ b/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 (); + } +} diff --git a/mcs/tests/ver-il-net_4_5.xml b/mcs/tests/ver-il-net_4_5.xml index 227ce12726bd0..d78064a006a24 100644 --- a/mcs/tests/ver-il-net_4_5.xml +++ b/mcs/tests/ver-il-net_4_5.xml @@ -48339,6 +48339,16 @@ + + + + 8 + + + 7 + + +