Bug 28648

Summary: Invalid CS0118 error when a custom namespace called "var" is declared and var used in code
Product: [Mono] Compilers Reporter: Alexander Köplinger <alex.koeplinger>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Tags: Is this bug a regression?: ---
Last known good build:

Description Alexander Köplinger 2015-04-01 14:24:04 UTC
The following code generates an error when compiled with mcs:

>namespace Test
>{
>    public class A
>    {
>        public static int Main()
>        {
>            var x = 1;
>            dynamic y = 1;
>            return 0;
>        }
>    }
>
>    namespace var
>    {
>    }
>
>    namespace dynamic
>    {
>    }
> }


> $ mcs test.cs 
> test.cs(7,13): error CS0118: `Test.var' is a `namespace' but a `type' was expected
> Compilation failed: 1 error(s), 0 warnings

Note: this was extracted from the dynamics testsuite over at dotnet/corefx
Comment 1 Marek Safar 2015-04-02 11:35:28 UTC
Fixed in master