Wiki

Ticket #98 (closed enhancement: fixed)

Opened 9 years ago

Last modified 9 years ago

enhance error message on wrong use of != operator

Reported by: jonathandavid Owned by: Chuck
Priority: medium Milestone: Cobra 0.9
Component: Cobra Compiler Version: 0.8.0
Keywords: warning,hint Cc:

Description

Most people new to Cobra and coming from a strong C/C++/Java/C# background will inadvertently write things like "x != 3.0f".

Right now the compiler responds to such code with an error message that is misleading, to say the least (something among the lines of "error: cannot convert implicitly from type double to type double?".

It would be nice if the compiler gave a more specific message ("Unrecognized operator") and even better if it could give a useful hint as well ("Did you mean <>? Cobra does not use != for inequality comparisons")

Change History

Changed 9 years ago by Chuck

  • priority changed from minor to medium
  • milestone set to Cobra 0.9

Changed 9 years ago by Chuck

  • status changed from new to accepted
  • owner set to Chuck

I already get an informative error message for "if x != y":

sug.cobra(7): error: Cannot use an augmented assignment in a flow control
expression. "a != b" means "a = a ! b" where "!" is an operator
concerning nil. If you meant "does not equal" then use "<>".

But not for other uses of the expression:

x = 1
y = 2
b = x != y

...which I will work on.

Changed 9 years ago by Chuck

  • status changed from accepted to closed
  • resolution set to fixed

Fixed in changeset:1848

Note: See TracTickets for help on using tickets.