Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integer unary negation mishandled #6678

Closed
vicuna opened this issue Nov 26, 2014 · 2 comments
Closed

integer unary negation mishandled #6678

vicuna opened this issue Nov 26, 2014 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Nov 26, 2014

Original bug ID: 6678
Reporter: MarkJosephs
Status: closed (set by @xavierleroy on 2016-12-07T10:37:00Z)
Resolution: not a bug
Priority: normal
Severity: minor
Category: runtime system and C interface
Monitored by: @gasche

Bug description

- (1. +. 2.);;

Error: This expression has type float but an expression was expected of type
int

- (1.);;

  • : float = -1.

The latter should also be reported as an error for the same reason as the former.

@vicuna
Copy link
Author

vicuna commented Nov 26, 2014

Comment author: @gasche

In the latter case, the parser recognizes that the argument of "-" is a float constant and thus handles the input as a float literal (just as using "-."). Do we really need to change something here?

@vicuna
Copy link
Author

vicuna commented Nov 29, 2014

Comment author: @xavierleroy

" - (1.) " falls into the same code that handles " - 1.0 ". Nobody wants to have to write " -. 1.0 " for a negative floating-point literal. Hence, the (harmless) tolerance for " - (1.) " is here to stay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant