digitalmars.D.bugs - [Issue 977] New: Wrong line number reported for a missing comma in an array initializer within a struct initializer
- d-bugmail puremagic.com (29/29) Feb 17 2007 http://d.puremagic.com/issues/show_bug.cgi?id=977
- d-bugmail puremagic.com (17/17) Feb 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=977
- d-bugmail puremagic.com (21/21) Feb 01 2012 http://d.puremagic.com/issues/show_bug.cgi?id=977
- d-bugmail puremagic.com (17/21) Feb 02 2012 http://d.puremagic.com/issues/show_bug.cgi?id=977
- d-bugmail puremagic.com (16/30) Feb 02 2012 http://d.puremagic.com/issues/show_bug.cgi?id=977
- d-bugmail puremagic.com (11/11) Mar 05 2012 http://d.puremagic.com/issues/show_bug.cgi?id=977
- d-bugmail puremagic.com (9/9) Mar 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=977
- d-bugmail puremagic.com (9/9) Mar 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=977
- d-bugmail puremagic.com (10/10) Mar 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=977
http://d.puremagic.com/issues/show_bug.cgi?id=977 Summary: Wrong line number reported for a missing comma in an array initializer within a struct initializer Product: D Version: 1.006 Platform: PC OS/Version: Windows Status: NEW Keywords: diagnostic Severity: minor Priority: P3 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: deewiant gmail.com struct S { int[] x; } S s = { [ 1, 2, 3, 4, 5, 6 7, 8, 9 // error line number should be here (line 12) ] } // but is here (line 15) ; If an array is initialized directly and there's no struct initializer, the line number is reported correctly. --
Feb 17 2007
http://d.puremagic.com/issues/show_bug.cgi?id=977 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |cbkbbejeap mailinator.com Bug 977 depends on bug 3994, which changed state. Bug 3994 Summary: Wrong line numbers inside AA/Array initializers http://d.puremagic.com/issues/show_bug.cgi?id=3994 What |Old Value |New Value ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #1 from yebblies <yebblies gmail.com> 2012-02-02 13:58:42 EST --- *** Issue 3994 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 01 2012
http://d.puremagic.com/issues/show_bug.cgi?id=977 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com Platform|x86 |All Version|1.006 |D1 & D2 Summary|Wrong line number reported |Expressions inside a struct |for a missing comma in an |or array initializer get |array initializer within a |wrong line number |struct initializer | OS/Version|Windows |All Severity|minor |major --- Comment #2 from yebblies <yebblies gmail.com> 2012-02-02 14:02:38 EST --- This happens because the parser scans across the whole initializer to determine if it's an expression or an initializer. Because it's already lexed the whole initializer, the lexer's loc points to the end, and this is what is assigned to each expression. Not sure how to solve this without re-lexing the initializer. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 01 2012
http://d.puremagic.com/issues/show_bug.cgi?id=977 Stewart Gordon <smjg iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com --- Comment #3 from Stewart Gordon <smjg iname.com> 2012-02-02 12:04:33 PST --- (In reply to comment #2)This happens because the parser scans across the whole initializer to determine if it's an expression or an initializer. Because it's already lexed the whole initializer, the lexer's loc points to the end, and this is what is assigned to each expression. Not sure how to solve this without re-lexing the initializer.But it manages to give line numbers for errors that occur in the semantic analysis phase. The D compiler first lexes/parses the entire source file, then semantically analyses it. So it should be able to get this right. Two ways I can see to do it: - Remember the line number of every token just in case - Realise on hitting the 7 that it is no longer parseable as either an expression or an initialiser, and deliver the error there and then. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 02 2012
http://d.puremagic.com/issues/show_bug.cgi?id=977 --- Comment #4 from yebblies <yebblies gmail.com> 2012-02-03 12:47:13 EST --- (In reply to comment #3)(In reply to comment #2)It lexes while it parses, so when the parser creates the ast it can use the current location of the lexer instead of storing in the tokens. This is very efficient and works everywhere except when arbitrary lookahead is required.This happens because the parser scans across the whole initializer to determine if it's an expression or an initializer. Because it's already lexed the whole initializer, the lexer's loc points to the end, and this is what is assigned to each expression. Not sure how to solve this without re-lexing the initializer.But it manages to give line numbers for errors that occur in the semantic analysis phase. The D compiler first lexes/parses the entire source file, then semantically analyses it. So it should be able to get this right.Two ways I can see to do it: - Remember the line number of every token just in caseAs a last resort. This would likely be a performance hit, and complicate the parser code in most places for no benefit.- Realise on hitting the 7 that it is no longer parseable as either an expression or an initialiser, and deliver the error there and then.It would have to be parsing to find this error, while it scans it's only lexing. The relevant code is at 3185 and 3272 in parse.c The solution is probably to initially parse it one way and convert if wrong, preserving location information, but this might not be possible. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 02 2012
http://d.puremagic.com/issues/show_bug.cgi?id=977 ponce <aliloko gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aliloko gmail.com --- Comment #5 from ponce <aliloko gmail.com> 2012-03-05 17:03:12 PST --- My patch proposal: https://github.com/p0nce/dmd/commit/bedcd6e7dc43087afdf816cf00debba03aafd400 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 05 2012
http://d.puremagic.com/issues/show_bug.cgi?id=977 --- Comment #6 from github-bugzilla puremagic.com 2012-03-07 19:27:09 PST --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/dc8b6ea10b4e76cddc0e13119443e286cff6ba6c Merge pull request #790 from p0nce/master Bug 977 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=977 --- Comment #7 from github-bugzilla puremagic.com 2012-03-07 21:17:45 PST --- Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6f9e42c84fc1d4fdd91d2387fe5bbdf549e8b018 fix Issue 977 - Expressions inside a struct or array initializer get wrong line number -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=977 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 07 2012