Browse Source

Fixed SD2-996: C# assigned generic variables not converted correctly to VB.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1726 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
afe45ea0dd
  1. 6
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
  2. 8
      src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs

6
src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs

@ -2321,10 +2321,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) public object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data)
{ {
outputFormatter.PrintToken(Tokens.Default); // assigning nothing to a generic type in VB compiles to a DefaultValueExpression
outputFormatter.PrintToken(Tokens.OpenParenthesis); outputFormatter.PrintToken(Tokens.Nothing);
nodeTracker.TrackedVisit(defaultValueExpression.TypeReference, data);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
return null; return null;
} }

8
src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs

@ -407,11 +407,17 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"\tProperty Name() As String\n" + "\tProperty Name() As String\n" +
"End Interface"); "End Interface");
} }
[Test] [Test]
public void ImportAliasPrimitiveType() public void ImportAliasPrimitiveType()
{ {
TestProgram("using T = System.Boolean;", "Imports T = System.Boolean\r\n"); TestProgram("using T = System.Boolean;", "Imports T = System.Boolean\r\n");
} }
[Test]
public void DefaultExpression()
{
TestStatement("T oldValue = default(T);", "Dim oldValue As T = Nothing");
}
} }
} }

Loading…
Cancel
Save