digitalmars.D.bugs - [Issue 13718] New: unary minus on number literals has lower
- via Digitalmars-d-bugs (25/25) Nov 12 2014 https://issues.dlang.org/show_bug.cgi?id=13718
https://issues.dlang.org/show_bug.cgi?id=13718 Issue ID: 13718 Summary: unary minus on number literals has lower precedence than UFCS Product: D Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: code dawg.eu This is somewhat surprising when you think of the following. -2.sin `-sin(2)` instead of `sin(-2)` But OTOH it's consistent with so just explicitly explaining this in the docs would be enough IMO. -obj.val Definitely a problem is the compiler error for this. -2.toJson '(JSONValue __ctmp1507 = JSONValue; , __ctmp1507).this(2)' is not of arithmetic type, it is a JSONValue It should read something like 'unary minus cannot be applied to a JSONValue'. --
Nov 12 2014