Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VB -> C#: Error with multiple variable declarations with implicit type #373

Open
mrmonday opened this issue Sep 6, 2019 · 0 comments

Comments

@mrmonday
Copy link
Contributor

commented Sep 6, 2019

Input code

Friend Module Module1
    Sub Main()
        Dim x, y As Date
        Console.WriteLine(x)
        Console.WriteLine(y)
    End Sub
End Module

Erroneous output

using System;

namespace ConsoleApp3
{
    internal static class Module1
    {
        public static void Main()
        {
            var x = default(DateTime), y = default(DateTime);
            Console.WriteLine(x);
            Console.WriteLine(y);
        }
    }
}

Expected output

using System;

namespace ConsoleApp3
{
    internal static class Module1
    {
        public static void Main()
        {
            DateTime x = default(DateTime), y = default(DateTime);
            Console.WriteLine(x);
            Console.WriteLine(y);
        }
    }
}

Alternatively, this could be split into two declarations.

Details

Error:

error CS0819: Implicitly-typed variables cannot have multiple declarators

Version used: master @ 3ffc597

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.