Skip to content

Commit bc5fdcd

Browse files
committed
Fix CS0136 compile error: remove duplicate 'defaultValue' declaration in else branch
The outer 'if (node.Default != null)' block already declares 'defaultValue' on line 449. The branch's new else-branch code was incorrectly redeclaring it, causing CS0136: A local variable named 'defaultValue' is already defined in this scope. Fix: remove the redundant declaration in the else branch and reuse the existing one. https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
1 parent cb36abe commit bc5fdcd

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

CodeConverter/CSharp/ExpressionNodeVisitor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ public override async Task<CSharpSyntaxNode> VisitParameter(VBSyntax.ParameterSy
476476
attributes.Insert(0,
477477
CS.SyntaxFactory.AttributeList(CS.SyntaxFactory.SeparatedList(optionalAttributes)));
478478
} else {
479-
var defaultValue = node.Default.Value.SkipIntoParens();
480479
var paramSymbol = _semanticModel.GetDeclaredSymbol(node) as IParameterSymbol;
481480
if (paramSymbol?.Type?.SpecialType == SpecialType.System_String &&
482481
_semanticModel.GetTypeInfo(defaultValue).Type?.SpecialType == SpecialType.System_Char) {

0 commit comments

Comments
 (0)