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

Improve error reporting: Missing = on type declaration #1121

Closed
Tracked by #1103
isaacabraham opened this issue Apr 26, 2016 · 4 comments
Closed
Tracked by #1103

Improve error reporting: Missing = on type declaration #1121

isaacabraham opened this issue Apr 26, 2016 · 4 comments

Comments

@isaacabraham
Copy link
Contributor

What

The following error message is generated from this code sample

type Person { Name : string; Age : int; City : string }

error FS0010: Unexpected symbol '{' in type definition. Expected '(' or other token.

Why

The error message suggests to the user that they should put a ( in to fix the problem (or some other unspecified token), when in fact they have missed the = operator. Many other languages allow you to define types without the = sign, so this is not an uncommon issue.

How

Rewrite the above error to something like error FS0010: Unexpected symbol '{' in type definition. Did you forget to use the = operator e.g. "type Person = { Name ..." .

@smoothdeveloper
Copy link
Contributor

I happen to frequently miss the equal when I defined classes, which breaks intellisense.

I do not do it as much with records or DUs but I think it would be helpful to identify the likely case to have better error messages.

@smoothdeveloper
Copy link
Contributor

Related #1826

@cartermp
Copy link
Contributor

Implemented in #9642

@isaacabraham
Copy link
Contributor Author

Whoo!

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

4 participants