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

Float32 without dot raises error on compile, but no error in editor #9338

Closed
abelbraaksma opened this issue May 29, 2020 · 4 comments
Closed

Comments

@abelbraaksma
Copy link
Contributor

abelbraaksma commented May 29, 2020

The following code does not show red squigglies, but throws when compiled:

let test = 1f

No red underline:

image

Expected behavior

If it's an error, it should show as an error.

Actual behavior

No error is shown, but when compiling, it shows:

error FS1153: Invalid floating point number

Known workarounds

Just use a dot in the number. I think it'll compile if you set the Preview-flag in the project (as dotless float32 literals are going to be allowed), but I haven't tried that.

Related information

This is probably just a glitch from implementing fsharp/fslang-suggestions#750, i.e. this PR: #7839.

I don't expect this to be fixed, as this syntax is expected to be allowed in F# 5 in a few months anyway, but it's a gotcha we should look out for when implementing stuff with the Preview-switch. I mean: in this case, the IDE error-check seems to have been removed and isn't under the Preview-switch, and the rest is, leading to inconsistencies in behavior.

@KevinRansom
Copy link
Member

@abelbraaksma , I believe the IDE always uses the preview syntax, whereas the compiler requires a developer to specify a language version of preview to activate that code. If I remember the early discussions on this, it was to match what we believed roslyn did.

@abelbraaksma
Copy link
Contributor Author

abelbraaksma commented May 29, 2020

Ah, ok. If that's the case, surprises like the one above when someone uses new syntax in the IDE (not a Preview of VS) are to be expected. I reckon this can be closed then.

Btw, @KevinRansom, would you happen to have some time to look into my repro of "our big issue" of locking-up of VS (delay between each keystroke up to many minutes)? Last week I posted a rather small repro, which took several days to get. Since then, it seems the issue has walked off the radar. I'd totally understand if you can't, but it'd be nice to have some feedback on the repro (i.e.: does it repro for you too?), even if you can't look into it further. I mean this issue: #9201.

@KevinRansom
Copy link
Member

@abelbraaksma right now, I am a bit slammed. But I will take a look at the repo and think about things.

@KevinRansom
Copy link
Member

closing per @abelbraaksma

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

No branches or pull requests

2 participants