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#: Explicitly qualified global names no translated #375

Open
mrmonday opened this issue Sep 6, 2019 · 1 comment

Comments

@mrmonday
Copy link
Contributor

commented Sep 6, 2019

For names which can be used globally, eg. Timer, Now, Len, etc, VB allows you to explicitly qualify them as eg. Microsoft.VisualBasic.Timer. The actual symbol is elsewhere, eg. Microsoft.VisualBasic.DateAndTime.Timer. This is not converted correctly.

Input code

Friend Module Module1
    Sub Main()
        Dim x = Microsoft.VisualBasic.Timer
    End Sub
End Module

Erroneous output

namespace ConsoleApp3
{
    internal static class Module1
    {
        public static void Main()
        {
            double x = Microsoft.VisualBasic.Timer;
        }
    }
}

Expected output

using Microsoft.VisualBasic;

namespace ConsoleApp3
{
    internal static class Module1
    {
        public static void Main()
        {
            double x = DateAndTime.Timer;
        }
    }
}

Details

Error:

error CS0234: The type or namespace name 'Timer' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)

Version: master @ 3ffc597

@GrahamTheCoder

This comment has been minimized.

Copy link
Member

commented Sep 10, 2019

The general case of this is supposed to be handled by TryGetTypePromotedModuleSymbol and QualifyNode. In solving this we should remember it's fine to overqualify things and let them be automatically simplified at the end.

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.