[Issue 3905] Wrong error message with wrong opBinary("in")
https://issues.dlang.org/show_bug.cgi?id=3905 Vladimir Panteleev changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |DUPLICATE --- Comment #7 from Vladimir Panteleev --- The error message is now: test.d(7): Error: incompatible types for ((3) in (Group(1, 2))): 'int' and 'Group' Fixed by https://github.com/dlang/dmd/pull/6140 *** This issue has been marked as a duplicate of issue 16499 *** --
[Issue 3905] Wrong error message with wrong opBinary("in")
http://d.puremagic.com/issues/show_bug.cgi?id=3905 Don changed: What|Removed |Added Keywords||diagnostic, patch CC||clugd...@yahoo.com.au --- Comment #1 from Don 2010-09-30 01:37:09 PDT --- PATCH: expression.c, line 10624, InExp::semantic() default: -error("rvalue of in expression must be an associative array, not %s", e2->type->toChars()); +error("%s has no opBinaryRight(\"in\") operator and %s has no opBinary(\"in\") operator", e1->type->toChars(), e2->type->toChars()); case Terror: return new ErrorExp(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3905] Wrong error message with wrong opBinary("in")
http://d.puremagic.com/issues/show_bug.cgi?id=3905 --- Comment #2 from bearophile_h...@eml.cc 2010-09-30 05:10:35 PDT --- Thank you Don :-) I need to be able to write a patch like this by myself. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3905] Wrong error message with wrong opBinary("in")
http://d.puremagic.com/issues/show_bug.cgi?id=3905 Walter Bright changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||WONTFIX --- Comment #3 from Walter Bright 2010-12-04 18:36:08 PST --- I'm not convinced this new error message is an improvement. All the expression error messages work on the assumption that operator overloads do not exist, as that is the normal case. Trying to write an error message for the normal case in terms of "you screwed up the operator overloads" is not helpful. For example, int a; double b; a in b; will give a pretty much incomprehensible error message to the user: test.d(7): Error: double has no opBinaryRight("in") operator and int has no opBinary("in") operator. ??? I'd prefer to leave the message as is. If someone is doing operator overloading, the message makes it clear the operator overloading failed to find a match. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3905] Wrong error message with wrong opBinary("in")
http://d.puremagic.com/issues/show_bug.cgi?id=3905 Steven Schveighoffer changed: What|Removed |Added Status|RESOLVED|REOPENED CC||schvei...@yahoo.com Resolution|WONTFIX | --- Comment #4 from Steven Schveighoffer 2010-12-04 22:46:00 PST --- I agree that the proposed patch is not better. But the original message is invalid. This is a bug that needs to be fixed, regardless of whether you like the given proposals. Point in fact, in *can* work on types besides associative arrays. I tried this: struct S {} void main() { S s; auto t = s + s; } And got: Error: incompatible types for ((s) + (s)): 'S' and 'S' So extrapolating to in, the error should look like: Error: incompatible types for ((3) in (Group(1, 2))): 'int' and 'Group' Although, I'm unsure why there are so many parentheses... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3905] Wrong error message with wrong opBinary("in")
http://d.puremagic.com/issues/show_bug.cgi?id=3905 --- Comment #5 from bearophile_h...@eml.cc 2010-12-11 00:20:31 PST --- Saying that double has no "in" is correct (even if it's a bit noisy and overkill), while saying "rvalue of in expression must be an associative array, not Group" is wrong. I think this bug report is valid still, because the current error message is confusing. So a better solution will be useful. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3905] Wrong error message with wrong opBinary("in")
http://d.puremagic.com/issues/show_bug.cgi?id=3905 --- Comment #6 from yebblies 2013-01-17 02:14:10 EST --- *** Issue 7837 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: ---