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)

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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 29691

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