April 05, 2010 [Issue 4063] New: [CTFE] key not found in AA gives bad error message | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4063 Summary: [CTFE] key not found in AA gives bad error message Product: D Version: future Platform: x86 OS/Version: Windows Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2010-04-05 05:29:45 PDT --- int foo(string s) { enum int[string] aa = ["aa":1, "bb":2]; return aa[s]; } enum _ = foo("xx"); // line 5 void main() {} dmd 2.042 gives: test.d(5): Error: cannot evaluate foo("xx") at compile time test.d(5): Error: cannot evaluate foo("xx") at compile time A much better pair of error messages can be: test.d(3): Error: Range violation. Key "xx" not found in associative array 'aa'. test.d(5): Error: cannot evaluate foo("xx") at compile time. Or just (if the symmetry with the run-time error is not considered important): test.d(3): key "xx" not found in associative array 'aa'. test.d(5): Error: cannot evaluate foo("xx") at compile time. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 17, 2011 [Issue 4063] [CTFE] key not found in AA gives bad error message | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4063 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-06-17 01:08:40 PDT --- https://github.com/D-Programming-Language/dmd/commit/0835250480c1458cc868b511da7cd0f757f33029 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation