[Issue 13718] New: unary minus on number literals has lower precedence than UFCS
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Wed Nov 12 11:06:12 PST 2014
    
    
  
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 at puremagic.com
          Reporter: code at 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'.
--
    
    
More information about the Digitalmars-d-bugs
mailing list