Bug 319454 (MONO76620) - [ANONYMOUS METHODS] mcs does not properly detect variable name conflicts when using anonymous methods
Summary: [ANONYMOUS METHODS] mcs does not properly detect variable name conflicts when...
Status: RESOLVED FIXED
Alias: MONO76620
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-02 23:27 UTC by Eric Butler
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:37:00 UTC


---- Reported by eric@extremeboredom.net 2005-11-02 16:27:16 MST ----

The following code should not compile:

public class AnonTest
{
	public static void Main ()
	{
		new AnonTest ();	
	}

	delegate void MooEventHandler (string moo);
	event MooEventHandler bleh;
	
	public AnonTest ()
	{
		AddEvent ("moo");
	}

	void AddEvent (string moo)
	{
		bleh += delegate (string moo) { 
			System.Console.WriteLine (moo);
		};
	}
}

On .NET 2.0 final, the following error is generated:

test.cs(20,21): error CS0136: A local variable named 'moo' cannot be
declared in
        this scope because it would give a different meaning to 'moo', which is
        already used in a 'parent or current' scope to denote something else



---- Additional Comments From eric@extremeboredom.net 2005-11-02 16:29:43 MST ----

Sorry, this is with 1.1.9.2 and confirmed still a problem with SVN as
of this morning.



---- Additional Comments From rharinath@novell.com 2006-09-28 10:29:34 MST ----

may be relevant to the new anonymous-methods work



---- Additional Comments From martin@ximian.com 2006-10-04 18:20:48 MST ----

Fixed in SVN.