Bug 30419 - CS0118 and CS0131 when using getter-only auto properties
Summary: CS0118 and CS0131 when using getter-only auto properties
Status: RESOLVED DUPLICATE of bug 29691
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-05-25 22:19 UTC by Kai Yang
Modified: 2015-05-26 05:47 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
test code (192 bytes, text/plain)
2015-05-25 22:20 UTC, Kai Yang
Details

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 1.0.0.50411
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 ***

Note You need to log in before you can comment on or make changes to this bug.