Bug 107 – Wrong filename in error message when using a mixin

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2006-04-15T08:02:00Z
Last change time
2012-01-19T01:33:24Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
benoit
Blocks
1324

Comments

Comment #0 by benoit — 2006-04-15T08:02:01Z
if template declaration and mixin are in different files, and an error occurs, the message: file1(2465): template instance ... error instantiating the filename is from the file with the template decl, the line number from the file with the mixin instantion. Filename should be the one of the mixin instantiation.
Comment #1 by thomas-dloop — 2006-04-18T01:35:30Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-04-15: > if template declaration and mixin are in different files, and an error occurs, > the message: > > file1(2465): template instance ... error instantiating > > the filename is from the file with the template decl, the line number from the > file with the mixin instantion. > > Filename should be the one of the mixin instantiation. Added to DStress as http://dstress.kuehne.cn/compile/m/mixin_21_A.d http://dstress.kuehne.cn/nocompile/m/mixin_21_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFERJR03w+/yD4P9tIRAlo/AJ969+RThjLSp0BJeu/RiiCu03SB1gCfeBFW 7JAhupo+2H+tYM8w9lBbAqY= =yj8G -----END PGP SIGNATURE-----
Comment #2 by thomas-dloop — 2007-04-27T12:37:12Z
DMD-1.013 uses the correct file but the wrong line number
Comment #3 by d — 2008-06-01T10:29:08Z
Using dmd 1.030 I got errors like this with mixins and templates (in different files): (4): Error: ... (5): Error: ... I.e. no filename and wrong line numbers (no where near relevent lines in either file but the errors appear on lines 5 & 6 of the mixin string).
Comment #4 by shro8822 — 2008-06-01T12:12:14Z
As to the file name, this is not a bug (maybe a miss-feature). The actual file name can't be used as this will result in totally bogus error messages. What would be preferred would be something like the enclosing file suffixed with the line number of the mixin. It would make a good feature request though. As to the line number, I'd say that using zero based indexing in mixins IS a bug.
Comment #5 by andrei — 2010-11-26T10:03:49Z
Could not reproduce on dmd 2.050, it probably was fixed a few releases ago for both D1 and D2.
Comment #6 by leandro.lucarella — 2010-11-26T11:03:32Z
luca@homero:/tmp/dmd/dmd$ cat -n mixin_21_A.d 1 // $HeadURL: http://dstress.kuehne.cn/compile/m/mixin_21_A.d $ 2 // $Date: 2006-12-31 20:58:06 +0100 (Sun, 31 Dec 2006) $ 3 // $Author: thomask $ 4 5 // @author@ <[email protected]> 6 // @date@ 2006-04-15 7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=107 8 9 module mixin_21_A; 10 11 template T(){ 12 UNDEFINED x; 13 } 14 luca@homero:/tmp/dmd/dmd$ cat -n mixin_21_B.d 1 // $HeadURL: http://dstress.kuehne.cn/nocompile/m/mixin_21_B.d $ 2 // $Date: 2006-12-31 20:58:06 +0100 (Sun, 31 Dec 2006) $ 3 // $Author: thomask $ 4 5 // @author@ <[email protected]> 6 // @date@ 2006-04-15 7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=107 8 9 // __DSTRESS_ELINE__ 15 10 11 module mixin_21_B; 12 13 import mixin_21_A; 14 15 mixin T!(); 16 luca@homero:/tmp/dmd/dmd$ ./linux/bin/dmd -c mixin_21_B.d mixin_21_A.d(12): Error: identifier 'UNDEFINED' is not defined mixin_21_A.d(12): Error: UNDEFINED is used as a type mixin_21_B.d(12): Error: variable mixin_21_B.T!().x voids have no value mixin_21_B.d(15): Error: mixin mixin_21_B.T!() error instantiating luca@homero:/tmp/dmd/dmd$ ./linux/bin/dmd | head -n 1 Digital Mars D Compiler v1.065 Note that the 3er error is WRONG (line 12 in mixin_21_B.d is blank) Andrei, this is the second bug you close that is NOT fixed. PLEASE, PLEASE, be a little more careful testing the bugs before you close them. It's not very serious, really.
Comment #7 by andrei — 2010-11-26T11:11:20Z
Marking as a D1 only issue. Sorry for not testing with D1 too; I wrongly assumed that most bugs will get fixed simultaneously on D1 and D2.
Comment #8 by leandro.lucarella — 2010-11-26T11:17:36Z
(In reply to comment #7) > Marking as a D1 only issue. Sorry for not testing with D1 too; I wrongly > assumed that most bugs will get fixed simultaneously on D1 and D2. OK, I confirmed this one is really D1 only :)
Comment #9 by andrei — 2010-11-26T11:22:29Z
Assigning to Walter.
Comment #10 by leandro.lucarella — 2012-01-18T09:32:34Z
Works now on DMD 1.071. If it work with the current version too tests should be added to the test suit and the bug can be closed.
Comment #11 by leandro.lucarella — 2012-01-18T09:33:52Z
(In reply to comment #10) > Works now on DMD 1.071. If it work with the current version too tests should be > added to the test suit and the bug can be closed. BTW, this is the error message I get, line numbers and files look good: mixin_21_A.d(12): Error: undefined identifier UNDEFINED mixin_21_B.d(15): Error: mixin mixin_21_B.T!() error instantiating
Comment #12 by bugzilla — 2012-01-18T12:50:30Z
Yup, verified fixed.
Comment #13 by andrei — 2012-01-18T13:48:27Z
Thanks!
Comment #14 by leandro.lucarella — 2012-01-19T01:33:24Z
(In reply to comment #12) > Yup, verified fixed. Cool! Is there a test in the test suite for this? Would be nice to be sure it will never break again.