Bug 30419

Summary: CS0118 and CS0131 when using getter-only auto properties
Product: [Mono] Compilers Reporter: Kai Yang <yk000123>
Component: C#Assignee: Marek Safar <masafa>
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: 4.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: test code

Description Kai Yang 2015-05-25 22:19:49 UTC
Getter-only auto properties is a new language feature in C# 6.0. See http://blogs.msdn.com/b/csharpfaq/archive/2014/11/20/new-features-in-c-6.aspx.

The bug is, when using getter-only auto properties, which the name of property is the same with some class, CS0118 and CS0131 will occur.

The attached test file can be compiled in Visual Studio 2015 RC developer command prompt, but can not in Mono command prompt.

D:\>csc /target:library test.cs
Microsoft (R) Visual C# Compiler version
Copyright (C) Microsoft Corporation. All rights reserved.

d:\>mcs -target:library test.cs
test.cs(16,9): error CS0118: `Foo' is a `type' but a `variable' was expected
test.cs(16,9): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer
Compilation failed: 2 error(s), 0 warnings
Comment 1 Kai Yang 2015-05-25 22:20:28 UTC
Created attachment 11318 [details]
test code
Comment 2 Marek Safar 2015-05-26 05:47:08 UTC

*** This bug has been marked as a duplicate of bug 29691 ***