Bug 321876 (MONO79165) - [PARSER] CS1041 is not reported for invalid use of keyword
Summary: [PARSER] CS1041 is not reported for invalid use of keyword
Status: RESOLVED FIXED
Alias: MONO79165
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Minor
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-25 20:43 UTC by Gert Driesen
Modified: 2008-10-10 10:56 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 20:07:21 UTC


---- Reported by gert.driesen@pandora.be 2006-08-25 13:43:26 MST ----

mcs and gmcs do not report CS1041 if a keyword is used for an identifier.

To reproduce, compile the following code snippet:

public class Test {
	static void Main () {
		string ref = "abc";
		Console.WriteLine (ref);
	}
}

Expected result:

test.cs(3,10): error CS1041: Identifier expected, 'ref' is a keyword
test.cs(3,10): error CS1525: Invalid expression term 'ref'
test.cs(4,25): error CS1525: Invalid expression term ')'
test.cs(4,26): error CS1026: ) expected

Actual result:

test.cs(3,10): error CS1002: Expecting ';'
test.cs(4,25): error CS1002: Expecting ';'



---- Additional Comments From marek.safar@seznam.cz 2007-02-18 09:05:22 MST ----

I think the issue is not possible to fix with current parser.



---- Additional Comments From rharinath@novell.com 2007-02-19 05:04:17 MST ----

We may just need to add an "error"-production to the appropriate rule.
 Of course this may get tedious if we want to add error productions to
all declarations.

(a student trainee has expressed interest in working on this bug)




---- Additional Comments From marek.safar@seznam.cz 2007-02-19 05:39:52 MST ----

Maybe I am wrong but in this case we cannot do any factorization
otherwise we can reduce/reduce conflict.

The option is to inline all keywords to all sections which is horrible.


Unknown operating system unknown. Setting to default OS "Other".

Comment 2 Marek Safar 2008-10-10 10:56:26 UTC
Fixed in SVN.