提交 d900315a 编写于 作者: M Marek Safar

[644507] Don't use nested type cache until declaring type is setup.

上级 b0ffa90c
......@@ -652,7 +652,25 @@ namespace Mono.CSharp
import_cache.Add (type, spec);
if (kind == MemberKind.Interface)
//
// Two stage setup as the base type can be inflated declaring type
//
if (declaringType == null)
ImportTypeBase (spec, type);
return spec;
}
public void ImportTypeBase (Type type)
{
TypeSpec spec = import_cache[type];
if (spec != null)
ImportTypeBase (spec, type);
}
void ImportTypeBase (TypeSpec spec, Type type)
{
if (spec.Kind == MemberKind.Interface)
spec.BaseType = TypeManager.object_type;
else if (type.BaseType != null)
spec.BaseType = CreateType (type.BaseType);
......@@ -663,8 +681,6 @@ namespace Mono.CSharp
spec.AddInterface (CreateType (iface));
}
}
return spec;
}
TypeParameterSpec CreateTypeParameter (Type type, TypeSpec declaringType)
......@@ -1353,7 +1369,7 @@ namespace Mono.CSharp
break;
case MemberTypes.NestedType:
// Already done
meta_import.ImportTypeBase ((Type) member);
continue;
default:
throw new NotImplementedException (member.ToString ());
......
// Compiler options: -t:library
using System;
public class A<T> where T : new ()
{
public T Value = new T ();
public class N1 : A<N2>
{
}
public class N2
{
public int Foo ()
{
return 0;
}
}
}
\ No newline at end of file
// Compiler options: -r:gtest-451-lib.dll
public class Test
{
public static int Main ()
{
var a = new A<int>.N1 ();
return a.Value.Foo ();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册