consulo / consulo-csharp

Languages: C#
Apache License 2.0
50 stars 6 forks source link

Problems with resolving [extension] method with integer `this` argument using int literal #523

Closed NIA closed 6 years ago

NIA commented 6 years ago

Example:

public class TempTest {
    void foo() {

        // works well
        Console.WriteLine(10L.minutes());

        // error in Consulo, but no error in VisualStudio and Mono Compiler
        Console.WriteLine(10.hours());

        // also works well
        int ten = 10;
        Console.WriteLine(ten.hours());
    }
}
public static class TestEx {
    public static long minutes(this long hours) {
        return hours * 60L;
    }
    public static long hours(this int hours) {
        return hours * 3600L;
    }
}

image

As you can see, Consulo fails to parse the expression when literal integer is used, but has no problem with long literal or int variable. Same happens not only with extension method, but also for .ToString().

Also note the syntax highlighting (magnified): the dot here is highlighted blue like number literal (magnified): image Probably Consulo somehow thinks that this . is a numeric suffix, like L for long and f for float?

VISTALL commented 6 years ago

Hello. Hm. Strange . I will check after fixing bugs in platform (nightly channel)

Thanks

VISTALL commented 6 years ago

legacy from java lexer. Fixed in nigthtly