10 changed files with 562 additions and 0 deletions
@ -0,0 +1,101 @@
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// TypeParameterNotUsedIssue.cs
|
||||
//
|
||||
// Author:
|
||||
// Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2012 Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using ICSharpCode.NRefactory.CSharp.Resolver; |
||||
using ICSharpCode.NRefactory.Semantics; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.Refactoring |
||||
{ |
||||
[IssueDescription ("Unused type parameter", |
||||
Description = "Type parameter is never used.", |
||||
Category = IssueCategories.Redundancies, |
||||
Severity = Severity.Warning, |
||||
IssueMarker = IssueMarker.GrayOut)] |
||||
public class TypeParameterNotUsedIssue : ICodeIssueProvider |
||||
{ |
||||
static FindReferences refFinder = new FindReferences (); |
||||
|
||||
public IEnumerable<CodeIssue> GetIssues (BaseRefactoringContext context) |
||||
{ |
||||
var unit = context.RootNode as CompilationUnit; |
||||
if (unit == null) |
||||
return Enumerable.Empty<CodeIssue> (); |
||||
return new GatherVisitor (context, unit).GetIssues (); |
||||
} |
||||
|
||||
protected static bool FindUsage (BaseRefactoringContext context, CompilationUnit unit, |
||||
ITypeParameter typaParameter, AstNode declaration) |
||||
{ |
||||
var found = false; |
||||
refFinder.FindTypeParameterReferences (typaParameter, context.ParsedFile, unit, context.Compilation, |
||||
(node, resolveResult) => |
||||
{ |
||||
found = found || node != declaration; |
||||
}, context.CancellationToken); |
||||
return found; |
||||
} |
||||
|
||||
class GatherVisitor : GatherVisitorBase |
||||
{ |
||||
CompilationUnit unit; |
||||
|
||||
public GatherVisitor (BaseRefactoringContext ctx, CompilationUnit unit) |
||||
: base (ctx) |
||||
{ |
||||
this.unit = unit; |
||||
} |
||||
|
||||
public override void VisitTypeParameterDeclaration (TypeParameterDeclaration decl) |
||||
{ |
||||
var resolveResult = ctx.Resolve (decl) as TypeResolveResult; |
||||
if (resolveResult == null) |
||||
return; |
||||
var typeParameter = resolveResult.Type as ITypeParameter; |
||||
if (typeParameter == null) |
||||
return; |
||||
var methodDecl = decl.Parent as MethodDeclaration; |
||||
if (methodDecl == null) |
||||
return; |
||||
|
||||
if (FindUsage (ctx, unit, typeParameter, decl)) |
||||
return; |
||||
|
||||
AddIssue (decl.NameToken, ctx.TranslateString ("Remove unused type parameter"), |
||||
script => |
||||
{ |
||||
var newMethodDecl = (MethodDeclaration)methodDecl.Clone (); |
||||
newMethodDecl.TypeParameters.Remove ( |
||||
newMethodDecl.TypeParameters.FirstOrNullObject (t => t.Name == decl.Name)); |
||||
script.Replace (methodDecl, newMethodDecl); |
||||
}); |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// LocalVariableNotUsedIssue.cs
|
||||
//
|
||||
// Author:
|
||||
// Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2012 Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using ICSharpCode.NRefactory.Semantics; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.Refactoring |
||||
{ |
||||
[IssueDescription ("Unused local variable", |
||||
Description = "Local variable is never used.", |
||||
Category = IssueCategories.Redundancies, |
||||
Severity = Severity.Warning, |
||||
IssueMarker = IssueMarker.GrayOut)] |
||||
public class LocalVariableNotUsedIssue : VariableNotUsedIssue |
||||
{ |
||||
internal override GatherVisitorBase GetGatherVisitor (BaseRefactoringContext context, CompilationUnit unit) |
||||
{ |
||||
return new GatherVisitor (context, unit); |
||||
} |
||||
|
||||
class GatherVisitor : GatherVisitorBase |
||||
{ |
||||
CompilationUnit unit; |
||||
|
||||
public GatherVisitor (BaseRefactoringContext ctx, CompilationUnit unit) |
||||
: base (ctx) |
||||
{ |
||||
this.unit = unit; |
||||
} |
||||
|
||||
public override void VisitVariableInitializer (VariableInitializer variableInitializer) |
||||
{ |
||||
// check if variable is assigned
|
||||
if (!variableInitializer.Initializer.IsNull) |
||||
return; |
||||
var decl = variableInitializer.Parent as VariableDeclarationStatement; |
||||
if (decl == null) |
||||
return; |
||||
|
||||
var resolveResult = ctx.Resolve (variableInitializer) as LocalResolveResult; |
||||
if (resolveResult == null) |
||||
return; |
||||
|
||||
if (FindUsage (ctx, unit, resolveResult.Variable, variableInitializer)) |
||||
return; |
||||
|
||||
AddIssue (variableInitializer.NameToken, ctx.TranslateString ("Remove unused local variable"), |
||||
script => |
||||
{ |
||||
if (decl.Variables.Count == 1) { |
||||
script.Remove (decl); |
||||
} else { |
||||
var newDeclaration = (VariableDeclarationStatement)decl.Clone (); |
||||
newDeclaration.Variables.Remove ( |
||||
newDeclaration.Variables.FirstOrNullObject (v => v.Name == variableInitializer.Name)); |
||||
script.Replace (decl, newDeclaration); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ParameterNotUsedIssue.cs
|
||||
//
|
||||
// Author:
|
||||
// Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2012 Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using ICSharpCode.NRefactory.Semantics; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.Refactoring |
||||
{ |
||||
[IssueDescription ("Unused parameter", |
||||
Description = "Parameter is never used.", |
||||
Category = IssueCategories.Redundancies, |
||||
Severity = Severity.Warning, |
||||
IssueMarker = IssueMarker.GrayOut)] |
||||
public class ParameterNotUsedIssue : VariableNotUsedIssue |
||||
{ |
||||
|
||||
internal override GatherVisitorBase GetGatherVisitor (BaseRefactoringContext context, CompilationUnit unit) |
||||
{ |
||||
return new GatherVisitor (context, unit); |
||||
} |
||||
|
||||
class GatherVisitor : GatherVisitorBase |
||||
{ |
||||
CompilationUnit unit; |
||||
|
||||
public GatherVisitor (BaseRefactoringContext ctx, CompilationUnit unit) |
||||
: base (ctx) |
||||
{ |
||||
this.unit = unit; |
||||
} |
||||
|
||||
public override void VisitParameterDeclaration (ParameterDeclaration parameterDeclaration) |
||||
{ |
||||
var resolveResult = ctx.Resolve (parameterDeclaration) as LocalResolveResult; |
||||
if (resolveResult == null) |
||||
return; |
||||
if (FindUsage (ctx, unit, resolveResult.Variable, parameterDeclaration)) |
||||
return; |
||||
|
||||
AddIssue (parameterDeclaration.NameToken, ctx.TranslateString ("Parameter is never used")); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// VariableNotUsedIssue.cs
|
||||
//
|
||||
// Author:
|
||||
// Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2012 Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using ICSharpCode.NRefactory.CSharp.Resolver; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.Refactoring |
||||
{ |
||||
public abstract class VariableNotUsedIssue : ICodeIssueProvider |
||||
{ |
||||
static FindReferences refFinder = new FindReferences (); |
||||
|
||||
public IEnumerable<CodeIssue> GetIssues (BaseRefactoringContext context) |
||||
{ |
||||
var unit = context.RootNode as CompilationUnit; |
||||
if (unit == null) |
||||
return Enumerable.Empty<CodeIssue> (); |
||||
return GetGatherVisitor(context, unit).GetIssues (); |
||||
} |
||||
|
||||
protected static bool FindUsage (BaseRefactoringContext context, CompilationUnit unit, IVariable variable, |
||||
AstNode declaration) |
||||
{ |
||||
var found = false; |
||||
refFinder.FindLocalReferences (variable, context.ParsedFile, unit, context.Compilation, |
||||
(node, resolveResult) => |
||||
{ |
||||
found = found || node != declaration; |
||||
}, context.CancellationToken); |
||||
return found; |
||||
} |
||||
|
||||
internal abstract GatherVisitorBase GetGatherVisitor (BaseRefactoringContext context, CompilationUnit unit); |
||||
} |
||||
} |
||||
@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// LocalVariableNotUsedIssueTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2012 Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.CodeIssues |
||||
{ |
||||
[TestFixture] |
||||
public class LocalVariableNotUsedIssueTests : InspectionActionTestBase |
||||
{ |
||||
|
||||
[Test] |
||||
public void TestUnusedVariable () |
||||
{ |
||||
var input = @"
|
||||
class TestClass { |
||||
void TestMethod () |
||||
{ |
||||
int i; |
||||
} |
||||
}";
|
||||
var output = @"
|
||||
class TestClass { |
||||
void TestMethod () |
||||
{ |
||||
} |
||||
}";
|
||||
Test<LocalVariableNotUsedIssue> (input, 1, output); |
||||
var input2 = @"
|
||||
class TestClass { |
||||
void TestMethod () |
||||
{ |
||||
int i, j; |
||||
j = 1; |
||||
} |
||||
}";
|
||||
var output2 = @"
|
||||
class TestClass { |
||||
void TestMethod () |
||||
{ |
||||
int j; |
||||
j = 1; |
||||
} |
||||
}";
|
||||
Test<LocalVariableNotUsedIssue> (input2, 1, output2); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestUsedVariable () |
||||
{ |
||||
var input1 = @"
|
||||
class TestClass { |
||||
void TestMethod () |
||||
{ |
||||
int i = 0; |
||||
} |
||||
}";
|
||||
var input2 = @"
|
||||
class TestClass { |
||||
void TestMethod () |
||||
{ |
||||
int i; |
||||
i = 0; |
||||
} |
||||
}";
|
||||
Test<LocalVariableNotUsedIssue> (input1, 0); |
||||
Test<LocalVariableNotUsedIssue> (input2, 0); |
||||
} |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ParameterNotUsedIssueTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2012 Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.CodeIssues |
||||
{ |
||||
[TestFixture] |
||||
public class ParameterNotUsedIssueTests : InspectionActionTestBase |
||||
{ |
||||
[Test] |
||||
public void TestUnusedParameter () |
||||
{ |
||||
var input = @"
|
||||
class TestClass { |
||||
void TestMethod (int i) |
||||
{ |
||||
} |
||||
}";
|
||||
Test<ParameterNotUsedIssue> (input, 1); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestUsedParameter () |
||||
{ |
||||
var input = @"
|
||||
class TestClass { |
||||
void TestMethod (int i) |
||||
{ |
||||
i = 1; |
||||
} |
||||
}";
|
||||
Test<ParameterNotUsedIssue> (input, 0); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// TypeParameterNotUsedIssueTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2012 Mansheng Yang <lightyang0@gmail.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.CodeIssues |
||||
{ |
||||
[TestFixture] |
||||
public class TypeParameterNotUsedIssueTests : InspectionActionTestBase |
||||
{ |
||||
|
||||
[Test] |
||||
public void TestUnusedTypeParameter () |
||||
{ |
||||
var input = @"
|
||||
class TestClass { |
||||
void TestMethod<T> () |
||||
{ |
||||
} |
||||
}";
|
||||
var output = @"
|
||||
class TestClass { |
||||
void TestMethod () |
||||
{ |
||||
} |
||||
}";
|
||||
Test<TypeParameterNotUsedIssue> (input, 1, output); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestUsedTypeParameter () |
||||
{ |
||||
var input = @"
|
||||
class TestClass { |
||||
void TestMethod<T> (T i) |
||||
{ |
||||
} |
||||
}";
|
||||
var input2 = @"
|
||||
class TestClass { |
||||
T TestMethod<T> () |
||||
{ |
||||
} |
||||
}";
|
||||
Test<TypeParameterNotUsedIssue> (input, 0); |
||||
Test<TypeParameterNotUsedIssue> (input2, 0); |
||||
} |
||||
|
||||
} |
||||
} |
||||
Loading…
Reference in new issue