diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolveAtLocationTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolveAtLocationTests.cs index c5f19646fb..a996956058 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolveAtLocationTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolveAtLocationTests.cs @@ -179,5 +179,28 @@ class Foo { } }")); } + + [Test] + public void TestBug6758() + { + var rr = ResolveAtLocation( + @"using System; + +namespace TestCrash +{ + class A + { + + } + + class B : T where T: $A + { + + } +} +"); + Assert.AreEqual("A", rr.Type.Name); + } + } } diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/BaseTypeCollector.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/BaseTypeCollector.cs index c0d7d8c83a..d527e55f48 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/BaseTypeCollector.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/BaseTypeCollector.cs @@ -55,6 +55,8 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation // (e.g. C implements I1 and I2, and both interfaces derive from Object) if (!this.Contains(type)) { foreach (IType baseType in type.DirectBaseTypes) { + if (type.Kind != TypeKind.TypeParameter && baseType.Kind == TypeKind.TypeParameter) + continue; if (SkipImplementedInterfaces && def != null && def.Kind != TypeKind.Interface && def.Kind != TypeKind.TypeParameter) { if (baseType.Kind == TypeKind.Interface) { // skip the interface